]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Oct 2010 17:52:56 +0000 (10:52 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 22 Oct 2010 17:52:56 +0000 (10:52 -0700)
* 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl:
  vfs: make no_llseek the default
  vfs: don't use BKL in default_llseek
  llseek: automatically add .llseek fop
  libfs: use generic_file_llseek for simple_attr
  mac80211: disallow seeks in minstrel debug code
  lirc: make chardev nonseekable
  viotape: use noop_llseek
  raw: use explicit llseek file operations
  ibmasmfs: use generic_file_llseek
  spufs: use llseek in all file operations
  arm/omap: use generic_file_llseek in iommu_debug
  lkdtm: use generic_file_llseek in debugfs
  net/wireless: use generic_file_llseek in debugfs
  drm: use noop_llseek

101 files changed:
1  2 
arch/arm/kernel/etm.c
arch/arm/plat-mxc/audmux-v2.c
arch/cris/arch-v10/drivers/ds1302.c
arch/cris/arch-v10/drivers/pcf8563.c
arch/cris/arch-v10/drivers/sync_serial.c
arch/cris/arch-v32/drivers/cryptocop.c
arch/cris/arch-v32/drivers/mach-a3/gpio.c
arch/cris/arch-v32/drivers/mach-fs/gpio.c
arch/cris/arch-v32/drivers/pcf8563.c
arch/cris/arch-v32/drivers/sync_serial.c
arch/ia64/kernel/salinfo.c
arch/powerpc/kernel/lparcfg.c
arch/um/drivers/harddog_kern.c
block/bsg.c
drivers/acpi/apei/erst-dbg.c
drivers/block/DAC960.c
drivers/block/aoe/aoechr.c
drivers/block/paride/pg.c
drivers/block/paride/pt.c
drivers/block/pktcdvd.c
drivers/char/apm-emulation.c
drivers/char/ds1302.c
drivers/char/ds1620.c
drivers/char/dsp56k.c
drivers/char/dtlk.c
drivers/char/genrtc.c
drivers/char/ip2/ip2main.c
drivers/char/ipmi/ipmi_devintf.c
drivers/char/ipmi/ipmi_watchdog.c
drivers/char/lp.c
drivers/char/mem.c
drivers/char/mmtimer.c
drivers/char/mwave/mwavedd.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c
drivers/char/raw.c
drivers/char/rio/rio_linux.c
drivers/char/snsc.c
drivers/char/tlclk.c
drivers/char/toshiba.c
drivers/char/viotape.c
drivers/char/xilinx_hwicap/xilinx_hwicap.c
drivers/gpu/drm/i810/i810_dma.c
drivers/gpu/drm/i830/i830_dma.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
drivers/gpu/vga/vgaarb.c
drivers/hid/hidraw.c
drivers/hid/usbhid/hiddev.c
drivers/ide/ide-tape.c
drivers/input/evdev.c
drivers/input/joydev.c
drivers/input/misc/uinput.c
drivers/macintosh/via-pmu.c
drivers/media/IR/ir-lirc-codec.c
drivers/media/dvb/bt8xx/dst_ca.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_ca_en50221.c
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/dvb-core/dvbdev.c
drivers/misc/phantom.c
drivers/net/ppp_generic.c
drivers/net/wireless/ray_cs.c
drivers/oprofile/oprofile_files.c
drivers/oprofile/oprofilefs.c
drivers/rtc/rtc-m41t80.c
drivers/scsi/3w-9xxx.c
drivers/scsi/3w-sas.c
drivers/scsi/3w-xxxx.c
drivers/scsi/aacraid/linit.c
drivers/scsi/ch.c
drivers/scsi/dpt_i2o.c
drivers/scsi/gdth.c
drivers/scsi/megaraid.c
drivers/scsi/megaraid/megaraid_mm.c
drivers/scsi/megaraid/megaraid_sas.c
drivers/scsi/mpt2sas/mpt2sas_ctl.c
drivers/scsi/scsi_tgt_if.c
drivers/scsi/sg.c
drivers/serial/mfd.c
drivers/spi/dw_spi.c
drivers/telephony/ixj.c
drivers/usb/core/file.c
drivers/vhost/net.c
drivers/watchdog/cpwd.c
fs/char_dev.c
fs/coda/psdev.c
fs/ecryptfs/file.c
fs/gfs2/file.c
fs/ocfs2/stack_user.c
fs/proc/base.c
fs/proc/task_mmu.c
include/linux/fs.h
kernel/kprobes.c
kernel/trace/blktrace.c
kernel/trace/ftrace.c
kernel/trace/ring_buffer.c
kernel/trace/trace_events.c
net/sunrpc/cache.c
security/apparmor/apparmorfs.c
virt/kvm/kvm_main.c

diff --combined arch/arm/kernel/etm.c
index a48d512579880fcb7d6795603a367ec7c1133b3f,30b8878f12026bab4d712d63c479ca3755cf0004..11db62806a1a205b82f74b6c55d22dc772d80120
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Alexander Shishkin");
  
 +/*
 + * ETM tracer state
 + */
 +struct tracectx {
 +      unsigned int    etb_bufsz;
 +      void __iomem    *etb_regs;
 +      void __iomem    *etm_regs;
 +      unsigned long   flags;
 +      int             ncmppairs;
 +      int             etm_portsz;
 +      struct device   *dev;
 +      struct clk      *emu_clk;
 +      struct mutex    mutex;
 +};
 +
  static struct tracectx tracer;
  
  static inline bool trace_isrunning(struct tracectx *t)
@@@ -329,6 -314,7 +329,7 @@@ static const struct file_operations etb
        .read = etb_read,
        .open = etb_open,
        .release = etb_release,
+       .llseek = no_llseek,
  };
  
  static struct miscdevice etb_miscdev = {
index 62920490c0d6be3900b7475548a1ffbbc3d44b8a,25ad95ba92a43377136077841a4e7ecfd5e19e5c..0be1ac7f421b0ab2f5a244e5185cd23a5b792da2
@@@ -137,6 -137,7 +137,7 @@@ static ssize_t audmux_read_file(struct 
  static const struct file_operations audmux_debugfs_fops = {
        .open = audmux_open_file,
        .read = audmux_read_file,
+       .llseek = default_llseek,
  };
  
  static void audmux_debugfs_init(void)
@@@ -186,13 -187,7 +187,13 @@@ EXPORT_SYMBOL_GPL(mxc_audmux_v2_configu
  static int mxc_audmux_v2_init(void)
  {
        int ret;
 -
 +#if defined(CONFIG_ARCH_MX5)
 +      if (cpu_is_mx51()) {
 +              audmux_base = MX51_IO_ADDRESS(MX51_AUDMUX_BASE_ADDR);
 +              ret = 0;
 +              return ret;
 +      }
 +#endif
  #if defined(CONFIG_ARCH_MX3)
        if (cpu_is_mx31())
                audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR);
index 4b92ad08b0ff2c8fa6534c19a843d578c4cff636,95aadb4a8cf1d5849d114a6bfe8379fe698084b9..3d655dcc65da89df480c51d25c6b0b7199965053
@@@ -19,7 -19,7 +19,7 @@@
  #include <linux/module.h>
  #include <linux/miscdevice.h>
  #include <linux/delay.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/bcd.h>
  #include <linux/capability.h>
  
@@@ -34,7 -34,6 +34,7 @@@
  
  #define RTC_MAJOR_NR 121 /* local major, change later */
  
 +static DEFINE_MUTEX(ds1302_mutex);
  static const char ds1302_name[] = "ds1302";
  
  /* The DS1302 might be connected to different bits on different products. 
@@@ -358,9 -357,9 +358,9 @@@ static long rtc_unlocked_ioctl(struct f
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&ds1302_mutex);
        ret = rtc_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ds1302_mutex);
  
        return ret;
  }
@@@ -388,6 -387,7 +388,7 @@@ print_rtc_status(void
  static const struct file_operations rtc_fops = {
        .owner          = THIS_MODULE,
        .unlocked_ioctl = rtc_unlocked_ioctl,
+       .llseek         = noop_llseek,
  }; 
  
  /* Probe for the chip by writing something to its RAM and try reading it back. */
index 2f1ddedca2bd4135c7d2a99f3b870d19d34edc98,7aa6ff00a117e288f62b2b28c707e9780f51af8a..ea69faba9b6212f00a731652e96966ed1116186c
@@@ -27,6 -27,7 +27,6 @@@
  #include <linux/delay.h>
  #include <linux/bcd.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  
  #include <asm/uaccess.h>
  #include <asm/system.h>
@@@ -48,7 -49,6 +48,7 @@@
  #define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
  #define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
  
 +static DEFINE_MUTEX(pcf8563_mutex);
  static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
  
  static const unsigned char days_in_month[] =
@@@ -64,6 -64,7 +64,7 @@@ static int voltage_low
  static const struct file_operations pcf8563_fops = {
        .owner = THIS_MODULE,
        .unlocked_ioctl = pcf8563_unlocked_ioctl,
+       .llseek         = noop_llseek,
  };
  
  unsigned char
@@@ -343,9 -344,9 +344,9 @@@ static long pcf8563_unlocked_ioctl(stru
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&pcf8563_mutex);
        return pcf8563_ioctl(filp, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&pcf8563_mutex);
  
        return ret;
  }
index 3d9fa074a941ff129cd3a500a6e4f78df18bd244,e501632fa8c263884d6bf51ffa6cb34eb3f95b36..399dc1ec8e6fe3c4e1ac5d3bd89bd0537a57a490
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/interrupt.h>
  #include <linux/poll.h>
  #include <linux/init.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/timer.h>
  #include <asm/irq.h>
  #include <asm/dma.h>
@@@ -149,7 -149,6 +149,7 @@@ struct sync_port 
  };
  
  
 +static DEFINE_MUTEX(sync_serial_mutex);
  static int etrax_sync_serial_init(void);
  static void initialize_port(int portnbr);
  static inline int sync_data_avail(struct sync_port *port);
@@@ -251,7 -250,8 +251,8 @@@ static const struct file_operations syn
        .poll           = sync_serial_poll,
        .unlocked_ioctl = sync_serial_ioctl,
        .open           = sync_serial_open,
-       .release        = sync_serial_release
+       .release        = sync_serial_release,
+       .llseek         = noop_llseek,
  };
  
  static int __init etrax_sync_serial_init(void)
@@@ -446,7 -446,7 +447,7 @@@ static int sync_serial_open(struct inod
        int mode;
        int err = -EBUSY;
  
 -      lock_kernel();
 +      mutex_lock(&sync_serial_mutex);
        DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
  
        if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
        ret = 0;
        
  out:
 -      unlock_kernel();
 +      mutex_unlock(&sync_serial_mutex);
        return ret;
  }
  
@@@ -962,9 -962,9 +963,9 @@@ static long sync_serial_ioctl(struct fi
  {
        long ret;
  
 -      lock_kernel();
 +      mutex_lock(&sync_serial_mutex);
        ret = sync_serial_ioctl_unlocked(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&sync_serial_mutex);
  
        return ret;
  }
index 0973d5a2780facd8110d434815da2502a8ff0bc1,dcb43fddfb991b1689a3afcafef1c02ff4710529..c03bc3bc30c2f581f1dce2a4783fcf570d81ab6c
@@@ -281,7 -281,8 +281,8 @@@ const struct file_operations cryptocop_
        .owner          = THIS_MODULE,
        .open           = cryptocop_open,
        .release        = cryptocop_release,
-       .unlocked_ioctl = cryptocop_ioctl
+       .unlocked_ioctl = cryptocop_ioctl,
+       .llseek         = noop_llseek,
  };
  
  
@@@ -3139,9 -3140,9 +3140,9 @@@ cryptocop_ioctl(struct file *filp, unsi
         struct inode *inode = file->f_path.dentry->d_inode;
         long ret;
  
 -       lock_kernel();
 +       mutex_lock(&cryptocop_mutex);
         ret = cryptocop_ioctl_unlocked(inode, filp, cmd, arg);
 -       unlock_kernel();
 +       mutex_unlock(&cryptocop_mutex);
  
         return ret;
  }
index 50d1885c47942ef5131fe0ec36e605e9d134454f,06b24ebda4108e4eeccf48194c77b802c5a53683..c845831e222590c7e6289d4fef846ea21305aadf
@@@ -23,7 -23,7 +23,7 @@@
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <linux/spinlock.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include <asm/etraxgpio.h>
  #include <hwregs/reg_map.h>
@@@ -66,7 -66,6 +66,7 @@@ static int dp_cnt
  #define DP(x)
  #endif
  
 +static DEFINE_MUTEX(gpio_mutex);
  static char gpio_name[] = "etrax gpio";
  
  #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
@@@ -392,7 -391,7 +392,7 @@@ static int gpio_open(struct inode *inod
        if (!priv)
                return -ENOMEM;
  
 -      lock_kernel();
 +      mutex_lock(&gpio_mutex);
        memset(priv, 0, sizeof(*priv));
  
        priv->minor = p;
                spin_unlock_irq(&gpio_lock);
        }
  
 -      unlock_kernel();
 +      mutex_unlock(&gpio_mutex);
        return 0;
  }
  
@@@ -668,9 -667,9 +668,9 @@@ static long gpio_ioctl(struct file *fil
  {
         long ret;
  
 -       lock_kernel();
 +       mutex_lock(&gpio_mutex);
         ret = gpio_ioctl_unlocked(file, cmd, arg);
 -       unlock_kernel();
 +       mutex_unlock(&gpio_mutex);
  
         return ret;
  }
@@@ -894,6 -893,7 +894,7 @@@ static const struct file_operations gpi
        .write          = gpio_write,
        .open           = gpio_open,
        .release        = gpio_release,
+       .llseek         = noop_llseek,
  };
  
  #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
index de8dca0550f213f07dd427ca25621563a4a4acdd,0649c8bea6763e92cc7f0a9988b002f96c6e2b3b..ee90d2659be76db461cd12043bffe842160420a9
@@@ -22,7 -22,7 +22,7 @@@
  #include <linux/init.h>
  #include <linux/interrupt.h>
  #include <linux/spinlock.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include <asm/etraxgpio.h>
  #include <hwregs/reg_map.h>
@@@ -64,7 -64,6 +64,7 @@@ static int dp_cnt
  #define DP(x)
  #endif
  
 +static DEFINE_MUTEX(gpio_mutex);
  static char gpio_name[] = "etrax gpio";
  
  #if 0
@@@ -430,7 -429,7 +430,7 @@@ gpio_open(struct inode *inode, struct f
        if (!priv)
                return -ENOMEM;
  
 -      lock_kernel();
 +      mutex_lock(&gpio_mutex);
        memset(priv, 0, sizeof(*priv));
  
        priv->minor = p;
        alarmlist = priv;
        spin_unlock_irq(&alarm_lock);
  
 -      unlock_kernel();
 +      mutex_unlock(&gpio_mutex);
        return 0;
  }
  
@@@ -709,9 -708,9 +709,9 @@@ static long gpio_ioctl(struct file *fil
  {
         long ret;
  
 -       lock_kernel();
 +       mutex_lock(&gpio_mutex);
         ret = gpio_ioctl_unlocked(file, cmd, arg);
 -       unlock_kernel();
 +       mutex_unlock(&gpio_mutex);
  
         return ret;
  }
@@@ -871,6 -870,7 +871,7 @@@ static const struct file_operations gpi
        .write          = gpio_write,
        .open           = gpio_open,
        .release        = gpio_release,
+       .llseek         = noop_llseek,
  };
  
  #ifdef CONFIG_ETRAX_VIRTUAL_GPIO
index bdcac9dec5cbc156be3e41ca455ef15214ca328f,0f7b101ee5ee9a6d751e8c0cbef9d6f5aa043837..b6e4fc0aad42e844899b5f213a28262038cbbd2f
@@@ -24,6 -24,7 +24,6 @@@
  #include <linux/init.h>
  #include <linux/fs.h>
  #include <linux/ioctl.h>
 -#include <linux/smp_lock.h>
  #include <linux/delay.h>
  #include <linux/bcd.h>
  #include <linux/mutex.h>
@@@ -44,7 -45,6 +44,7 @@@
  #define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
  #define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
  
 +static DEFINE_MUTEX(pcf8563_mutex);
  static DEFINE_MUTEX(rtc_lock); /* Protect state etc */
  
  static const unsigned char days_in_month[] =
@@@ -60,6 -60,7 +60,7 @@@ static int voltage_low
  static const struct file_operations pcf8563_fops = {
        .owner          = THIS_MODULE,
        .unlocked_ioctl = pcf8563_unlocked_ioctl,
+       .llseek         = noop_llseek,
  };
  
  unsigned char
@@@ -339,9 -340,9 +340,9 @@@ static long pcf8563_unlocked_ioctl(stru
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&pcf8563_mutex);
        return pcf8563_ioctl(filp, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&pcf8563_mutex);
  
        return ret;
  }
index a01ae9f3b814575c9e226a1958c9eb7308436d35,a2e8a8c39856edc1b56d58915893780d69a1fd2c..c8637a9195eadb5bb0d8d0f9e3b658923767fbdc
@@@ -13,7 -13,7 +13,7 @@@
  #include <linux/errno.h>
  #include <linux/major.h>
  #include <linux/sched.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/interrupt.h>
  #include <linux/poll.h>
  #include <linux/init.h>
@@@ -145,7 -145,6 +145,7 @@@ typedef struct sync_por
        spinlock_t lock;
  } sync_port;
  
 +static DEFINE_MUTEX(sync_serial_mutex);
  static int etrax_sync_serial_init(void);
  static void initialize_port(int portnbr);
  static inline int sync_data_avail(struct sync_port *port);
@@@ -248,7 -247,8 +248,8 @@@ static const struct file_operations syn
        .poll           = sync_serial_poll,
        .unlocked_ioctl = sync_serial_ioctl,
        .open           = sync_serial_open,
-       .release        = sync_serial_release
+       .release        = sync_serial_release,
+       .llseek         = noop_llseek,
  };
  
  static int __init etrax_sync_serial_init(void)
@@@ -435,7 -435,7 +436,7 @@@ static int sync_serial_open(struct inod
        reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
        reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
  
 -      lock_kernel();
 +      mutex_lock(&sync_serial_mutex);
        DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
  
        if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled)
        port->busy++;
        ret = 0;
  out:
 -      unlock_kernel();
 +      mutex_unlock(&sync_serial_mutex);
        return ret;
  }
  
@@@ -967,9 -967,9 +968,9 @@@ static long sync_serial_ioctl(struct fi
  {
         long ret;
  
 -       lock_kernel();
 +       mutex_lock(&sync_serial_mutex);
         ret = sync_serial_ioctl_unlocked(file, cmd, arg);
 -       unlock_kernel();
 +       mutex_unlock(&sync_serial_mutex);
  
         return ret;
  }
index 45d7543b69cc5a3d7bf1819bb6992fbb227ae960,6f22c40416304f34bbf0d6b2e6f6f60430ec578a..79802e540e538d52defaea3f3a4cea903d9b0cce
@@@ -354,6 -354,7 +354,7 @@@ retry
  static const struct file_operations salinfo_event_fops = {
        .open  = salinfo_event_open,
        .read  = salinfo_event_read,
+       .llseek = noop_llseek,
  };
  
  static int
@@@ -571,6 -572,7 +572,7 @@@ static const struct file_operations sal
        .release = salinfo_log_release,
        .read    = salinfo_log_read,
        .write   = salinfo_log_write,
+       .llseek  = default_llseek,
  };
  
  static int __cpuinit
@@@ -642,7 -644,7 +644,7 @@@ salinfo_init(void
        for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
                data = salinfo_data + i;
                data->type = i;
 -              init_MUTEX(&data->mutex);
 +              sema_init(&data->mutex, 1);
                dir = proc_mkdir(salinfo_log_name[i], salinfo_dir);
                if (!dir)
                        continue;
index 8d9e3b9cda645e0cf072cc12a7bd557da633aa67,b1dd962e247e7ff1ca25021e9fd3373c13a43832..16468362ad579c5581d59f10feb8595336291eab
@@@ -56,7 -56,7 +56,7 @@@ static unsigned long get_purr(void
  
        for_each_possible_cpu(cpu) {
                if (firmware_has_feature(FW_FEATURE_ISERIES))
 -                      sum_purr += lppaca[cpu].emulated_time_base;
 +                      sum_purr += lppaca_of(cpu).emulated_time_base;
                else {
                        struct cpu_usage *cu;
  
@@@ -263,7 -263,7 +263,7 @@@ static void parse_ppp_data(struct seq_f
                   ppp_data.active_system_procs);
  
        /* pool related entries are apropriate for shared configs */
 -      if (lppaca[0].shared_proc) {
 +      if (lppaca_of(0).shared_proc) {
                unsigned long pool_idle_time, pool_procs;
  
                seq_printf(m, "pool=%d\n", ppp_data.pool_num);
@@@ -460,8 -460,8 +460,8 @@@ static void pseries_cmo_data(struct seq
                return;
  
        for_each_possible_cpu(cpu) {
 -              cmo_faults += lppaca[cpu].cmo_faults;
 -              cmo_fault_time += lppaca[cpu].cmo_fault_time;
 +              cmo_faults += lppaca_of(cpu).cmo_faults;
 +              cmo_fault_time += lppaca_of(cpu).cmo_fault_time;
        }
  
        seq_printf(m, "cmo_faults=%lu\n", cmo_faults);
@@@ -479,8 -479,8 +479,8 @@@ static void splpar_dispatch_data(struc
        unsigned long dispatch_dispersions = 0;
  
        for_each_possible_cpu(cpu) {
 -              dispatches += lppaca[cpu].yield_count;
 -              dispatch_dispersions += lppaca[cpu].dispersion_count;
 +              dispatches += lppaca_of(cpu).yield_count;
 +              dispatch_dispersions += lppaca_of(cpu).dispersion_count;
        }
  
        seq_printf(m, "dispatches=%lu\n", dispatches);
@@@ -545,7 -545,7 +545,7 @@@ static int pseries_lparcfg_data(struct 
        seq_printf(m, "partition_potential_processors=%d\n",
                   partition_potential_processors);
  
 -      seq_printf(m, "shared_processor_mode=%d\n", lppaca[0].shared_proc);
 +      seq_printf(m, "shared_processor_mode=%d\n", lppaca_of(0).shared_proc);
  
        seq_printf(m, "slb_size=%d\n", mmu_slb_size);
  
@@@ -780,6 -780,7 +780,7 @@@ static const struct file_operations lpa
        .write          = lparcfg_write,
        .open           = lparcfg_open,
        .release        = single_release,
+       .llseek         = seq_lseek,
  };
  
  static int __init lparcfg_init(void)
index 86036276020f82e586143d55f59ad0bee653c874,dd1e6f871fe43f03f5828a188d71c3ec5a73b3d5..2d0266d0254d5eef5477a7da2d5e9ea36378ca46
@@@ -42,7 -42,7 +42,7 @@@
  #include <linux/miscdevice.h>
  #include <linux/watchdog.h>
  #include <linux/reboot.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/init.h>
  #include <linux/spinlock.h>
  #include <asm/uaccess.h>
@@@ -50,7 -50,6 +50,7 @@@
  
  MODULE_LICENSE("GPL");
  
 +static DEFINE_MUTEX(harddog_mutex);
  static DEFINE_SPINLOCK(lock);
  static int timer_alive;
  static int harddog_in_fd = -1;
@@@ -67,7 -66,7 +67,7 @@@ static int harddog_open(struct inode *i
        int err = -EBUSY;
        char *sock = NULL;
  
 -      lock_kernel();
 +      mutex_lock(&harddog_mutex);
        spin_lock(&lock);
        if(timer_alive)
                goto err;
  
        timer_alive = 1;
        spin_unlock(&lock);
 -      unlock_kernel();
 +      mutex_unlock(&harddog_mutex);
        return nonseekable_open(inode, file);
  err:
        spin_unlock(&lock);
 -      unlock_kernel();
 +      mutex_unlock(&harddog_mutex);
        return err;
  }
  
@@@ -154,9 -153,9 +154,9 @@@ static long harddog_ioctl(struct file *
  {
        long ret;
  
 -      lock_kernel();
 +      mutex_lock(&harddog_mutex);
        ret = harddog_ioctl_unlocked(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&harddog_mutex);
  
        return ret;
  }
@@@ -167,6 -166,7 +167,7 @@@ static const struct file_operations har
        .unlocked_ioctl = harddog_ioctl,
        .open           = harddog_open,
        .release        = harddog_release,
+       .llseek         = no_llseek,
  };
  
  static struct miscdevice harddog_miscdev = {
diff --combined block/bsg.c
index d3afe702ede7ccdaaa6f19c339c6ad48d9aefcd1,83e381a26b585fa643f0b939fdba08fa0bcfdb3d..f20d6a789d484591e9fdb5642fa893c233c2b9b0
@@@ -20,6 -20,7 +20,6 @@@
  #include <linux/uio.h>
  #include <linux/idr.h>
  #include <linux/bsg.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  
  #include <scsi/scsi.h>
@@@ -425,7 -426,7 +425,7 @@@ static int blk_complete_sgv4_hdr_rq(str
        /*
         * fill in all the output members
         */
 -      hdr->device_status = status_byte(rq->errors);
 +      hdr->device_status = rq->errors & 0xff;
        hdr->transport_status = host_byte(rq->errors);
        hdr->driver_status = driver_byte(rq->errors);
        hdr->info = 0;
@@@ -842,7 -843,9 +842,7 @@@ static int bsg_open(struct inode *inode
  {
        struct bsg_device *bd;
  
 -      lock_kernel();
        bd = bsg_get_device(inode, file);
 -      unlock_kernel();
  
        if (IS_ERR(bd))
                return PTR_ERR(bd);
@@@ -965,6 -968,7 +965,7 @@@ static const struct file_operations bsg
        .release        =       bsg_release,
        .unlocked_ioctl =       bsg_ioctl,
        .owner          =       THIS_MODULE,
+       .llseek         =       default_llseek,
  };
  
  void bsg_unregister_queue(struct request_queue *q)
index da1228a9a544f026bab6c549e65892d439367266,cbab9b07bf28f7c5e19611bf6a25354fb812a5e0..de73caf3cebc8955e1502de7eac4eee0218c3fe6
@@@ -2,7 -2,7 +2,7 @@@
   * APEI Error Record Serialization Table debug support
   *
   * ERST is a way provided by APEI to save and retrieve hardware error
 - * infomation to and from a persistent store. This file provide the
 + * information to and from a persistent store. This file provide the
   * debugging/testing support for ERST kernel support and firmware
   * implementation.
   *
@@@ -111,13 -111,11 +111,13 @@@ retry
                goto out;
        }
        if (len > erst_dbg_buf_len) {
 -              kfree(erst_dbg_buf);
 +              void *p;
                rc = -ENOMEM;
 -              erst_dbg_buf = kmalloc(len, GFP_KERNEL);
 -              if (!erst_dbg_buf)
 +              p = kmalloc(len, GFP_KERNEL);
 +              if (!p)
                        goto out;
 +              kfree(erst_dbg_buf);
 +              erst_dbg_buf = p;
                erst_dbg_buf_len = len;
                goto retry;
        }
@@@ -152,13 -150,11 +152,13 @@@ static ssize_t erst_dbg_write(struct fi
        if (mutex_lock_interruptible(&erst_dbg_mutex))
                return -EINTR;
        if (usize > erst_dbg_buf_len) {
 -              kfree(erst_dbg_buf);
 +              void *p;
                rc = -ENOMEM;
 -              erst_dbg_buf = kmalloc(usize, GFP_KERNEL);
 -              if (!erst_dbg_buf)
 +              p = kmalloc(usize, GFP_KERNEL);
 +              if (!p)
                        goto out;
 +              kfree(erst_dbg_buf);
 +              erst_dbg_buf = p;
                erst_dbg_buf_len = usize;
        }
        rc = copy_from_user(erst_dbg_buf, ubuf, usize);
@@@ -184,6 -180,7 +184,7 @@@ static const struct file_operations ers
        .read           = erst_dbg_read,
        .write          = erst_dbg_write,
        .unlocked_ioctl = erst_dbg_ioctl,
+       .llseek         = no_llseek,
  };
  
  static struct miscdevice erst_dbg_dev = {
diff --combined drivers/block/DAC960.c
index da0f6ddd7621d4d1e0ae63f80a05ced1d06174a9,dfcb33e8d40542dd9d1c3e5439e546b1cf08731a..1f286ab461d3d62471dbaa5323cd468b1080a842
@@@ -36,7 -36,7 +36,7 @@@
  #include <linux/ioport.h>
  #include <linux/mm.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include <linux/reboot.h>
@@@ -54,7 -54,6 +54,7 @@@
  #define DAC960_GAM_MINOR      252
  
  
 +static DEFINE_MUTEX(DAC960_mutex);
  static DAC960_Controller_T *DAC960_Controllers[DAC960_MaxControllers];
  static int DAC960_ControllerCount;
  static struct proc_dir_entry *DAC960_ProcDirectoryEntry;
@@@ -82,7 -81,7 +82,7 @@@ static int DAC960_open(struct block_dev
        int drive_nr = (long)disk->private_data;
        int ret = -ENXIO;
  
 -      lock_kernel();
 +      mutex_lock(&DAC960_mutex);
        if (p->FirmwareType == DAC960_V1_Controller) {
                if (p->V1.LogicalDriveInformation[drive_nr].
                    LogicalDriveState == DAC960_V1_LogicalDrive_Offline)
                goto out;
        ret = 0;
  out:
 -      unlock_kernel();
 +      mutex_unlock(&DAC960_mutex);
        return ret;
  }
  
@@@ -6626,7 -6625,7 +6626,7 @@@ static long DAC960_gam_ioctl(struct fil
    long ErrorCode = 0;
    if (!capable(CAP_SYS_ADMIN)) return -EACCES;
  
 -  lock_kernel();
 +  mutex_lock(&DAC960_mutex);
    switch (Request)
      {
      case DAC960_IOCTL_GET_CONTROLLER_COUNT:
        default:
        ErrorCode = -ENOTTY;
      }
 -  unlock_kernel();
 +  mutex_unlock(&DAC960_mutex);
    return ErrorCode;
  }
  
  static const struct file_operations DAC960_gam_fops = {
        .owner          = THIS_MODULE,
-       .unlocked_ioctl = DAC960_gam_ioctl
+       .unlocked_ioctl = DAC960_gam_ioctl,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice DAC960_gam_dev = {
index 05d5ef172ca59c4c882f0dd43512c18b895df72a,32b484ba21bd440006ae6112932ea92c248c6a33..146296ca4965a8e44123928d2406820b949a1488
@@@ -9,7 -9,7 +9,7 @@@
  #include <linux/completion.h>
  #include <linux/delay.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/skbuff.h>
  #include "aoe.h"
  
@@@ -37,7 -37,6 +37,7 @@@ struct ErrMsg 
        char *msg;
  };
  
 +static DEFINE_MUTEX(aoechr_mutex);
  static struct ErrMsg emsgs[NMSG];
  static int emsgs_head_idx, emsgs_tail_idx;
  static struct completion emsgs_comp;
@@@ -184,16 -183,16 +184,16 @@@ aoechr_open(struct inode *inode, struc
  {
        int n, i;
  
 -      lock_kernel();
 +      mutex_lock(&aoechr_mutex);
        n = iminor(inode);
        filp->private_data = (void *) (unsigned long) n;
  
        for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
                if (chardevs[i].minor == n) {
 -                      unlock_kernel();
 +                      mutex_unlock(&aoechr_mutex);
                        return 0;
                }
 -      unlock_kernel();
 +      mutex_unlock(&aoechr_mutex);
        return -EINVAL;
  }
  
@@@ -266,6 -265,7 +266,7 @@@ static const struct file_operations aoe
        .open = aoechr_open,
        .release = aoechr_rel,
        .owner = THIS_MODULE,
+       .llseek = noop_llseek,
  };
  
  static char *aoe_devnode(struct device *dev, mode_t *mode)
index bed29cb9e6d97f71a56921b25f09127592eb3634,aa27cd84f633218e34ff03df6682bc1c7ecafbb1..6b9a2000d56affdd7788ff26581ae587f3937f96
@@@ -162,7 -162,7 +162,7 @@@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV
  #include <linux/pg.h>
  #include <linux/device.h>
  #include <linux/sched.h>      /* current, TASK_* */
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/jiffies.h>
  
  #include <asm/uaccess.h>
@@@ -193,7 -193,6 +193,7 @@@ module_param_array(drive3, int, NULL, 0
  
  #define ATAPI_IDENTIFY                0x12
  
 +static DEFINE_MUTEX(pg_mutex);
  static int pg_open(struct inode *inode, struct file *file);
  static int pg_release(struct inode *inode, struct file *file);
  static ssize_t pg_read(struct file *filp, char __user *buf,
@@@ -235,6 -234,7 +235,7 @@@ static const struct file_operations pg_
        .write = pg_write,
        .open = pg_open,
        .release = pg_release,
+       .llseek = noop_llseek,
  };
  
  static void pg_init_units(void)
@@@ -519,7 -519,7 +520,7 @@@ static int pg_open(struct inode *inode
        struct pg *dev = &devices[unit];
        int ret = 0;
  
 -      lock_kernel();
 +      mutex_lock(&pg_mutex);
        if ((unit >= PG_UNITS) || (!dev->present)) {
                ret = -ENODEV;
                goto out;
        file->private_data = dev;
  
  out:
 -      unlock_kernel();
 +      mutex_unlock(&pg_mutex);
        return ret;
  }
  
index e4dda282e0a62a64ef6e15508e5da91417f6840d,c372c32e0db30c334bb67446e9165e66768a23a6..7179f79d746838f24640ac7c59fadb41a1c5f024
@@@ -146,7 -146,7 +146,7 @@@ static int (*drives[4])[6] = {&drive0, 
  #include <linux/mtio.h>
  #include <linux/device.h>
  #include <linux/sched.h>      /* current, TASK_*, schedule_timeout() */
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include <asm/uaccess.h>
  
@@@ -189,7 -189,6 +189,7 @@@ module_param_array(drive3, int, NULL, 0
  #define ATAPI_MODE_SENSE      0x1a
  #define ATAPI_LOG_SENSE               0x4d
  
 +static DEFINE_MUTEX(pt_mutex);
  static int pt_open(struct inode *inode, struct file *file);
  static long pt_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
  static int pt_release(struct inode *inode, struct file *file);
@@@ -240,6 -239,7 +240,7 @@@ static const struct file_operations pt_
        .unlocked_ioctl = pt_ioctl,
        .open = pt_open,
        .release = pt_release,
+       .llseek = noop_llseek,
  };
  
  /* sysfs class support */
@@@ -651,9 -651,9 +652,9 @@@ static int pt_open(struct inode *inode
        struct pt_unit *tape = pt + unit;
        int err;
  
 -      lock_kernel();
 +      mutex_lock(&pt_mutex);
        if (unit >= PT_UNITS || (!tape->present)) {
 -              unlock_kernel();
 +              mutex_unlock(&pt_mutex);
                return -ENODEV;
        }
  
        }
  
        file->private_data = tape;
 -      unlock_kernel();
 +      mutex_unlock(&pt_mutex);
        return 0;
  
  out:
        atomic_inc(&tape->available);
 -      unlock_kernel();
 +      mutex_unlock(&pt_mutex);
        return err;
  }
  
@@@ -705,15 -705,15 +706,15 @@@ static long pt_ioctl(struct file *file
                switch (mtop.mt_op) {
  
                case MTREW:
 -                      lock_kernel();
 +                      mutex_lock(&pt_mutex);
                        pt_rewind(tape);
 -                      unlock_kernel();
 +                      mutex_unlock(&pt_mutex);
                        return 0;
  
                case MTWEOF:
 -                      lock_kernel();
 +                      mutex_lock(&pt_mutex);
                        pt_write_fm(tape);
 -                      unlock_kernel();
 +                      mutex_unlock(&pt_mutex);
                        return 0;
  
                default:
diff --combined drivers/block/pktcdvd.c
index 044b84e6f147934e20fea84249ed1a18d1d8bfb9,6a4642dd8283508b8cdcf7afa80e30c5c66117a7..ef58fccadad3ada40ad07f6891b2cd3de0234c17
@@@ -57,6 -57,7 +57,6 @@@
  #include <linux/seq_file.h>
  #include <linux/miscdevice.h>
  #include <linux/freezer.h>
 -#include <linux/smp_lock.h>
  #include <linux/mutex.h>
  #include <linux/slab.h>
  #include <scsi/scsi_cmnd.h>
@@@ -85,7 -86,6 +85,7 @@@
  
  #define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1))
  
 +static DEFINE_MUTEX(pktcdvd_mutex);
  static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
  static struct proc_dir_entry *pkt_proc;
  static int pktdev_major;
@@@ -2369,7 -2369,7 +2369,7 @@@ static void pkt_release_dev(struct pktc
        pkt_shrink_pktlist(pd);
  }
  
 -static struct pktcdvd_device *pkt_find_dev_from_minor(int dev_minor)
 +static struct pktcdvd_device *pkt_find_dev_from_minor(unsigned int dev_minor)
  {
        if (dev_minor >= MAX_WRITERS)
                return NULL;
@@@ -2383,7 -2383,7 +2383,7 @@@ static int pkt_open(struct block_devic
  
        VPRINTK(DRIVER_NAME": entering open\n");
  
 -      lock_kernel();
 +      mutex_lock(&pktcdvd_mutex);
        mutex_lock(&ctl_mutex);
        pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev));
        if (!pd) {
        }
  
        mutex_unlock(&ctl_mutex);
 -      unlock_kernel();
 +      mutex_unlock(&pktcdvd_mutex);
        return 0;
  
  out_dec:
  out:
        VPRINTK(DRIVER_NAME": failed open (%d)\n", ret);
        mutex_unlock(&ctl_mutex);
 -      unlock_kernel();
 +      mutex_unlock(&pktcdvd_mutex);
        return ret;
  }
  
@@@ -2428,7 -2428,7 +2428,7 @@@ static int pkt_close(struct gendisk *di
        struct pktcdvd_device *pd = disk->private_data;
        int ret = 0;
  
 -      lock_kernel();
 +      mutex_lock(&pktcdvd_mutex);
        mutex_lock(&ctl_mutex);
        pd->refcnt--;
        BUG_ON(pd->refcnt < 0);
                pkt_release_dev(pd, flush);
        }
        mutex_unlock(&ctl_mutex);
 -      unlock_kernel();
 +      mutex_unlock(&pktcdvd_mutex);
        return ret;
  }
  
@@@ -2773,7 -2773,7 +2773,7 @@@ static int pkt_ioctl(struct block_devic
        VPRINTK("pkt_ioctl: cmd %x, dev %d:%d\n", cmd,
                MAJOR(bdev->bd_dev), MINOR(bdev->bd_dev));
  
 -      lock_kernel();
 +      mutex_lock(&pktcdvd_mutex);
        switch (cmd) {
        case CDROMEJECT:
                /*
                VPRINTK(DRIVER_NAME": Unknown ioctl for %s (%x)\n", pd->name, cmd);
                ret = -ENOTTY;
        }
 -      unlock_kernel();
 +      mutex_unlock(&pktcdvd_mutex);
  
        return ret;
  }
@@@ -3046,6 -3046,7 +3046,7 @@@ static const struct file_operations pkt
        .compat_ioctl   = pkt_ctl_compat_ioctl,
  #endif
        .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
  };
  
  static struct miscdevice pkt_misc = {
index 6a420baea2680ee9ef2c611f3ad1c56c1660a7a5,5ffa6904ea6bae832f330dfdc3f32caac3b9a453..3022801669b148b35bc9174c19a7bbf559ec7cd6
@@@ -13,7 -13,7 +13,7 @@@
  #include <linux/module.h>
  #include <linux/poll.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  #include <linux/miscdevice.h>
@@@ -126,7 -126,6 +126,7 @@@ struct apm_user 
  /*
   * Local variables
   */
 +static DEFINE_MUTEX(apm_mutex);
  static atomic_t suspend_acks_pending = ATOMIC_INIT(0);
  static atomic_t userspace_notification_inhibit = ATOMIC_INIT(0);
  static int apm_disabled;
@@@ -275,7 -274,7 +275,7 @@@ apm_ioctl(struct file *filp, u_int cmd
        if (!as->suser || !as->writer)
                return -EPERM;
  
 -      lock_kernel();
 +      mutex_lock(&apm_mutex);
        switch (cmd) {
        case APM_IOC_SUSPEND:
                mutex_lock(&state_lock);
                mutex_unlock(&state_lock);
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&apm_mutex);
  
        return err;
  }
@@@ -371,7 -370,7 +371,7 @@@ static int apm_open(struct inode * inod
  {
        struct apm_user *as;
  
 -      lock_kernel();
 +      mutex_lock(&apm_mutex);
        as = kzalloc(sizeof(*as), GFP_KERNEL);
        if (as) {
                /*
  
                filp->private_data = as;
        }
 -      unlock_kernel();
 +      mutex_unlock(&apm_mutex);
  
        return as ? 0 : -ENOMEM;
  }
@@@ -403,6 -402,7 +403,7 @@@ static const struct file_operations apm
        .unlocked_ioctl = apm_ioctl,
        .open           = apm_open,
        .release        = apm_release,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice apm_device = {
diff --combined drivers/char/ds1302.c
index e3d72aa3cbd2fa1f322c62f4fc0da7e233b33b60,4f7aa364167ccccfccb1736289636bf82d572783..ed8303f9890c346ef136d54ec2b999cce3ee5e5d
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/miscdevice.h>
  #include <linux/delay.h>
  #include <linux/bcd.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/uaccess.h>
  #include <linux/io.h>
  
@@@ -32,7 -32,6 +32,7 @@@
  
  #define RTC_MAJOR_NR 121 /* local major, change later */
  
 +static DEFINE_MUTEX(rtc_mutex);
  static const char ds1302_name[] = "ds1302";
  
  /* Send 8 bits. */
@@@ -165,9 -164,9 +165,9 @@@ static long rtc_ioctl(struct file *file
                        struct rtc_time rtc_tm;
  
                        memset(&rtc_tm, 0, sizeof (struct rtc_time));
 -                      lock_kernel();
 +                      mutex_lock(&rtc_mutex);
                        get_rtc_time(&rtc_tm);
 -                      unlock_kernel();
 +                      mutex_unlock(&rtc_mutex);
                        if (copy_to_user((struct rtc_time*)arg, &rtc_tm, sizeof(struct rtc_time)))
                                return -EFAULT;
                        return 0;
                        mon = bin2bcd(mon);
                        yrs = bin2bcd(yrs);
  
 -                      lock_kernel();
 +                      mutex_lock(&rtc_mutex);
                        local_irq_save(flags);
                        CMOS_WRITE(yrs, RTC_YEAR);
                        CMOS_WRITE(mon, RTC_MONTH);
                        CMOS_WRITE(min, RTC_MINUTES);
                        CMOS_WRITE(sec, RTC_SECONDS);
                        local_irq_restore(flags);
 -                      unlock_kernel();
 +                      mutex_unlock(&rtc_mutex);
  
                        /* Notice that at this point, the RTC is updated but
                         * the kernel is still running with the old time.
                        if(copy_from_user(&tcs_val, (int*)arg, sizeof(int)))
                                return -EFAULT;
  
 -                      lock_kernel();
 +                      mutex_lock(&rtc_mutex);
                        tcs_val = RTC_TCR_PATTERN | (tcs_val & 0x0F);
                        ds1302_writereg(RTC_TRICKLECHARGER, tcs_val);
 -                      unlock_kernel();
 +                      mutex_unlock(&rtc_mutex);
                        return 0;
                }
                default:
@@@ -289,6 -288,7 +289,7 @@@ get_rtc_status(char *buf
  static const struct file_operations rtc_fops = {
        .owner          = THIS_MODULE,
        .unlocked_ioctl = rtc_ioctl,
+       .llseek         = noop_llseek,
  };
  
  /* Probe for the chip by writing something to its RAM and try reading it back. */
diff --combined drivers/char/ds1620.c
index 9aa1fd059aea47115113a7cc599350211f52db1c,50462b63e51bb8853cc59951349dcee93b5d8a84..aab9605f0b43291974c67855caf920c5656c8b0d
@@@ -8,7 -8,7 +8,7 @@@
  #include <linux/proc_fs.h>
  #include <linux/capability.h>
  #include <linux/init.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include <mach/hardware.h>
  #include <asm/mach-types.h>
@@@ -34,7 -34,6 +34,7 @@@
  #define CFG_CPU                       2
  #define CFG_1SHOT             1
  
 +static DEFINE_MUTEX(ds1620_mutex);
  static const char *fan_state[] = { "off", "on", "on (hardwired)" };
  
  /*
@@@ -211,6 -210,7 +211,6 @@@ static void ds1620_read_state(struct th
  
  static int ds1620_open(struct inode *inode, struct file *file)
  {
 -      cycle_kernel_lock();
        return nonseekable_open(inode, file);
  }
  
@@@ -321,9 -321,9 +321,9 @@@ ds1620_unlocked_ioctl(struct file *file
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&ds1620_mutex);
        ret = ds1620_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ds1620_mutex);
  
        return ret;
  }
@@@ -357,6 -357,7 +357,7 @@@ static const struct file_operations ds1
        .open           = ds1620_open,
        .read           = ds1620_read,
        .unlocked_ioctl = ds1620_unlocked_ioctl,
+       .llseek         = no_llseek,
  };
  
  static struct miscdevice ds1620_miscdev = {
diff --combined drivers/char/dsp56k.c
index b3c756227e39d5c90ffe3e76da86cf579f43a4fb,353be4707d9252f70e2059fdb5e9389bede34e2e..052797b32bd3ff484dca016c1b48a66d99cef6f8
@@@ -32,7 -32,7 +32,7 @@@
  #include <linux/mm.h>
  #include <linux/init.h>
  #include <linux/device.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/firmware.h>
  #include <linux/platform_device.h>
  #include <linux/uaccess.h>    /* For put_user and get_user */
@@@ -94,7 -94,6 +94,7 @@@
        } \
  }
  
 +static DEFINE_MUTEX(dsp56k_mutex);
  static struct dsp56k_device {
        unsigned long in_use;
        long maxio, timeout;
@@@ -331,9 -330,9 +331,9 @@@ static long dsp56k_ioctl(struct file *f
                        if (len > DSP56K_MAX_BINARY_LENGTH) {
                                return -EINVAL;
                        }
 -                      lock_kernel();
 +                      mutex_lock(&dsp56k_mutex);
                        r = dsp56k_upload(bin, len);
 -                      unlock_kernel();
 +                      mutex_unlock(&dsp56k_mutex);
                        if (r < 0) {
                                return r;
                        }
                case DSP56K_SET_TX_WSIZE:
                        if (arg > 4 || arg < 1)
                                return -EINVAL;
 -                      lock_kernel();
 +                      mutex_lock(&dsp56k_mutex);
                        dsp56k.tx_wsize = (int) arg;
 -                      unlock_kernel();
 +                      mutex_unlock(&dsp56k_mutex);
                        break;
                case DSP56K_SET_RX_WSIZE:
                        if (arg > 4 || arg < 1)
                                return -EINVAL;
 -                      lock_kernel();
 +                      mutex_lock(&dsp56k_mutex);
                        dsp56k.rx_wsize = (int) arg;
 -                      unlock_kernel();
 +                      mutex_unlock(&dsp56k_mutex);
                        break;
                case DSP56K_HOST_FLAGS:
                {
                        if(get_user(out, &hf->out) < 0)
                                return -EFAULT;
  
 -                      lock_kernel();
 +                      mutex_lock(&dsp56k_mutex);
                        if ((dir & 0x1) && (out & 0x1))
                                dsp56k_host_interface.icr |= DSP56K_ICR_HF0;
                        else if (dir & 0x1)
                        if (dsp56k_host_interface.icr & DSP56K_ICR_HF1) status |= 0x2;
                        if (dsp56k_host_interface.isr & DSP56K_ISR_HF2) status |= 0x4;
                        if (dsp56k_host_interface.isr & DSP56K_ISR_HF3) status |= 0x8;
 -                      unlock_kernel();
 +                      mutex_unlock(&dsp56k_mutex);
                        return put_user(status, &hf->status);
                }
                case DSP56K_HOST_CMD:
                        if (arg > 31 || arg < 0)
                                return -EINVAL;
 -                      lock_kernel();
 +                      mutex_lock(&dsp56k_mutex);
                        dsp56k_host_interface.cvr = (u_char)((arg & DSP56K_CVR_HV_MASK) |
                                                             DSP56K_CVR_HC);
 -                      unlock_kernel();
 +                      mutex_unlock(&dsp56k_mutex);
                        break;
                default:
                        return -EINVAL;
@@@ -428,7 -427,7 +428,7 @@@ static int dsp56k_open(struct inode *in
        int dev = iminor(inode) & 0x0f;
        int ret = 0;
  
 -      lock_kernel();
 +      mutex_lock(&dsp56k_mutex);
        switch(dev)
        {
        case DSP56K_DEV_56001:
                ret = -ENODEV;
        }
  out:
 -      unlock_kernel();
 +      mutex_unlock(&dsp56k_mutex);
        return ret;
  }
  
@@@ -483,6 -482,7 +483,7 @@@ static const struct file_operations dsp
        .unlocked_ioctl = dsp56k_ioctl,
        .open           = dsp56k_open,
        .release        = dsp56k_release,
+       .llseek         = noop_llseek,
  };
  
  
diff --combined drivers/char/dtlk.c
index 8dd040a945d444ded631729d367e2d59f8e4014d,007eca3ed77cb5e499faf674c20cbf87216da275..85156dd0caee0baebf051299a84db12476dbf322
@@@ -57,7 -57,7 +57,7 @@@
  #include <linux/ioport.h>     /* for request_region */
  #include <linux/delay.h>      /* for loops_per_jiffy */
  #include <linux/sched.h>
 -#include <linux/smp_lock.h>   /* cycle_kernel_lock() */
 +#include <linux/mutex.h>
  #include <asm/io.h>           /* for inb_p, outb_p, inb, outb, etc. */
  #include <asm/uaccess.h>      /* for get_user, etc. */
  #include <linux/wait.h>               /* for wait_queue */
@@@ -73,7 -73,6 +73,7 @@@
  #define TRACE_RET ((void) 0)
  #endif                                /* TRACING */
  
 +static DEFINE_MUTEX(dtlk_mutex);
  static void dtlk_timer_tick(unsigned long data);
  
  static int dtlk_major;
@@@ -106,6 -105,7 +106,7 @@@ static const struct file_operations dtl
        .unlocked_ioctl = dtlk_ioctl,
        .open           = dtlk_open,
        .release        = dtlk_release,
+       .llseek         = no_llseek,
  };
  
  /* local prototypes */
@@@ -276,9 -276,9 +277,9 @@@ static long dtlk_ioctl(struct file *fil
        switch (cmd) {
  
        case DTLK_INTERROGATE:
 -              lock_kernel();
 +              mutex_lock(&dtlk_mutex);
                sp = dtlk_interrogate();
 -              unlock_kernel();
 +              mutex_unlock(&dtlk_mutex);
                if (copy_to_user(argp, sp, sizeof(struct dtlk_settings)))
                        return -EINVAL;
                return 0;
@@@ -297,6 -297,7 +298,6 @@@ static int dtlk_open(struct inode *inod
  {
        TRACE_TEXT("(dtlk_open");
  
 -      cycle_kernel_lock();
        nonseekable_open(inode, file);
        switch (iminor(inode)) {
        case DTLK_MINOR:
diff --combined drivers/char/genrtc.c
index 2aa69f97360d01ff894e76ce017b30ec9dcba44e,eaa0e4264e16daa2c8c9519cf3edda7f1482bb11..f773a9dd14f38ea2e1b5b2d3adcfd11f472f9ea3
@@@ -52,7 -52,7 +52,7 @@@
  #include <linux/init.h>
  #include <linux/poll.h>
  #include <linux/proc_fs.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/workqueue.h>
  
  #include <asm/uaccess.h>
@@@ -66,7 -66,6 +66,7 @@@
   *    ioctls.
   */
  
 +static DEFINE_MUTEX(gen_rtc_mutex);
  static DECLARE_WAIT_QUEUE_HEAD(gen_rtc_wait);
  
  /*
@@@ -338,9 -337,9 +338,9 @@@ static long gen_rtc_unlocked_ioctl(stru
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&gen_rtc_mutex);
        ret = gen_rtc_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&gen_rtc_mutex);
  
        return ret;
  }
  
  static int gen_rtc_open(struct inode *inode, struct file *file)
  {
 -      lock_kernel();
 +      mutex_lock(&gen_rtc_mutex);
        if (gen_rtc_status & RTC_IS_OPEN) {
 -              unlock_kernel();
 +              mutex_unlock(&gen_rtc_mutex);
                return -EBUSY;
        }
  
        gen_rtc_status |= RTC_IS_OPEN;
        gen_rtc_irq_data = 0;
        irq_active = 0;
 -      unlock_kernel();
 +      mutex_unlock(&gen_rtc_mutex);
  
        return 0;
  }
@@@ -498,6 -497,7 +498,7 @@@ static const struct file_operations gen
        .unlocked_ioctl = gen_rtc_unlocked_ioctl,
        .open           = gen_rtc_open,
        .release        = gen_rtc_release,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice rtc_gen_dev =
index dfbdf49d1e8047b3d27ab2e80566f0fa5e64ebb7,2e49e515d8e7037b5dd2edbca23db380db58717a..64a439ce2f892fe61a70375bd0c7cfeb8d65bdbc
@@@ -98,7 -98,7 +98,7 @@@
  #include <linux/major.h>
  #include <linux/wait.h>
  #include <linux/device.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/firmware.h>
  #include <linux/platform_device.h>
  
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
  
 +static DEFINE_MUTEX(ip2_mutex);
  static const struct file_operations ip2mem_proc_fops;
  static const struct file_operations ip2_proc_fops;
  
@@@ -237,6 -236,7 +237,7 @@@ static const struct file_operations ip2
        .write          = ip2_ipl_write,
        .unlocked_ioctl = ip2_ipl_ioctl,
        .open           = ip2_ipl_open,
+       .llseek         = noop_llseek,
  }; 
  
  static unsigned long irq_counter;
@@@ -2898,7 -2898,7 +2899,7 @@@ ip2_ipl_ioctl (struct file *pFile, UIN
        printk (KERN_DEBUG "IP2IPL: ioctl cmd %d, arg %ld\n", cmd, arg );
  #endif
  
 -      lock_kernel();
 +      mutex_lock(&ip2_mutex);
  
        switch ( iplminor ) {
        case 0:     // IPL device
                rc = -ENODEV;
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&ip2_mutex);
        return rc;
  }
  
@@@ -2983,6 -2983,7 +2984,6 @@@ ip2_ipl_open( struct inode *pInode, str
  #ifdef IP2DEBUG_IPL
        printk (KERN_DEBUG "IP2IPL: open\n" );
  #endif
 -      cycle_kernel_lock();
        return 0;
  }
  
index 44833de4772812e965f047e65188f17fb0127d99,c6709d6b0fd07f33a3747589cca71807d2e22300..1fc8876af1f529ef945cbf0df553cfc76490e454
@@@ -44,6 -44,7 +44,6 @@@
  #include <linux/init.h>
  #include <linux/device.h>
  #include <linux/compat.h>
 -#include <linux/smp_lock.h>
  
  struct ipmi_file_private
  {
@@@ -58,7 -59,6 +58,7 @@@
        unsigned int         default_retry_time_ms;
  };
  
 +static DEFINE_MUTEX(ipmi_mutex);
  static void file_receive_handler(struct ipmi_recv_msg *msg,
                                 void                 *handler_data)
  {
@@@ -102,9 -102,9 +102,9 @@@ static int ipmi_fasync(int fd, struct f
        struct ipmi_file_private *priv = file->private_data;
        int                      result;
  
 -      lock_kernel(); /* could race against open() otherwise */
 +      mutex_lock(&ipmi_mutex); /* could race against open() otherwise */
        result = fasync_helper(fd, file, on, &priv->fasync_queue);
 -      unlock_kernel();
 +      mutex_unlock(&ipmi_mutex);
  
        return (result);
  }
@@@ -125,7 -125,7 +125,7 @@@ static int ipmi_open(struct inode *inod
        if (!priv)
                return -ENOMEM;
  
 -      lock_kernel();
 +      mutex_lock(&ipmi_mutex);
        priv->file = file;
  
        rv = ipmi_create_user(if_num,
        priv->default_retry_time_ms = 0;
  
  out:
 -      unlock_kernel();
 +      mutex_unlock(&ipmi_mutex);
        return rv;
  }
  
@@@ -639,9 -639,9 +639,9 @@@ static long ipmi_unlocked_ioctl(struct 
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&ipmi_mutex);
        ret = ipmi_ioctl(file, cmd, data);
 -      unlock_kernel();
 +      mutex_unlock(&ipmi_mutex);
  
        return ret;
  }
@@@ -850,6 -850,7 +850,7 @@@ static const struct file_operations ipm
        .release        = ipmi_release,
        .fasync         = ipmi_fasync,
        .poll           = ipmi_poll,
+       .llseek         = noop_llseek,
  };
  
  #define DEVICE_NAME     "ipmidev"
index ed10b741962daf9139fa853d27f0e45003d697ac,da041f88f64a4b6b85b68bb478dedbb8d53789d3..f4d334f2536ee3f74b0a95e58aa05b590396dc9b
@@@ -35,7 -35,7 +35,7 @@@
  #include <linux/moduleparam.h>
  #include <linux/ipmi.h>
  #include <linux/ipmi_smi.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/watchdog.h>
  #include <linux/miscdevice.h>
  #include <linux/init.h>
  #define       WDIOC_GET_PRETIMEOUT     _IOW(WATCHDOG_IOCTL_BASE, 22, int)
  #endif
  
 +static DEFINE_MUTEX(ipmi_watchdog_mutex);
  static int nowayout = WATCHDOG_NOWAYOUT;
  
  static ipmi_user_t watchdog_user;
@@@ -749,9 -748,9 +749,9 @@@ static long ipmi_unlocked_ioctl(struct 
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&ipmi_watchdog_mutex);
        ret = ipmi_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ipmi_watchdog_mutex);
  
        return ret;
  }
@@@ -845,6 -844,7 +845,6 @@@ static int ipmi_open(struct inode *ino
                if (test_and_set_bit(0, &ipmi_wdog_open))
                        return -EBUSY;
  
 -              cycle_kernel_lock();
  
                /*
                 * Don't start the timer now, let it start on the
@@@ -909,6 -909,7 +909,7 @@@ static const struct file_operations ipm
        .open    = ipmi_open,
        .release = ipmi_close,
        .fasync  = ipmi_fasync,
+       .llseek  = no_llseek,
  };
  
  static struct miscdevice ipmi_wdog_miscdev = {
diff --combined drivers/char/lp.c
index 598d278db0588137138cdebfa533ce508114c2ba,d2344117eaf5d0e454d61a3c542c0b0f2b4dc069..97c3edb95ae747a3ff2832f48e6daf098fad83bf
  #include <linux/device.h>
  #include <linux/wait.h>
  #include <linux/jiffies.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/compat.h>
  
  #include <linux/parport.h>
  /* if you have more than 8 printers, remember to increase LP_NO */
  #define LP_NO 8
  
 +static DEFINE_MUTEX(lp_mutex);
  static struct lp_struct lp_table[LP_NO];
  
  static unsigned int lp_count = 0;
@@@ -494,7 -493,7 +494,7 @@@ static int lp_open(struct inode * inode
        unsigned int minor = iminor(inode);
        int ret = 0;
  
 -      lock_kernel();
 +      mutex_lock(&lp_mutex);
        if (minor >= LP_NO) {
                ret = -ENXIO;
                goto out;
        lp_release_parport (&lp_table[minor]);
        lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
  out:
 -      unlock_kernel();
 +      mutex_unlock(&lp_mutex);
        return ret;
  }
  
@@@ -681,7 -680,7 +681,7 @@@ static long lp_ioctl(struct file *file
        int ret;
  
        minor = iminor(file->f_path.dentry->d_inode);
 -      lock_kernel();
 +      mutex_lock(&lp_mutex);
        switch (cmd) {
        case LPSETTIMEOUT:
                if (copy_from_user(&par_timeout, (void __user *)arg,
                ret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg);
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&lp_mutex);
  
        return ret;
  }
@@@ -710,7 -709,7 +710,7 @@@ static long lp_compat_ioctl(struct fil
        int ret;
  
        minor = iminor(file->f_path.dentry->d_inode);
 -      lock_kernel();
 +      mutex_lock(&lp_mutex);
        switch (cmd) {
        case LPSETTIMEOUT:
                tc = compat_ptr(arg);
                ret = lp_do_ioctl(minor, cmd, arg, compat_ptr(arg));
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&lp_mutex);
  
        return ret;
  }
@@@ -749,6 -748,7 +749,7 @@@ static const struct file_operations lp_
  #ifdef CONFIG_PARPORT_1284
        .read           = lp_read,
  #endif
+       .llseek         = noop_llseek,
  };
  
  /* --- support for console on the line printer ----------------- */
diff --combined drivers/char/mem.c
index 1f528fad3516827754270806a4c6afdee505c9d0,8ebd232132fd8daa0ed0051931f7a73949da3564..e985b1c2730e800db599ad445371a8b100eee506
@@@ -788,11 -788,10 +788,11 @@@ static const struct file_operations zer
  /*
   * capabilities for /dev/zero
   * - permits private mappings, "copies" are taken of the source of zeros
 + * - no writeback happens
   */
  static struct backing_dev_info zero_bdi = {
        .name           = "char/mem",
 -      .capabilities   = BDI_CAP_MAP_COPY,
 +      .capabilities   = BDI_CAP_MAP_COPY | BDI_CAP_NO_ACCT_AND_WRITEBACK,
  };
  
  static const struct file_operations full_fops = {
  static const struct file_operations oldmem_fops = {
        .read   = read_oldmem,
        .open   = open_oldmem,
+       .llseek = default_llseek,
  };
  #endif
  
@@@ -831,6 -831,7 +832,7 @@@ static ssize_t kmsg_write(struct file *
  
  static const struct file_operations kmsg_fops = {
        .write = kmsg_write,
+       .llseek = noop_llseek,
  };
  
  static const struct memdev {
@@@ -882,6 -883,7 +884,7 @@@ static int memory_open(struct inode *in
  
  static const struct file_operations memory_fops = {
        .open = memory_open,
+       .llseek = noop_llseek,
  };
  
  static char *mem_devnode(struct device *dev, mode_t *mode)
diff --combined drivers/char/mmtimer.c
index fe4697844ec10bebe9132fb1c121aa3b2653db5c,1c4070ced066466623817616ee6466dbd6c7f93b..c070b53984e45f77a2805e0428027fbe594622bd
@@@ -32,7 -32,7 +32,7 @@@
  #include <linux/interrupt.h>
  #include <linux/time.h>
  #include <linux/math64.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/slab.h>
  
  #include <asm/uaccess.h>
@@@ -59,7 -59,6 +59,7 @@@ extern unsigned long sn_rtc_cycles_per_
  
  #define rtc_time()              (*RTC_COUNTER_ADDR)
  
 +static DEFINE_MUTEX(mmtimer_mutex);
  static long mmtimer_ioctl(struct file *file, unsigned int cmd,
                                                unsigned long arg);
  static int mmtimer_mmap(struct file *file, struct vm_area_struct *vma);
@@@ -73,6 -72,7 +73,7 @@@ static const struct file_operations mmt
        .owner = THIS_MODULE,
        .mmap = mmtimer_mmap,
        .unlocked_ioctl = mmtimer_ioctl,
+       .llseek = noop_llseek,
  };
  
  /*
@@@ -372,7 -372,7 +373,7 @@@ static long mmtimer_ioctl(struct file *
  {
        int ret = 0;
  
 -      lock_kernel();
 +      mutex_lock(&mmtimer_mutex);
  
        switch (cmd) {
        case MMTIMER_GETOFFSET: /* offset of the counter */
                ret = -ENOTTY;
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&mmtimer_mutex);
        return ret;
  }
  
index e5df26b56d593cabbf5f7fac6a03b0be4ecf8add,0464822eac5373be779e0782ba700a8a85e1ed6c..1d82d5838f0c38c416947d7f95b17d204d0a93b1
@@@ -56,7 -56,7 +56,7 @@@
  #include <linux/serial.h>
  #include <linux/sched.h>
  #include <linux/spinlock.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/delay.h>
  #include <linux/serial_8250.h>
  #include "smapi.h"
@@@ -73,7 -73,6 +73,7 @@@ MODULE_LICENSE("GPL")
  * checks are made against other devices (ie. superio) for conflicts.
  * We'll depend on users using the tpctl utility to do that for now
  */
 +static DEFINE_MUTEX(mwave_mutex);
  int mwave_debug = 0;
  int mwave_3780i_irq = 0;
  int mwave_3780i_io = 0;
@@@ -102,6 -101,7 +102,6 @@@ static int mwave_open(struct inode *ino
        PRINTK_2(TRACE_MWAVE,
                "mwavedd::mwave_open, exit return retval %x\n", retval);
  
 -      cycle_kernel_lock();
        return retval;
  }
  
@@@ -136,9 -136,9 +136,9 @@@ static long mwave_ioctl(struct file *fi
                        PRINTK_1(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl, IOCTL_MW_RESET"
                                " calling tp3780I_ResetDSP\n");
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_ResetDSP(&pDrvData->rBDData);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                        PRINTK_2(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl, IOCTL_MW_RESET"
                                " retval %x from tp3780I_ResetDSP\n",
                        PRINTK_1(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl, IOCTL_MW_RUN"
                                " calling tp3780I_StartDSP\n");
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_StartDSP(&pDrvData->rBDData);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                        PRINTK_2(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl, IOCTL_MW_RUN"
                                " retval %x from tp3780I_StartDSP\n",
                                "mwavedd::mwave_ioctl,"
                                " IOCTL_MW_DSP_ABILITIES calling"
                                " tp3780I_QueryAbilities\n");
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_QueryAbilities(&pDrvData->rBDData,
                                        &rAbilities);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                        PRINTK_2(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl, IOCTL_MW_DSP_ABILITIES"
                                " retval %x from tp3780I_QueryAbilities\n",
                                "mwavedd::mwave_ioctl IOCTL_MW_READ_DATA,"
                                " size %lx, ioarg %lx pusBuffer %p\n",
                                rReadData.ulDataLength, ioarg, pusBuffer);
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
                                        iocmd,
                                        pusBuffer,
                                        rReadData.ulDataLength,
                                        rReadData.usDspAddress);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
                                " size %lx, ioarg %lx pusBuffer %p\n",
                                rReadData.ulDataLength / 2, ioarg,
                                pusBuffer);
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
                                iocmd, pusBuffer,
                                rReadData.ulDataLength / 2,
                                rReadData.usDspAddress);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
                                " size %lx, ioarg %lx pusBuffer %p\n",
                                rWriteData.ulDataLength, ioarg,
                                pusBuffer);
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_ReadWriteDspDStore(&pDrvData->rBDData,
                                        iocmd, pusBuffer,
                                        rWriteData.ulDataLength,
                                        rWriteData.usDspAddress);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
                                " size %lx, ioarg %lx pusBuffer %p\n",
                                rWriteData.ulDataLength, ioarg,
                                pusBuffer);
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        retval = tp3780I_ReadWriteDspIStore(&pDrvData->rBDData,
                                        iocmd, pusBuffer,
                                        rWriteData.ulDataLength,
                                        rWriteData.usDspAddress);
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
                                ipcnum,
                                pDrvData->IPCs[ipcnum].usIntCount);
  
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        pDrvData->IPCs[ipcnum].bIsHere = FALSE;
                        pDrvData->IPCs[ipcnum].bIsEnabled = TRUE;
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
        
                        PRINTK_2(TRACE_MWAVE,
                                "mwavedd::mwave_ioctl IOCTL_MW_REGISTER_IPC"
                                ipcnum,
                                pDrvData->IPCs[ipcnum].usIntCount);
        
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
                                DECLARE_WAITQUEUE(wait, current);
  
                                        " processing\n",
                                        ipcnum);
                        }
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
                                                ipcnum);
                                return -EINVAL;
                        }
 -                      lock_kernel();
 +                      mutex_lock(&mwave_mutex);
                        if (pDrvData->IPCs[ipcnum].bIsEnabled == TRUE) {
                                pDrvData->IPCs[ipcnum].bIsEnabled = FALSE;
                                if (pDrvData->IPCs[ipcnum].bIsHere == TRUE) {
                                        wake_up_interruptible(&pDrvData->IPCs[ipcnum].ipc_wait_queue);
                                }
                        }
 -                      unlock_kernel();
 +                      mutex_unlock(&mwave_mutex);
                }
                        break;
        
@@@ -479,7 -479,8 +479,8 @@@ static const struct file_operations mwa
        .write          = mwave_write,
        .unlocked_ioctl = mwave_ioctl,
        .open           = mwave_open,
-       .release        = mwave_close
+       .release        = mwave_close,
+       .llseek         = default_llseek,
  };
  
  
index c4e52ec85c6e5cf4a3ebfe33ce2cdeece254bffa,c99f6997e5e7bee3945eb97f8e98b5b0d6e322a3..6835c23e9a51a7a2799e4fd46cd92bba20f3ad97
  #include <linux/fs.h>
  #include <linux/delay.h>
  #include <linux/bitrev.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/uaccess.h>
  #include <linux/io.h>
  
 -#include <pcmcia/cs.h>
  #include <pcmcia/cistpl.h>
  #include <pcmcia/cisreg.h>
  #include <pcmcia/ciscode.h>
@@@ -54,7 -55,7 +54,7 @@@
                           __func__ , ## args);         \
        } while (0)
  
 -static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
 +static DEFINE_MUTEX(cmm_mutex);
  
  #define       T_1SEC          (HZ)
  #define       T_10MSEC        msecs_to_jiffies(10)
@@@ -1417,7 -1418,7 +1417,7 @@@ static long cmm_ioctl(struct file *filp
               iminor(inode), ioctl_names[_IOC_NR(cmd)]);
  #endif
  
 -      lock_kernel();
 +      mutex_lock(&cmm_mutex);
        rc = -ENODEV;
        link = dev_table[iminor(inode)];
        if (!pcmcia_dev_present(link)) {
                rc = -ENOTTY;
        }
  out:
 -      unlock_kernel();
 +      mutex_unlock(&cmm_mutex);
        return rc;
  }
  
@@@ -1639,7 -1640,7 +1639,7 @@@ static int cmm_open(struct inode *inode
        if (minor >= CM4000_MAX_DEV)
                return -ENODEV;
  
 -      lock_kernel();
 +      mutex_lock(&cmm_mutex);
        link = dev_table[minor];
        if (link == NULL || !pcmcia_dev_present(link)) {
                ret = -ENODEV;
        DEBUGP(2, dev, "<- cmm_open\n");
        ret = nonseekable_open(inode, filp);
  out:
 -      unlock_kernel();
 +      mutex_unlock(&cmm_mutex);
        return ret;
  }
  
@@@ -1741,8 -1742,20 +1741,8 @@@ static void cmm_cm4000_release(struct p
  
  /*==== Interface to PCMCIA Layer =======================================*/
  
 -static int cm4000_config_check(struct pcmcia_device *p_dev,
 -                             cistpl_cftable_entry_t *cfg,
 -                             cistpl_cftable_entry_t *dflt,
 -                             unsigned int vcc,
 -                             void *priv_data)
 +static int cm4000_config_check(struct pcmcia_device *p_dev, void *priv_data)
  {
 -      if (!cfg->io.nwin)
 -              return -ENODEV;
 -
 -      p_dev->resource[0]->start = cfg->io.win[0].base;
 -      p_dev->resource[0]->end = cfg->io.win[0].len;
 -      p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags);
 -      p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
 -
        return pcmcia_request_io(p_dev);
  }
  
@@@ -1750,13 -1763,13 +1750,13 @@@ static int cm4000_config(struct pcmcia_
  {
        struct cm4000_dev *dev;
  
 +      link->config_flags |= CONF_AUTO_SET_IO;
 +
        /* read the config-tuples */
        if (pcmcia_loop_config(link, cm4000_config_check, NULL))
                goto cs_release;
  
 -      link->conf.IntType = 00000002;
 -
 -      if (pcmcia_request_configuration(link, &link->conf))
 +      if (pcmcia_enable_device(link))
                goto cs_release;
  
        dev = link->priv;
@@@ -1816,6 -1829,7 +1816,6 @@@ static int cm4000_probe(struct pcmcia_d
  
        dev->p_dev = link;
        link->priv = dev;
 -      link->conf.IntType = INT_MEMORY_AND_IO;
        dev_table[i] = link;
  
        init_waitqueue_head(&dev->devq);
@@@ -1866,6 -1880,7 +1866,7 @@@ static const struct file_operations cm4
        .unlocked_ioctl = cmm_ioctl,
        .open   = cmm_open,
        .release= cmm_close,
+       .llseek = no_llseek,
  };
  
  static struct pcmcia_device_id cm4000_ids[] = {
@@@ -1877,7 -1892,9 +1878,7 @@@ MODULE_DEVICE_TABLE(pcmcia, cm4000_ids)
  
  static struct pcmcia_driver cm4000_driver = {
        .owner    = THIS_MODULE,
 -      .drv      = {
 -              .name = "cm4000_cs",
 -              },
 +      .name     = "cm4000_cs",
        .probe    = cm4000_probe,
        .remove   = cm4000_detach,
        .suspend  = cm4000_suspend,
@@@ -1889,6 -1906,8 +1890,6 @@@ static int __init cmm_init(void
  {
        int rc;
  
 -      printk(KERN_INFO "%s\n", version);
 -
        cmm_class = class_create(THIS_MODULE, "cardman_4000");
        if (IS_ERR(cmm_class))
                return PTR_ERR(cmm_class);
  
  static void __exit cmm_exit(void)
  {
 -      printk(KERN_INFO MODULE_NAME ": unloading\n");
        pcmcia_unregister_driver(&cm4000_driver);
        unregister_chrdev(major, DEVICE_NAME);
        class_destroy(cmm_class);
index d7c32cb40ca3b7284a4fb30dd663e23a6429d766,9ecc58baa8f3e63f378fa752fadf637c12eff975..5d8d59e865f4b15cea3194ec8ef23c8f5d07c736
  #include <linux/fs.h>
  #include <linux/delay.h>
  #include <linux/poll.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/wait.h>
  #include <asm/uaccess.h>
  #include <asm/io.h>
  
 -#include <pcmcia/cs.h>
  #include <pcmcia/cistpl.h>
  #include <pcmcia/cisreg.h>
  #include <pcmcia/ciscode.h>
@@@ -48,7 -49,8 +48,7 @@@
                           __func__ , ## args);         \
        } while (0)
  
 -static char *version =
 -"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
 +static DEFINE_MUTEX(cm4040_mutex);
  
  #define       CCID_DRIVER_BULK_DEFAULT_TIMEOUT        (150*HZ)
  #define       CCID_DRIVER_ASYNC_POWERUP_TIMEOUT       (35*HZ)
@@@ -442,7 -444,7 +442,7 @@@ static int cm4040_open(struct inode *in
        if (minor >= CM_MAX_DEV)
                return -ENODEV;
  
 -      lock_kernel();
 +      mutex_lock(&cm4040_mutex);
        link = dev_table[minor];
        if (link == NULL || !pcmcia_dev_present(link)) {
                ret = -ENODEV;
        DEBUGP(2, dev, "<- cm4040_open (successfully)\n");
        ret = nonseekable_open(inode, filp);
  out:
 -      unlock_kernel();
 +      mutex_unlock(&cm4040_mutex);
        return ret;
  }
  
@@@ -514,9 -516,26 +514,9 @@@ static void cm4040_reader_release(struc
        return;
  }
  
 -static int cm4040_config_check(struct pcmcia_device *p_dev,
 -                             cistpl_cftable_entry_t *cfg,
 -                             cistpl_cftable_entry_t *dflt,
 -                             unsigned int vcc,
 -                             void *priv_data)
 +static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data)
  {
 -      int rc;
 -      if (!cfg->io.nwin)
 -              return -ENODEV;
 -
 -      /* Get the IOaddr */
 -      p_dev->resource[0]->start = cfg->io.win[0].base;
 -      p_dev->resource[0]->end = cfg->io.win[0].len;
 -      p_dev->resource[0]->flags |= pcmcia_io_cfg_data_width(cfg->io.flags);
 -      p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK;
 -      rc = pcmcia_request_io(p_dev);
 -
 -      dev_printk(KERN_INFO, &p_dev->dev,
 -                 "pcmcia_request_io returned 0x%x\n", rc);
 -      return rc;
 +      return pcmcia_request_io(p_dev);
  }
  
  
@@@ -525,15 -544,15 +525,15 @@@ static int reader_config(struct pcmcia_
        struct reader_dev *dev;
        int fail_rc;
  
 +      link->config_flags |= CONF_AUTO_SET_IO;
 +
        if (pcmcia_loop_config(link, cm4040_config_check, NULL))
                goto cs_release;
  
 -      link->conf.IntType = 00000002;
 -
 -      fail_rc = pcmcia_request_configuration(link, &link->conf);
 +      fail_rc = pcmcia_enable_device(link);
        if (fail_rc != 0) {
                dev_printk(KERN_INFO, &link->dev,
 -                         "pcmcia_request_configuration failed 0x%x\n",
 +                         "pcmcia_enable_device failed 0x%x\n",
                           fail_rc);
                goto cs_release;
        }
@@@ -580,6 -599,7 +580,6 @@@ static int reader_probe(struct pcmcia_d
        link->priv = dev;
        dev->p_dev = link;
  
 -      link->conf.IntType = INT_MEMORY_AND_IO;
        dev_table[i] = link;
  
        init_waitqueue_head(&dev->devq);
@@@ -630,6 -650,7 +630,7 @@@ static const struct file_operations rea
        .open           = cm4040_open,
        .release        = cm4040_close,
        .poll           = cm4040_poll,
+       .llseek         = no_llseek,
  };
  
  static struct pcmcia_device_id cm4040_ids[] = {
@@@ -642,7 -663,9 +643,7 @@@ MODULE_DEVICE_TABLE(pcmcia, cm4040_ids)
  
  static struct pcmcia_driver reader_driver = {
        .owner          = THIS_MODULE,
 -      .drv            = {
 -              .name   = "cm4040_cs",
 -      },
 +      .name           = "cm4040_cs",
        .probe          = reader_probe,
        .remove         = reader_detach,
        .id_table       = cm4040_ids,
@@@ -652,6 -675,7 +653,6 @@@ static int __init cm4040_init(void
  {
        int rc;
  
 -      printk(KERN_INFO "%s\n", version);
        cmx_class = class_create(THIS_MODULE, "cardman_4040");
        if (IS_ERR(cmx_class))
                return PTR_ERR(cmx_class);
  
  static void __exit cm4040_exit(void)
  {
 -      printk(KERN_INFO MODULE_NAME ": unloading\n");
        pcmcia_unregister_driver(&reader_driver);
        unregister_chrdev(major, DEVICE_NAME);
        class_destroy(cmx_class);
diff --combined drivers/char/raw.c
index 24b2b9160aa659ee1f8e0de3b13eabf2985db9d8,28c0169e34dab7fe2b0d3bc8ceab5463eaadf742..bfe25ea9766b94caf11ffbc5ca4fb3b766c2c188
@@@ -19,8 -19,8 +19,8 @@@
  #include <linux/cdev.h>
  #include <linux/device.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  #include <linux/gfp.h>
 +#include <linux/compat.h>
  
  #include <asm/uaccess.h>
  
@@@ -55,6 -55,7 +55,6 @@@ static int raw_open(struct inode *inode
                return 0;
        }
  
 -      lock_kernel();
        mutex_lock(&raw_mutex);
  
        /*
@@@ -81,6 -82,7 +81,6 @@@
                        bdev->bd_inode->i_mapping;
        filp->private_data = bdev;
        mutex_unlock(&raw_mutex);
 -      unlock_kernel();
        return 0;
  
  out2:
@@@ -89,6 -91,7 +89,6 @@@ out1
        blkdev_put(bdev, filp->f_mode);
  out:
        mutex_unlock(&raw_mutex);
 -      unlock_kernel();
        return err;
  }
  
@@@ -122,84 -125,20 +122,84 @@@ static lon
  raw_ioctl(struct file *filp, unsigned int command, unsigned long arg)
  {
        struct block_device *bdev = filp->private_data;
 -      int ret;
 +      return blkdev_ioctl(bdev, 0, command, arg);
 +}
 +
 +static int bind_set(int number, u64 major, u64 minor)
 +{
 +      dev_t dev = MKDEV(major, minor);
 +      struct raw_device_data *rawdev;
 +      int err = 0;
 +
 +      if (number <= 0 || number >= MAX_RAW_MINORS)
 +              return -EINVAL;
 +
 +      if (MAJOR(dev) != major || MINOR(dev) != minor)
 +              return -EINVAL;
 +
 +      rawdev = &raw_devices[number];
  
 -      lock_kernel();
 -      ret = blkdev_ioctl(bdev, 0, command, arg);
 -      unlock_kernel();
 +      /*
 +       * This is like making block devices, so demand the
 +       * same capability
 +       */
 +      if (!capable(CAP_SYS_ADMIN))
 +              return -EPERM;
 +
 +      /*
 +       * For now, we don't need to check that the underlying
 +       * block device is present or not: we can do that when
 +       * the raw device is opened.  Just check that the
 +       * major/minor numbers make sense.
 +       */
 +
 +      if (MAJOR(dev) == 0 && dev != 0)
 +              return -EINVAL;
  
 -      return ret;
 +      mutex_lock(&raw_mutex);
 +      if (rawdev->inuse) {
 +              mutex_unlock(&raw_mutex);
 +              return -EBUSY;
 +      }
 +      if (rawdev->binding) {
 +              bdput(rawdev->binding);
 +              module_put(THIS_MODULE);
 +      }
 +      if (!dev) {
 +              /* unbind */
 +              rawdev->binding = NULL;
 +              device_destroy(raw_class, MKDEV(RAW_MAJOR, number));
 +      } else {
 +              rawdev->binding = bdget(dev);
 +              if (rawdev->binding == NULL) {
 +                      err = -ENOMEM;
 +              } else {
 +                      dev_t raw = MKDEV(RAW_MAJOR, number);
 +                      __module_get(THIS_MODULE);
 +                      device_destroy(raw_class, raw);
 +                      device_create(raw_class, NULL, raw, NULL,
 +                                    "raw%d", number);
 +              }
 +      }
 +      mutex_unlock(&raw_mutex);
 +      return err;
  }
  
 -static void bind_device(struct raw_config_request *rq)
 +static int bind_get(int number, dev_t *dev)
  {
 -      device_destroy(raw_class, MKDEV(RAW_MAJOR, rq->raw_minor));
 -      device_create(raw_class, NULL, MKDEV(RAW_MAJOR, rq->raw_minor), NULL,
 -                    "raw%d", rq->raw_minor);
 +      struct raw_device_data *rawdev;
 +      struct block_device *bdev;
 +
 +      if (number <= 0 || number >= MAX_RAW_MINORS)
 +              return -EINVAL;
 +
 +      rawdev = &raw_devices[number];
 +
 +      mutex_lock(&raw_mutex);
 +      bdev = rawdev->binding;
 +      *dev = bdev ? bdev->bd_dev : 0;
 +      mutex_unlock(&raw_mutex);
 +      return 0;
  }
  
  /*
@@@ -210,78 -149,105 +210,78 @@@ static long raw_ctl_ioctl(struct file *
                          unsigned long arg)
  {
        struct raw_config_request rq;
 -      struct raw_device_data *rawdev;
 -      int err = 0;
 +      dev_t dev;
 +      int err;
  
 -      lock_kernel();
        switch (command) {
        case RAW_SETBIND:
 +              if (copy_from_user(&rq, (void __user *) arg, sizeof(rq)))
 +                      return -EFAULT;
 +
 +              return bind_set(rq.raw_minor, rq.block_major, rq.block_minor);
 +
        case RAW_GETBIND:
 +              if (copy_from_user(&rq, (void __user *) arg, sizeof(rq)))
 +                      return -EFAULT;
  
 -              /* First, find out which raw minor we want */
 +              err = bind_get(rq.raw_minor, &dev);
 +              if (err)
 +                      return err;
  
 -              if (copy_from_user(&rq, (void __user *) arg, sizeof(rq))) {
 -                      err = -EFAULT;
 -                      goto out;
 -              }
 +              rq.block_major = MAJOR(dev);
 +              rq.block_minor = MINOR(dev);
  
 -              if (rq.raw_minor <= 0 || rq.raw_minor >= MAX_RAW_MINORS) {
 -                      err = -EINVAL;
 -                      goto out;
 -              }
 -              rawdev = &raw_devices[rq.raw_minor];
 -
 -              if (command == RAW_SETBIND) {
 -                      dev_t dev;
 -
 -                      /*
 -                       * This is like making block devices, so demand the
 -                       * same capability
 -                       */
 -                      if (!capable(CAP_SYS_ADMIN)) {
 -                              err = -EPERM;
 -                              goto out;
 -                      }
 -
 -                      /*
 -                       * For now, we don't need to check that the underlying
 -                       * block device is present or not: we can do that when
 -                       * the raw device is opened.  Just check that the
 -                       * major/minor numbers make sense.
 -                       */
 -
 -                      dev = MKDEV(rq.block_major, rq.block_minor);
 -                      if ((rq.block_major == 0 && rq.block_minor != 0) ||
 -                                      MAJOR(dev) != rq.block_major ||
 -                                      MINOR(dev) != rq.block_minor) {
 -                              err = -EINVAL;
 -                              goto out;
 -                      }
 -
 -                      mutex_lock(&raw_mutex);
 -                      if (rawdev->inuse) {
 -                              mutex_unlock(&raw_mutex);
 -                              err = -EBUSY;
 -                              goto out;
 -                      }
 -                      if (rawdev->binding) {
 -                              bdput(rawdev->binding);
 -                              module_put(THIS_MODULE);
 -                      }
 -                      if (rq.block_major == 0 && rq.block_minor == 0) {
 -                              /* unbind */
 -                              rawdev->binding = NULL;
 -                              device_destroy(raw_class,
 -                                              MKDEV(RAW_MAJOR, rq.raw_minor));
 -                      } else {
 -                              rawdev->binding = bdget(dev);
 -                              if (rawdev->binding == NULL)
 -                                      err = -ENOMEM;
 -                              else {
 -                                      __module_get(THIS_MODULE);
 -                                      bind_device(&rq);
 -                              }
 -                      }
 -                      mutex_unlock(&raw_mutex);
 -              } else {
 -                      struct block_device *bdev;
 -
 -                      mutex_lock(&raw_mutex);
 -                      bdev = rawdev->binding;
 -                      if (bdev) {
 -                              rq.block_major = MAJOR(bdev->bd_dev);
 -                              rq.block_minor = MINOR(bdev->bd_dev);
 -                      } else {
 -                              rq.block_major = rq.block_minor = 0;
 -                      }
 -                      mutex_unlock(&raw_mutex);
 -                      if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) {
 -                              err = -EFAULT;
 -                              goto out;
 -                      }
 -              }
 -              break;
 -      default:
 -              err = -EINVAL;
 -              break;
 +              if (copy_to_user((void __user *)arg, &rq, sizeof(rq)))
 +                      return -EFAULT;
 +
 +              return 0;
        }
 -out:
 -      unlock_kernel();
 -      return err;
 +
 +      return -EINVAL;
 +}
 +
 +#ifdef CONFIG_COMPAT
 +struct raw32_config_request {
 +      compat_int_t    raw_minor;
 +      compat_u64      block_major;
 +      compat_u64      block_minor;
 +};
 +
 +static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd,
 +                              unsigned long arg)
 +{
 +      struct raw32_config_request __user *user_req = compat_ptr(arg);
 +      struct raw32_config_request rq;
 +      dev_t dev;
 +      int err = 0;
 +
 +      switch (cmd) {
 +      case RAW_SETBIND:
 +              if (copy_from_user(&rq, user_req, sizeof(rq)))
 +                      return -EFAULT;
 +
 +              return bind_set(rq.raw_minor, rq.block_major, rq.block_minor);
 +
 +      case RAW_GETBIND:
 +              if (copy_from_user(&rq, user_req, sizeof(rq)))
 +                      return -EFAULT;
 +
 +              err = bind_get(rq.raw_minor, &dev);
 +              if (err)
 +                      return err;
 +
 +              rq.block_major = MAJOR(dev);
 +              rq.block_minor = MINOR(dev);
 +
 +              if (copy_to_user(user_req, &rq, sizeof(rq)))
 +                      return -EFAULT;
 +
 +              return 0;
 +      }
 +
 +      return -EINVAL;
  }
 +#endif
  
  static const struct file_operations raw_fops = {
        .read           = do_sync_read,
        .open           = raw_open,
        .release        = raw_release,
        .unlocked_ioctl = raw_ioctl,
+       .llseek         = default_llseek,
        .owner          = THIS_MODULE,
  };
  
  static const struct file_operations raw_ctl_fops = {
        .unlocked_ioctl = raw_ctl_ioctl,
 +#ifdef CONFIG_COMPAT
 +      .compat_ioctl   = raw_ctl_compat_ioctl,
 +#endif
        .open           = raw_open,
        .owner          = THIS_MODULE,
+       .llseek         = noop_llseek,
  };
  
  static struct cdev raw_cdev;
index e06a5977fdb2933db756c8af5ff8c652d598748d,1e87a93164bfcd18db17c0a1dda111e9e5eeb36c..5e33293d24e399d60f45301fdf3ad9e73f00dd9b
@@@ -44,7 -44,7 +44,7 @@@
  #include <linux/delay.h>
  #include <linux/pci.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/miscdevice.h>
  #include <linux/init.h>
  
@@@ -122,7 -122,6 +122,7 @@@ more than 512 ports.... *
  
  
  /* These constants are derived from SCO Source */
 +static DEFINE_MUTEX(rio_fw_mutex);
  static struct Conf
   RIOConf = {
        /* locator */ "RIO Config here",
@@@ -242,6 -241,7 +242,7 @@@ static struct real_driver rio_real_driv
  static const struct file_operations rio_fw_fops = {
        .owner = THIS_MODULE,
        .unlocked_ioctl = rio_fw_ioctl,
+       .llseek = noop_llseek,
  };
  
  static struct miscdevice rio_fw_device = {
@@@ -567,9 -567,9 +568,9 @@@ static long rio_fw_ioctl(struct file *f
        func_enter();
  
        /* The "dev" argument isn't used. */
 -      lock_kernel();
 +      mutex_lock(&rio_fw_mutex);
        rc = riocontrol(p, 0, cmd, arg, capable(CAP_SYS_ADMIN));
 -      unlock_kernel();
 +      mutex_unlock(&rio_fw_mutex);
  
        func_exit();
        return rc;
diff --combined drivers/char/snsc.c
index 208e25731dfe386daa7b858f436d81aeb26ee712,444ce17ac7223a9e3eb6dfffe2d8f562ab3093cf..5816b39ff5a9cf43cbba56579d9b0b2d021f8883
@@@ -21,7 -21,7 +21,7 @@@
  #include <linux/poll.h>
  #include <linux/module.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <asm/sn/io.h>
  #include <asm/sn/sn_sal.h>
  #include <asm/sn/module.h>
@@@ -34,7 -34,6 +34,7 @@@
  #define SCDRV_BUFSZ   2048
  #define SCDRV_TIMEOUT 1000
  
 +static DEFINE_MUTEX(scdrv_mutex);
  static irqreturn_t
  scdrv_interrupt(int irq, void *subch_data)
  {
@@@ -106,7 -105,7 +106,7 @@@ scdrv_open(struct inode *inode, struct 
        file->private_data = sd;
  
        /* hook this subchannel up to the system controller interrupt */
 -      lock_kernel();
 +      mutex_lock(&scdrv_mutex);
        rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt,
                         IRQF_SHARED | IRQF_DISABLED,
                         SYSCTL_BASENAME, sd);
                ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch);
                kfree(sd);
                printk("%s: irq request failed (%d)\n", __func__, rv);
 -              unlock_kernel();
 +              mutex_unlock(&scdrv_mutex);
                return -EBUSY;
        }
 -      unlock_kernel();
 +      mutex_unlock(&scdrv_mutex);
        return 0;
  }
  
@@@ -358,6 -357,7 +358,7 @@@ static const struct file_operations scd
        .poll =         scdrv_poll,
        .open =         scdrv_open,
        .release =      scdrv_release,
+       .llseek =       noop_llseek,
  };
  
  static struct class *snsc_class;
diff --combined drivers/char/tlclk.c
index e32cbf0c9a0b92a22c4053bab922b5e1ea5b615c,d087532b29d76d0c2385d25a011d8273d2718048..0c964cdcc223ca7e710534470ee069d75497b802
@@@ -37,7 -37,7 +37,7 @@@
  #include <linux/ioport.h>
  #include <linux/interrupt.h>
  #include <linux/spinlock.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/timer.h>
  #include <linux/sysfs.h>
  #include <linux/device.h>
@@@ -206,7 -206,7 +206,7 @@@ static int tlclk_open(struct inode *ino
  {
        int result;
  
 -      lock_kernel();
 +      mutex_lock(&tlclk_mutex);
        if (test_and_set_bit(0, &useflags)) {
                result = -EBUSY;
                /* this legacy device is always one per system and it doesn't
                inb(TLCLK_REG6);        /* Clear interrupt events */
  
  out:
 -      unlock_kernel();
 +      mutex_unlock(&tlclk_mutex);
        return result;
  }
  
@@@ -267,6 -267,7 +267,7 @@@ static const struct file_operations tlc
        .read = tlclk_read,
        .open = tlclk_open,
        .release = tlclk_release,
+       .llseek = noop_llseek,
  
  };
  
diff --combined drivers/char/toshiba.c
index f8f09ab0b170403c180913926c5ec2977b264484,3d6e9617245327130c7e1003a2de8b9f71fa9885..014c9d90d297ba57f1f83c7abbe1768042971b6b
@@@ -68,7 -68,7 +68,7 @@@
  #include <linux/stat.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/toshiba.h>
  
  #define TOSH_MINOR_DEV 181
@@@ -78,7 -78,6 +78,7 @@@ MODULE_AUTHOR("Jonathan Buzzard <jonath
  MODULE_DESCRIPTION("Toshiba laptop SMM driver");
  MODULE_SUPPORTED_DEVICE("toshiba");
  
 +static DEFINE_MUTEX(tosh_mutex);
  static int tosh_fn;
  module_param_named(fn, tosh_fn, int, 0);
  MODULE_PARM_DESC(fn, "User specified Fn key detection port");
@@@ -96,6 -95,7 +96,7 @@@ static long tosh_ioctl(struct file *, u
  static const struct file_operations tosh_fops = {
        .owner          = THIS_MODULE,
        .unlocked_ioctl = tosh_ioctl,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice tosh_device = {
@@@ -275,16 -275,16 +276,16 @@@ static long tosh_ioctl(struct file *fp
                                return -EINVAL;
  
                        /* do we need to emulate the fan ? */
 -                      lock_kernel();
 +                      mutex_lock(&tosh_mutex);
                        if (tosh_fan==1) {
                                if (((ax==0xf300) || (ax==0xf400)) && (bx==0x0004)) {
                                        err = tosh_emulate_fan(&regs);
 -                                      unlock_kernel();
 +                                      mutex_unlock(&tosh_mutex);
                                        break;
                                }
                        }
                        err = tosh_smm(&regs);
 -                      unlock_kernel();
 +                      mutex_unlock(&tosh_mutex);
                        break;
                default:
                        return -EINVAL;
diff --combined drivers/char/viotape.c
index 6f954a808b65bb3375624c1f0d1ed1dcc3d0635f,442c3f5b642a979b870abdee760ed9f66b2bca13..ad6e64a2912d6fe61d06d7c20135e76a92bc9e1c
@@@ -46,7 -46,7 +46,7 @@@
  #include <linux/completion.h>
  #include <linux/proc_fs.h>
  #include <linux/seq_file.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/slab.h>
  
  #include <asm/uaccess.h>
@@@ -64,7 -64,6 +64,7 @@@
  #define VIOTAPE_KERN_WARN     KERN_WARNING "viotape: "
  #define VIOTAPE_KERN_INFO     KERN_INFO "viotape: "
  
 +static DEFINE_MUTEX(proc_viotape_mutex);
  static int viotape_numdev;
  
  /*
@@@ -685,9 -684,9 +685,9 @@@ static long viotap_unlocked_ioctl(struc
  {
        long rc;
  
 -      lock_kernel();
 +      mutex_lock(&proc_viotape_mutex);
        rc = viotap_ioctl(file->f_path.dentry->d_inode, file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&proc_viotape_mutex);
        return rc;
  }
  
@@@ -701,7 -700,7 +701,7 @@@ static int viotap_open(struct inode *in
        if (op == NULL)
                return -ENOMEM;
  
 -      lock_kernel();
 +      mutex_lock(&proc_viotape_mutex);
        get_dev_info(file->f_path.dentry->d_inode, &devi);
  
        /* Note: We currently only support one mode! */
  
  free_op:
        free_op_struct(op);
 -      unlock_kernel();
 +      mutex_unlock(&proc_viotape_mutex);
        return ret;
  }
  
@@@ -805,6 -804,7 +805,7 @@@ const struct file_operations viotap_fop
        .unlocked_ioctl =       viotap_unlocked_ioctl,
        .open =                 viotap_open,
        .release =              viotap_release,
+       .llseek =               noop_llseek,
  };
  
  /* Handle interrupt events for tape */
index d985204d76fedce821d2b8f54e35d6cecf424649,be6d6fb47cc53d020d7d4605383b10c72195c7c6..9f2272e6de1c160e1566eb5b01c63f45ddb2a129
@@@ -81,6 -81,7 +81,6 @@@
  #include <linux/poll.h>
  #include <linux/proc_fs.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  #include <linux/sysctl.h>
  #include <linux/fs.h>
  #include <linux/cdev.h>
  #define HWICAP_DEVICES 1
  
  /* An array, which is set to true when the device is registered. */
 +static DEFINE_MUTEX(hwicap_mutex);
  static bool probed_devices[HWICAP_DEVICES];
  static struct mutex icap_sem;
  
@@@ -502,7 -502,7 +502,7 @@@ static int hwicap_open(struct inode *in
        struct hwicap_drvdata *drvdata;
        int status;
  
 -      lock_kernel();
 +      mutex_lock(&hwicap_mutex);
        drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev);
  
        status = mutex_lock_interruptible(&drvdata->sem);
   error:
        mutex_unlock(&drvdata->sem);
   out:
 -      unlock_kernel();
 +      mutex_unlock(&hwicap_mutex);
        return status;
  }
  
@@@ -567,6 -567,7 +567,7 @@@ static const struct file_operations hwi
        .read = hwicap_read,
        .open = hwicap_open,
        .release = hwicap_release,
+       .llseek = noop_llseek,
  };
  
  static int __devinit hwicap_setup(struct device *dev, int id,
index fb07e73581e84467ab59ebe744e21ff6f712d2ce,00f1bdaa65cdf0217c1084dc5e8bdfc8d94def26..ff33e53bbbf80dfbd470a444c854dc5ae158e32b
@@@ -116,9 -116,10 +116,10 @@@ static int i810_mmap_buffers(struct fil
  static const struct file_operations i810_buffer_fops = {
        .open = drm_open,
        .release = drm_release,
 -      .unlocked_ioctl = drm_ioctl,
 +      .unlocked_ioctl = i810_ioctl,
        .mmap = i810_mmap_buffers,
        .fasync = drm_fasync,
+       .llseek = noop_llseek,
  };
  
  static int i810_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
index cc92c7e6236fbdffb86078290b5b93dffad2cbad,5c6eb65f4e5157b04e319326e255a0a00c8958c5..ca6f31ff0eecc54a2868878c97b98c7cf6a71bb2
@@@ -118,9 -118,10 +118,10 @@@ static int i830_mmap_buffers(struct fil
  static const struct file_operations i830_buffer_fops = {
        .open = drm_open,
        .release = drm_release,
 -      .unlocked_ioctl = drm_ioctl,
 +      .unlocked_ioctl = i830_ioctl,
        .mmap = i830_mmap_buffers,
        .fasync = drm_fasync,
+       .llseek = noop_llseek,
  };
  
  static int i830_map_buffer(struct drm_buf *buf, struct drm_file *file_priv)
index 6dbe14cc4f7474aa57221c46fa59286caf362b9f,a6fdb481500c4bb4fa4cc733658cdd3dee0cd11e..895ab896e336c660c279622a6b79bfe138a24a5d
@@@ -170,7 -170,6 +170,7 @@@ static const struct pci_device_id pciid
        INTEL_VGA_DEVICE(0x2e22, &intel_g45_info),              /* G45_G */
        INTEL_VGA_DEVICE(0x2e32, &intel_g45_info),              /* G41_G */
        INTEL_VGA_DEVICE(0x2e42, &intel_g45_info),              /* B43_G */
 +      INTEL_VGA_DEVICE(0x2e92, &intel_g45_info),              /* B43_G.1 */
        INTEL_VGA_DEVICE(0xa001, &intel_pineview_info),
        INTEL_VGA_DEVICE(0xa011, &intel_pineview_info),
        INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info),
@@@ -548,6 -547,7 +548,7 @@@ static struct drm_driver driver = 
  #ifdef CONFIG_COMPAT
                 .compat_ioctl = i915_compat_ioctl,
  #endif
+                .llseek = noop_llseek,
        },
  
        .pci_driver = {
index a96ed6d9d010b82cfc58ed41ec6240f99d5a9103,d237190b888a56ccd60e1fc3ebdbd98d457d02e8..2ef93df9e8ae39f8c9e267a500ee5157f2fda420
@@@ -148,16 -148,13 +148,16 @@@ static struct pci_device_id vmw_pci_id_
        {0, 0, 0}
  };
  
 -static char *vmw_devname = "vmwgfx";
 +static int enable_fbdev;
  
  static int vmw_probe(struct pci_dev *, const struct pci_device_id *);
  static void vmw_master_init(struct vmw_master *);
  static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
                              void *ptr);
  
 +MODULE_PARM_DESC(enable_fbdev, "Enable vmwgfx fbdev");
 +module_param_named(enable_fbdev, enable_fbdev, int, 0600);
 +
  static void vmw_print_capabilities(uint32_t capabilities)
  {
        DRM_INFO("Capabilities:\n");
@@@ -195,6 -192,8 +195,6 @@@ static int vmw_request_device(struct vm
  {
        int ret;
  
 -      vmw_kms_save_vga(dev_priv);
 -
        ret = vmw_fifo_init(dev_priv, &dev_priv->fifo);
        if (unlikely(ret != 0)) {
                DRM_ERROR("Unable to initialize FIFO.\n");
  static void vmw_release_device(struct vmw_private *dev_priv)
  {
        vmw_fifo_release(dev_priv, &dev_priv->fifo);
 -      vmw_kms_restore_vga(dev_priv);
  }
  
 +int vmw_3d_resource_inc(struct vmw_private *dev_priv)
 +{
 +      int ret = 0;
 +
 +      mutex_lock(&dev_priv->release_mutex);
 +      if (unlikely(dev_priv->num_3d_resources++ == 0)) {
 +              ret = vmw_request_device(dev_priv);
 +              if (unlikely(ret != 0))
 +                      --dev_priv->num_3d_resources;
 +      }
 +      mutex_unlock(&dev_priv->release_mutex);
 +      return ret;
 +}
 +
 +
 +void vmw_3d_resource_dec(struct vmw_private *dev_priv)
 +{
 +      int32_t n3d;
 +
 +      mutex_lock(&dev_priv->release_mutex);
 +      if (unlikely(--dev_priv->num_3d_resources == 0))
 +              vmw_release_device(dev_priv);
 +      n3d = (int32_t) dev_priv->num_3d_resources;
 +      mutex_unlock(&dev_priv->release_mutex);
 +
 +      BUG_ON(n3d < 0);
 +}
  
  static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
  {
        dev_priv->last_read_sequence = (uint32_t) -100;
        mutex_init(&dev_priv->hw_mutex);
        mutex_init(&dev_priv->cmdbuf_mutex);
 +      mutex_init(&dev_priv->release_mutex);
        rwlock_init(&dev_priv->resource_lock);
        idr_init(&dev_priv->context_idr);
        idr_init(&dev_priv->surface_idr);
        dev_priv->vram_start = pci_resource_start(dev->pdev, 1);
        dev_priv->mmio_start = pci_resource_start(dev->pdev, 2);
  
 +      dev_priv->enable_fb = enable_fbdev;
 +
        mutex_lock(&dev_priv->hw_mutex);
  
        vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
  
        dev->dev_private = dev_priv;
  
 -      if (!dev->devname)
 -              dev->devname = vmw_devname;
 -
 -      if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
 -              ret = drm_irq_install(dev);
 -              if (unlikely(ret != 0)) {
 -                      DRM_ERROR("Failed installing irq: %d\n", ret);
 -                      goto out_no_irq;
 -              }
 -      }
 -
        ret = pci_request_regions(dev->pdev, "vmwgfx probe");
        dev_priv->stealth = (ret != 0);
        if (dev_priv->stealth) {
                        goto out_no_device;
                }
        }
 -      ret = vmw_request_device(dev_priv);
 +      ret = vmw_kms_init(dev_priv);
        if (unlikely(ret != 0))
 -              goto out_no_device;
 -      vmw_kms_init(dev_priv);
 +              goto out_no_kms;
        vmw_overlay_init(dev_priv);
 -      vmw_fb_init(dev_priv);
 +      if (dev_priv->enable_fb) {
 +              ret = vmw_3d_resource_inc(dev_priv);
 +              if (unlikely(ret != 0))
 +                      goto out_no_fifo;
 +              vmw_kms_save_vga(dev_priv);
 +              vmw_fb_init(dev_priv);
 +              DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ?
 +                       "Detected device 3D availability.\n" :
 +                       "Detected no device 3D availability.\n");
 +      } else {
 +              DRM_INFO("Delayed 3D detection since we're not "
 +                       "running the device in SVGA mode yet.\n");
 +      }
 +
 +      if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
 +              ret = drm_irq_install(dev);
 +              if (unlikely(ret != 0)) {
 +                      DRM_ERROR("Failed installing irq: %d\n", ret);
 +                      goto out_no_irq;
 +              }
 +      }
  
        dev_priv->pm_nb.notifier_call = vmwgfx_pm_notifier;
        register_pm_notifier(&dev_priv->pm_nb);
  
 -      DRM_INFO("%s", vmw_fifo_have_3d(dev_priv) ? "Have 3D\n" : "No 3D\n");
 -
        return 0;
  
 -out_no_device:
 -      if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
 -              drm_irq_uninstall(dev_priv->dev);
 -      if (dev->devname == vmw_devname)
 -              dev->devname = NULL;
  out_no_irq:
 +      if (dev_priv->enable_fb) {
 +              vmw_fb_close(dev_priv);
 +              vmw_kms_restore_vga(dev_priv);
 +              vmw_3d_resource_dec(dev_priv);
 +      }
 +out_no_fifo:
 +      vmw_overlay_close(dev_priv);
 +      vmw_kms_close(dev_priv);
 +out_no_kms:
 +      if (dev_priv->stealth)
 +              pci_release_region(dev->pdev, 2);
 +      else
 +              pci_release_regions(dev->pdev);
 +out_no_device:
        ttm_object_device_release(&dev_priv->tdev);
  out_err4:
        iounmap(dev_priv->mmio_virt);
@@@ -460,20 -415,19 +460,20 @@@ static int vmw_driver_unload(struct drm
  
        unregister_pm_notifier(&dev_priv->pm_nb);
  
 -      vmw_fb_close(dev_priv);
 +      if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
 +              drm_irq_uninstall(dev_priv->dev);
 +      if (dev_priv->enable_fb) {
 +              vmw_fb_close(dev_priv);
 +              vmw_kms_restore_vga(dev_priv);
 +              vmw_3d_resource_dec(dev_priv);
 +      }
        vmw_kms_close(dev_priv);
        vmw_overlay_close(dev_priv);
 -      vmw_release_device(dev_priv);
        if (dev_priv->stealth)
                pci_release_region(dev->pdev, 2);
        else
                pci_release_regions(dev->pdev);
  
 -      if (dev_priv->capabilities & SVGA_CAP_IRQMASK)
 -              drm_irq_uninstall(dev_priv->dev);
 -      if (dev->devname == vmw_devname)
 -              dev->devname = NULL;
        ttm_object_device_release(&dev_priv->tdev);
        iounmap(dev_priv->mmio_virt);
        drm_mtrr_del(dev_priv->mmio_mtrr, dev_priv->mmio_start,
@@@ -546,7 -500,7 +546,7 @@@ static long vmw_unlocked_ioctl(struct f
                struct drm_ioctl_desc *ioctl =
                    &vmw_ioctls[nr - DRM_COMMAND_BASE];
  
 -              if (unlikely(ioctl->cmd != cmd)) {
 +              if (unlikely(ioctl->cmd_drv != cmd)) {
                        DRM_ERROR("Invalid command format, ioctl %d\n",
                                  nr - DRM_COMMAND_BASE);
                        return -EINVAL;
@@@ -635,16 -589,6 +635,16 @@@ static int vmw_master_set(struct drm_de
        struct vmw_master *vmaster = vmw_master(file_priv->master);
        int ret = 0;
  
 +      if (!dev_priv->enable_fb) {
 +              ret = vmw_3d_resource_inc(dev_priv);
 +              if (unlikely(ret != 0))
 +                      return ret;
 +              vmw_kms_save_vga(dev_priv);
 +              mutex_lock(&dev_priv->hw_mutex);
 +              vmw_write(dev_priv, SVGA_REG_TRACES, 0);
 +              mutex_unlock(&dev_priv->hw_mutex);
 +      }
 +
        if (active) {
                BUG_ON(active != &dev_priv->fbdev_master);
                ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile);
        return 0;
  
  out_no_active_lock:
 -      vmw_release_device(dev_priv);
 +      if (!dev_priv->enable_fb) {
 +              mutex_lock(&dev_priv->hw_mutex);
 +              vmw_write(dev_priv, SVGA_REG_TRACES, 1);
 +              mutex_unlock(&dev_priv->hw_mutex);
 +              vmw_kms_restore_vga(dev_priv);
 +              vmw_3d_resource_dec(dev_priv);
 +      }
        return ret;
  }
  
@@@ -707,23 -645,11 +707,23 @@@ static void vmw_master_drop(struct drm_
  
        ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
  
 +      if (!dev_priv->enable_fb) {
 +              ret = ttm_bo_evict_mm(&dev_priv->bdev, TTM_PL_VRAM);
 +              if (unlikely(ret != 0))
 +                      DRM_ERROR("Unable to clean VRAM on master drop.\n");
 +              mutex_lock(&dev_priv->hw_mutex);
 +              vmw_write(dev_priv, SVGA_REG_TRACES, 1);
 +              mutex_unlock(&dev_priv->hw_mutex);
 +              vmw_kms_restore_vga(dev_priv);
 +              vmw_3d_resource_dec(dev_priv);
 +      }
 +
        dev_priv->active_master = &dev_priv->fbdev_master;
        ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
        ttm_vt_unlock(&dev_priv->fbdev_master.lock);
  
 -      vmw_fb_on(dev_priv);
 +      if (dev_priv->enable_fb)
 +              vmw_fb_on(dev_priv);
  }
  
  
@@@ -796,7 -722,6 +796,7 @@@ static struct drm_driver driver = 
        .irq_postinstall = vmw_irq_postinstall,
        .irq_uninstall = vmw_irq_uninstall,
        .irq_handler = vmw_irq_handler,
 +      .get_vblank_counter = vmw_get_vblank_counter,
        .reclaim_buffers_locked = NULL,
        .get_map_ofs = drm_core_get_map_ofs,
        .get_reg_ofs = drm_core_get_reg_ofs,
  #if defined(CONFIG_COMPAT)
                 .compat_ioctl = drm_compat_ioctl,
  #endif
+                .llseek = noop_llseek,
                 },
        .pci_driver = {
                       .name = VMWGFX_DRIVER_NAME,
diff --combined drivers/gpu/vga/vgaarb.c
index f366f968155a3ed913ce770a60ca30cbf2f97981,3b7e0acf8164799968d07ed2fedf4376769ed332..c380c65da41798faf91b9e730f585be97a7b49d6
@@@ -598,7 -598,7 +598,7 @@@ static inline void vga_update_device_de
        pr_debug("vgaarb: decoding count now is: %d\n", vga_decode_count);
  }
  
 -void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace)
 +static void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace)
  {
        struct vga_device *vgadev;
        unsigned long flags;
@@@ -1211,6 -1211,7 +1211,7 @@@ static const struct file_operations vga
        .poll = vga_arb_fpoll,
        .open = vga_arb_open,
        .release = vga_arb_release,
+       .llseek = noop_llseek,
  };
  
  static struct miscdevice vga_arb_device = {
diff --combined drivers/hid/hidraw.c
index a3866b5c0c43da58bceae7bb463a2780846454be,bb98fa87aa86c4eb171ca889aea8f5630865ed9a..925992f549f09abdefd1ba6ab8f280529910920f
@@@ -109,12 -109,6 +109,12 @@@ static ssize_t hidraw_write(struct fil
        int ret = 0;
  
        mutex_lock(&minors_lock);
 +
 +      if (!hidraw_table[minor]) {
 +              ret = -ENODEV;
 +              goto out;
 +      }
 +
        dev = hidraw_table[minor]->hid;
  
        if (!dev->hid_output_raw_report) {
@@@ -250,10 -244,6 +250,10 @@@ static long hidraw_ioctl(struct file *f
  
        mutex_lock(&minors_lock);
        dev = hidraw_table[minor];
 +      if (!dev) {
 +              ret = -ENODEV;
 +              goto out;
 +      }
  
        switch (cmd) {
                case HIDIOCGRDESCSIZE:
  
                ret = -ENOTTY;
        }
 +out:
        mutex_unlock(&minors_lock);
        return ret;
  }
@@@ -340,6 -329,7 +340,7 @@@ static const struct file_operations hid
        .open =         hidraw_open,
        .release =      hidraw_release,
        .unlocked_ioctl = hidraw_ioctl,
+       .llseek =       noop_llseek,
  };
  
  void hidraw_report_event(struct hid_device *hid, u8 *data, int len)
index 681e620eb95b166ed43ac48c082960ba0f39e211,e8f45d7ef3b24fd98bc6d37d9a8eb7c6ef952d7e..dfcb27613ec54005033f5fe4309550bfb2539998
@@@ -270,7 -270,7 +270,7 @@@ static int hiddev_open(struct inode *in
        struct hiddev *hiddev;
        int res;
  
 -      intf = usb_find_interface(&hiddev_driver, iminor(inode));
 +      intf = usbhid_find_interface(iminor(inode));
        if (!intf)
                return -ENODEV;
        hid = usb_get_intfdata(intf);
@@@ -847,6 -847,7 +847,7 @@@ static const struct file_operations hid
  #ifdef CONFIG_COMPAT
        .compat_ioctl   = hiddev_compat_ioctl,
  #endif
+       .llseek         = noop_llseek,
  };
  
  static char *hiddev_devnode(struct device *dev, mode_t *mode)
diff --combined drivers/ide/ide-tape.c
index 65f0bcfb42ca3759555672add382911005f12bd6,23d1d1c5587c0538a8175037168c42ec48c2ce32..7ecb1ade8874b86c293a5d1a4a2a59ffc7efc860
  #include <linux/errno.h>
  #include <linux/genhd.h>
  #include <linux/seq_file.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  #include <linux/pci.h>
  #include <linux/ide.h>
 -#include <linux/smp_lock.h>
  #include <linux/completion.h>
  #include <linux/bitops.h>
  #include <linux/mutex.h>
@@@ -218,7 -220,6 +218,7 @@@ typedef struct ide_tape_obj 
        char write_prot;
  } idetape_tape_t;
  
 +static DEFINE_MUTEX(ide_tape_mutex);
  static DEFINE_MUTEX(idetape_ref_mutex);
  
  static DEFINE_MUTEX(idetape_chrdev_mutex);
@@@ -1425,9 -1426,9 +1425,9 @@@ static long idetape_chrdev_ioctl(struc
                                unsigned int cmd, unsigned long arg)
  {
        long ret;
 -      lock_kernel();
 +      mutex_lock(&ide_tape_mutex);
        ret = do_idetape_chrdev_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ide_tape_mutex);
        return ret;
  }
  
@@@ -1902,15 -1903,16 +1902,16 @@@ static const struct file_operations ide
        .unlocked_ioctl = idetape_chrdev_ioctl,
        .open           = idetape_chrdev_open,
        .release        = idetape_chrdev_release,
+       .llseek         = noop_llseek,
  };
  
  static int idetape_open(struct block_device *bdev, fmode_t mode)
  {
        struct ide_tape_obj *tape;
  
 -      lock_kernel();
 +      mutex_lock(&ide_tape_mutex);
        tape = ide_tape_get(bdev->bd_disk, false, 0);
 -      unlock_kernel();
 +      mutex_unlock(&ide_tape_mutex);
  
        if (!tape)
                return -ENXIO;
@@@ -1922,9 -1924,9 +1923,9 @@@ static int idetape_release(struct gendi
  {
        struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj);
  
 -      lock_kernel();
 +      mutex_lock(&ide_tape_mutex);
        ide_tape_put(tape);
 -      unlock_kernel();
 +      mutex_unlock(&ide_tape_mutex);
  
        return 0;
  }
@@@ -1936,11 -1938,11 +1937,11 @@@ static int idetape_ioctl(struct block_d
        ide_drive_t *drive = tape->drive;
        int err;
  
 -      lock_kernel();
 +      mutex_lock(&ide_tape_mutex);
        err = generic_ide_ioctl(drive, bdev, cmd, arg);
        if (err == -EINVAL)
                err = idetape_blkdev_ioctl(drive, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ide_tape_mutex);
  
        return err;
  }
diff --combined drivers/input/evdev.c
index af9ee313c10b67b9f0a034e6806757aca085c4ed,51330363c0ebc3cd956b60b8ed963b4e4573daee..535fea4fe67f026bbe6475c5cd70c8a18d0bc4dd
@@@ -28,7 -28,7 +28,7 @@@ struct evdev 
        int minor;
        struct input_handle handle;
        wait_queue_head_t wait;
 -      struct evdev_client *grab;
 +      struct evdev_client __rcu *grab;
        struct list_head client_list;
        spinlock_t client_lock; /* protects client_list */
        struct mutex mutex;
@@@ -669,9 -669,6 +669,9 @@@ static long evdev_do_ioctl(struct file 
  
                if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0))) {
  
 +                      if (!dev->absinfo)
 +                              return -EINVAL;
 +
                        t = _IOC_NR(cmd) & ABS_MAX;
                        abs = dev->absinfo[t];
  
                }
        }
  
 -      if (_IOC_DIR(cmd) == _IOC_READ) {
 +      if (_IOC_DIR(cmd) == _IOC_WRITE) {
  
                if ((_IOC_NR(cmd) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0))) {
  
 +                      if (!dev->absinfo)
 +                              return -EINVAL;
 +
                        t = _IOC_NR(cmd) & ABS_MAX;
  
                        if (copy_from_user(&abs, p, min_t(size_t,
@@@ -767,7 -761,8 +767,8 @@@ static const struct file_operations evd
        .compat_ioctl   = evdev_ioctl_compat,
  #endif
        .fasync         = evdev_fasync,
-       .flush          = evdev_flush
+       .flush          = evdev_flush,
+       .llseek         = no_llseek,
  };
  
  static int evdev_install_chrdev(struct evdev *evdev)
diff --combined drivers/input/joydev.c
index 22239e9884988139df3228a50db421f337818355,502b2f73b43439f6505c191ae8cd0f2e71c21fdc..9d424cebfd2c7d6e31e3cd433342e94f6fc7625c
@@@ -483,9 -483,6 +483,9 @@@ static int joydev_handle_JSIOCSAXMAP(st
  
        memcpy(joydev->abspam, abspam, len);
  
 +      for (i = 0; i < joydev->nabs; i++)
 +              joydev->absmap[joydev->abspam[i]] = i;
 +
   out:
        kfree(abspam);
        return retval;
@@@ -739,6 -736,7 +739,7 @@@ static const struct file_operations joy
        .compat_ioctl   = joydev_compat_ioctl,
  #endif
        .fasync         = joydev_fasync,
+       .llseek         = no_llseek,
  };
  
  static int joydev_install_chrdev(struct joydev *joydev)
index 360698553eb55d2d1f1b84f912dbc6984eb606bd,2771ea778d340df2a8c8003da295f8c988512be0..b9410784e6a1f1503fb57a720c9f91b1fcec2fce
@@@ -404,13 -404,6 +404,13 @@@ static int uinput_setup_device(struct u
                retval = uinput_validate_absbits(dev);
                if (retval < 0)
                        goto exit;
 +              if (test_bit(ABS_MT_SLOT, dev->absbit)) {
 +                      int nslot = input_abs_get_max(dev, ABS_MT_SLOT) + 1;
 +                      input_mt_create_slots(dev, nslot);
 +                      input_set_events_per_packet(dev, 6 * nslot);
 +              } else if (test_bit(ABS_MT_POSITION_X, dev->absbit)) {
 +                      input_set_events_per_packet(dev, 60);
 +              }
        }
  
        udev->state = UIST_SETUP_COMPLETE;
@@@ -811,6 -804,7 +811,7 @@@ static const struct file_operations uin
  #ifdef CONFIG_COMPAT
        .compat_ioctl   = uinput_compat_ioctl,
  #endif
+       .llseek         = no_llseek,
  };
  
  static struct miscdevice uinput_misc = {
index 7b8b1de03db4bb2c5e582dc7085c642c15b813c9,44d171cc225234c8105a0cb0b40fbdd608540480..cd29c8248386c124070ec2a8287bb30c31d68374
@@@ -18,7 -18,7 +18,7 @@@
   *
   */
  #include <stdarg.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/types.h>
  #include <linux/errno.h>
  #include <linux/kernel.h>
@@@ -73,7 -73,6 +73,7 @@@
  /* How many iterations between battery polls */
  #define BATTERY_POLLING_COUNT 2
  
 +static DEFINE_MUTEX(pmu_info_proc_mutex);
  static volatile unsigned char __iomem *via;
  
  /* VIA registers - spaced 0x200 bytes apart */
@@@ -2079,7 -2078,7 +2079,7 @@@ pmu_open(struct inode *inode, struct fi
        pp->rb_get = pp->rb_put = 0;
        spin_lock_init(&pp->lock);
        init_waitqueue_head(&pp->wait);
 -      lock_kernel();
 +      mutex_lock(&pmu_info_proc_mutex);
        spin_lock_irqsave(&all_pvt_lock, flags);
  #if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
        pp->backlight_locker = 0;
        list_add(&pp->list, &all_pmu_pvt);
        spin_unlock_irqrestore(&all_pvt_lock, flags);
        file->private_data = pp;
 -      unlock_kernel();
 +      mutex_unlock(&pmu_info_proc_mutex);
        return 0;
  }
  
@@@ -2344,9 -2343,9 +2344,9 @@@ static long pmu_unlocked_ioctl(struct f
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&pmu_info_proc_mutex);
        ret = pmu_ioctl(filp, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&pmu_info_proc_mutex);
  
        return ret;
  }
@@@ -2399,6 -2398,7 +2399,7 @@@ static const struct file_operations pmu
  #endif
        .open           = pmu_open,
        .release        = pmu_release,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice pmu_device = {
index e63f757d5d72ca0ba6c1b4e206914c7d7625112a,8a128934e60568829a1a8335cc2b4b1bd93c395b..1983cd3f39945cbbdae6ef3a6b8b6f3618ad1b47
@@@ -235,6 -235,7 +235,7 @@@ static struct file_operations lirc_fop
        .poll           = lirc_dev_fop_poll,
        .open           = lirc_dev_fop_open,
        .release        = lirc_dev_fop_close,
+       .llseek         = no_llseek,
  };
  
  static int ir_lirc_register(struct input_dev *input_dev)
                        features |= LIRC_CAN_SET_SEND_CARRIER;
  
                if (ir_dev->props->s_tx_duty_cycle)
 -                      features |= LIRC_CAN_SET_REC_DUTY_CYCLE;
 +                      features |= LIRC_CAN_SET_SEND_DUTY_CYCLE;
        }
  
        if (ir_dev->props->s_rx_carrier_range)
index d75788b4e22ecec6c3982368db85bdf10f1ee6ec,7ed74dfc6b928d3858b3084a1567a218e5852209..48e48e8af55a0584535804240d0ba7e1f26d1562
@@@ -22,7 -22,7 +22,7 @@@
  #include <linux/module.h>
  #include <linux/slab.h>
  #include <linux/init.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/string.h>
  #include <linux/dvb/ca.h>
  #include "dvbdev.h"
@@@ -52,7 -52,6 +52,7 @@@
  } while(0)
  
  
 +static DEFINE_MUTEX(dst_ca_mutex);
  static unsigned int verbose = 5;
  module_param(verbose, int, 0644);
  MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)");
@@@ -565,7 -564,7 +565,7 @@@ static long dst_ca_ioctl(struct file *f
        void __user *arg = (void __user *)ioctl_arg;
        int result = 0;
  
 -      lock_kernel();
 +      mutex_lock(&dst_ca_mutex);
        dvbdev = file->private_data;
        state = (struct dst_state *)dvbdev->priv;
        p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL);
        kfree (p_ca_slot_info);
        kfree (p_ca_caps);
  
 -      unlock_kernel();
 +      mutex_unlock(&dst_ca_mutex);
        return result;
  }
  
@@@ -695,7 -694,8 +695,8 @@@ static const struct file_operations dst
        .open = dst_ca_open,
        .release = dst_ca_release,
        .read = dst_ca_read,
-       .write = dst_ca_write
+       .write = dst_ca_write,
+       .llseek = noop_llseek,
  };
  
  static struct dvb_device dvbdev_ca = {
index 2de13b04b09d342ca2f1e701ba1c92f51bb89882,75c20ac82c0f3e81b29ac2f0e7564f6d5f603f46..ad1f61d301e1eb9add35fe71930618fba12142b8
@@@ -25,6 -25,7 +25,6 @@@
  #include <linux/slab.h>
  #include <linux/vmalloc.h>
  #include <linux/module.h>
 -#include <linux/smp_lock.h>
  #include <linux/poll.h>
  #include <linux/ioctl.h>
  #include <linux/wait.h>
@@@ -1087,7 -1088,13 +1087,7 @@@ static int dvb_demux_do_ioctl(struct fi
  static long dvb_demux_ioctl(struct file *file, unsigned int cmd,
                            unsigned long arg)
  {
 -      int ret;
 -
 -      lock_kernel();
 -      ret = dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
 -      unlock_kernel();
 -
 -      return ret;
 +      return dvb_usercopy(file, cmd, arg, dvb_demux_do_ioctl);
  }
  
  static unsigned int dvb_demux_poll(struct file *file, poll_table *wait)
@@@ -1143,6 -1150,7 +1143,7 @@@ static const struct file_operations dvb
        .open = dvb_demux_open,
        .release = dvb_demux_release,
        .poll = dvb_demux_poll,
+       .llseek = default_llseek,
  };
  
  static struct dvb_device dvbdev_demux = {
@@@ -1179,7 -1187,13 +1180,7 @@@ static int dvb_dvr_do_ioctl(struct fil
  static long dvb_dvr_ioctl(struct file *file,
                         unsigned int cmd, unsigned long arg)
  {
 -      int ret;
 -
 -      lock_kernel();
 -      ret = dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
 -      unlock_kernel();
 -
 -      return ret;
 +      return dvb_usercopy(file, cmd, arg, dvb_dvr_do_ioctl);
  }
  
  static unsigned int dvb_dvr_poll(struct file *file, poll_table *wait)
@@@ -1212,6 -1226,7 +1213,7 @@@ static const struct file_operations dvb
        .open = dvb_dvr_open,
        .release = dvb_dvr_release,
        .poll = dvb_dvr_poll,
+       .llseek = default_llseek,
  };
  
  static struct dvb_device dvbdev_dvr = {
index 1723a984a522c9993e6b96f38af311fa46d3bae7,ff8921dd737f83d18bcd0fc0602ef39492346670..4d0646da6087b05e02c87767232417c2b1f94d93
@@@ -1259,7 -1259,13 +1259,7 @@@ static int dvb_ca_en50221_io_do_ioctl(s
  static long dvb_ca_en50221_io_ioctl(struct file *file,
                                    unsigned int cmd, unsigned long arg)
  {
 -      int ret;
 -
 -      lock_kernel();
 -      ret = dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
 -      unlock_kernel();
 -
 -      return ret;
 +      return dvb_usercopy(file, cmd, arg, dvb_ca_en50221_io_do_ioctl);
  }
  
  
@@@ -1622,6 -1628,7 +1622,7 @@@ static const struct file_operations dvb
        .open = dvb_ca_en50221_io_open,
        .release = dvb_ca_en50221_io_release,
        .poll = dvb_ca_en50221_io_poll,
+       .llseek = noop_llseek,
  };
  
  static struct dvb_device dvbdev_ca = {
index a08032284cbf62e4b4818ca8fd3c4a5da28c8eac,82636f517b9e8108a04b31f0c63b061ba4de93b7..4df42aaae7f708801663dfc3eea018ee7ed9cfc8
@@@ -59,6 -59,7 +59,6 @@@
  #include <linux/netdevice.h>
  #include <linux/etherdevice.h>
  #include <linux/dvb/net.h>
 -#include <linux/smp_lock.h>
  #include <linux/uio.h>
  #include <asm/uaccess.h>
  #include <linux/crc32.h>
@@@ -1444,7 -1445,13 +1444,7 @@@ static int dvb_net_do_ioctl(struct fil
  static long dvb_net_ioctl(struct file *file,
              unsigned int cmd, unsigned long arg)
  {
 -      int ret;
 -
 -      lock_kernel();
 -      ret = dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
 -      unlock_kernel();
 -
 -      return ret;
 +      return dvb_usercopy(file, cmd, arg, dvb_net_do_ioctl);
  }
  
  static int dvb_net_close(struct inode *inode, struct file *file)
@@@ -1468,6 -1475,7 +1468,7 @@@ static const struct file_operations dvb
        .unlocked_ioctl = dvb_net_ioctl,
        .open = dvb_generic_open,
        .release = dvb_net_close,
+       .llseek = noop_llseek,
  };
  
  static struct dvb_device dvbdev_net = {
index 28f486edcaf0a31be99c78adcdbcbc37e8c824cd,774b40e4f58967cfbbfdd1e0e2d0d8a1c67e3af8..f73287775953599c80062c978d73604b82dc07e0
@@@ -32,9 -32,9 +32,9 @@@
  #include <linux/fs.h>
  #include <linux/cdev.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  #include "dvbdev.h"
  
 +static DEFINE_MUTEX(dvbdev_mutex);
  static int dvbdev_debug;
  
  module_param(dvbdev_debug, int, 0644);
@@@ -68,7 -68,7 +68,7 @@@ static int dvb_device_open(struct inod
  {
        struct dvb_device *dvbdev;
  
 -      lock_kernel();
 +      mutex_lock(&dvbdev_mutex);
        down_read(&minor_rwsem);
        dvbdev = dvb_minors[iminor(inode)];
  
                }
                fops_put(old_fops);
                up_read(&minor_rwsem);
 -              unlock_kernel();
 +              mutex_unlock(&dvbdev_mutex);
                return err;
        }
  fail:
        up_read(&minor_rwsem);
 -      unlock_kernel();
 +      mutex_unlock(&dvbdev_mutex);
        return -ENODEV;
  }
  
@@@ -105,6 -105,7 +105,7 @@@ static const struct file_operations dvb
  {
        .owner =        THIS_MODULE,
        .open =         dvb_device_open,
+       .llseek =       noop_llseek,
  };
  
  static struct cdev dvb_device_cdev;
@@@ -158,6 -159,7 +159,6 @@@ long dvb_generic_ioctl(struct file *fil
                       unsigned int cmd, unsigned long arg)
  {
        struct dvb_device *dvbdev = file->private_data;
 -      int ret;
  
        if (!dvbdev)
                return -ENODEV;
        if (!dvbdev->kernel_ioctl)
                return -EINVAL;
  
 -      lock_kernel();
 -      ret = dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
 -      unlock_kernel();
 -
 -      return ret;
 +      return dvb_usercopy(file, cmd, arg, dvbdev->kernel_ioctl);
  }
  EXPORT_SYMBOL(dvb_generic_ioctl);
  
@@@ -416,10 -422,8 +417,10 @@@ int dvb_usercopy(struct file *file
        }
  
        /* call driver */
 +      mutex_lock(&dvbdev_mutex);
        if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
                err = -EINVAL;
 +      mutex_unlock(&dvbdev_mutex);
  
        if (err < 0)
                goto out;
diff --combined drivers/misc/phantom.c
index 3712e5077e257ff565b2b973f44eb311ad5251eb,6b38b596429440426d3ff7baff966c98e0ec7457..4197a3cb26ba42d674ef7d0935207adee0d70be1
@@@ -24,7 -24,7 +24,7 @@@
  #include <linux/slab.h>
  #include <linux/phantom.h>
  #include <linux/sched.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include <asm/atomic.h>
  #include <asm/io.h>
@@@ -38,7 -38,6 +38,7 @@@
  #define PHB_RUNNING           1
  #define PHB_NOT_OH            2
  
 +static DEFINE_MUTEX(phantom_mutex);
  static struct class *phantom_class;
  static int phantom_major;
  
@@@ -216,17 -215,17 +216,17 @@@ static int phantom_open(struct inode *i
        struct phantom_device *dev = container_of(inode->i_cdev,
                        struct phantom_device, cdev);
  
 -      lock_kernel();
 +      mutex_lock(&phantom_mutex);
        nonseekable_open(inode, file);
  
        if (mutex_lock_interruptible(&dev->open_lock)) {
 -              unlock_kernel();
 +              mutex_unlock(&phantom_mutex);
                return -ERESTARTSYS;
        }
  
        if (dev->opened) {
                mutex_unlock(&dev->open_lock);
 -              unlock_kernel();
 +              mutex_unlock(&phantom_mutex);
                return -EINVAL;
        }
  
        atomic_set(&dev->counter, 0);
        dev->opened++;
        mutex_unlock(&dev->open_lock);
 -      unlock_kernel();
 +      mutex_unlock(&phantom_mutex);
        return 0;
  }
  
@@@ -280,6 -279,7 +280,7 @@@ static const struct file_operations pha
        .unlocked_ioctl = phantom_ioctl,
        .compat_ioctl = phantom_compat_ioctl,
        .poll = phantom_poll,
+       .llseek = no_llseek,
  };
  
  static irqreturn_t phantom_isr(int irq, void *data)
index 736b91703b3e11578eda930e7b119a06f96c0fc6,323e81e9e80849d0bbca3293096e907cf6c75826..4bddb2afdd158aafccca77fa300b6c2743577727
@@@ -856,7 -856,8 +856,8 @@@ static const struct file_operations ppp
        .poll           = ppp_poll,
        .unlocked_ioctl = ppp_ioctl,
        .open           = ppp_open,
-       .release        = ppp_release
+       .release        = ppp_release,
+       .llseek         = noop_llseek,
  };
  
  static __net_init int ppp_init_net(struct net *net)
@@@ -1314,13 -1315,8 +1315,13 @@@ static int ppp_mp_explode(struct ppp *p
        hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN;
        i = 0;
        list_for_each_entry(pch, &ppp->channels, clist) {
 -              navail += pch->avail = (pch->chan != NULL);
 -              pch->speed = pch->chan->speed;
 +              if (pch->chan) {
 +                      pch->avail = 1;
 +                      navail++;
 +                      pch->speed = pch->chan->speed;
 +              } else {
 +                      pch->avail = 0;
 +              }
                if (pch->avail) {
                        if (skb_queue_empty(&pch->file.xq) ||
                                !pch->had_frag) {
index af5b17ce5a15132385de6bf472bc4a36002bfb8b,dab30a8c747033e0682f1feb7751f0b16fc8e089..46da03753fd5ee25874c92752bbc241b0e3a0fef
@@@ -46,6 -46,7 +46,6 @@@
  #include <linux/ethtool.h>
  #include <linux/ieee80211.h>
  
 -#include <pcmcia/cs.h>
  #include <pcmcia/cistpl.h>
  #include <pcmcia/cisreg.h>
  #include <pcmcia/ds.h>
@@@ -168,6 -169,13 +168,6 @@@ static int bc
   */
  static char *phy_addr = NULL;
  
 -
 -/* A struct pcmcia_device structure has fields for most things that are needed
 -   to keep track of a socket, but there will usually be some device
 -   specific information that also needs to be kept track of.  The
 -   'priv' pointer in a struct pcmcia_device structure can be used to point to
 -   a device-specific private data structure, like this.
 -*/
  static unsigned int ray_mem_speed = 500;
  
  /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */
@@@ -282,6 -290,14 +282,6 @@@ static const struct net_device_ops ray_
        .ndo_validate_addr      = eth_validate_addr,
  };
  
 -/*=============================================================================
 -    ray_attach() creates an "instance" of the driver, allocating
 -    local data structures for one device.  The device is registered
 -    with Card Services.
 -    The dev_link structure is initialized, but we don't actually
 -    configure the card at this point -- we wait until we receive a
 -    card insertion event.
 -=============================================================================*/
  static int ray_probe(struct pcmcia_device *p_dev)
  {
        ray_dev_t *local;
        p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
  
        /* General socket configuration */
 -      p_dev->conf.Attributes = CONF_ENABLE_IRQ;
 -      p_dev->conf.IntType = INT_MEMORY_AND_IO;
 -      p_dev->conf.ConfigIndex = 1;
 +      p_dev->config_flags |= CONF_ENABLE_IRQ;
 +      p_dev->config_index = 1;
  
        p_dev->priv = dev;
  
@@@ -336,6 -353,12 +336,6 @@@ fail_alloc_dev
        return -ENOMEM;
  } /* ray_attach */
  
 -/*=============================================================================
 -    This deletes a driver "instance".  The device is de-registered
 -    with Card Services.  If it has been released, all local data
 -    structures are freed.  Otherwise, the structures will be freed
 -    when the device is released.
 -=============================================================================*/
  static void ray_detach(struct pcmcia_device *link)
  {
        struct net_device *dev;
        dev_dbg(&link->dev, "ray_cs ray_detach ending\n");
  } /* ray_detach */
  
 -/*=============================================================================
 -    ray_config() is run after a CARD_INSERTION event
 -    is received, to configure the PCMCIA socket, and to make the
 -    ethernet device available to the system.
 -=============================================================================*/
  #define MAX_TUPLE_SIZE 128
  static int ray_config(struct pcmcia_device *link)
  {
        int ret = 0;
        int i;
 -      win_req_t req;
        struct net_device *dev = (struct net_device *)link->priv;
        ray_dev_t *local = netdev_priv(dev);
  
                goto failed;
        dev->irq = link->irq;
  
 -      /* This actually configures the PCMCIA socket -- setting up
 -         the I/O windows and the interrupt mapping.
 -       */
 -      ret = pcmcia_request_configuration(link, &link->conf);
 +      ret = pcmcia_enable_device(link);
        if (ret)
                goto failed;
  
  /*** Set up 32k window for shared memory (transmit and control) ************/
 -      req.Attributes =
 -          WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
 -      req.Base = 0;
 -      req.Size = 0x8000;
 -      req.AccessSpeed = ray_mem_speed;
 -      ret = pcmcia_request_window(link, &req, &link->win);
 +      link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
 +      link->resource[2]->start = 0;
 +      link->resource[2]->end = 0x8000;
 +      ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed);
        if (ret)
                goto failed;
 -      ret = pcmcia_map_mem_page(link, link->win, 0);
 +      ret = pcmcia_map_mem_page(link, link->resource[2], 0);
        if (ret)
                goto failed;
 -      local->sram = ioremap(req.Base, req.Size);
 +      local->sram = ioremap(link->resource[2]->start,
 +                      resource_size(link->resource[2]));
  
  /*** Set up 16k window for shared memory (receive buffer) ***************/
 -      req.Attributes =
 +      link->resource[3]->flags |=
            WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT;
 -      req.Base = 0;
 -      req.Size = 0x4000;
 -      req.AccessSpeed = ray_mem_speed;
 -      ret = pcmcia_request_window(link, &req, &local->rmem_handle);
 +      link->resource[3]->start = 0;
 +      link->resource[3]->end = 0x4000;
 +      ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed);
        if (ret)
                goto failed;
 -      ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000);
 +      ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000);
        if (ret)
                goto failed;
 -      local->rmem = ioremap(req.Base, req.Size);
 +      local->rmem = ioremap(link->resource[3]->start,
 +                      resource_size(link->resource[3]));
  
  /*** Set up window for attribute memory ***********************************/
 -      req.Attributes =
 +      link->resource[4]->flags |=
            WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT;
 -      req.Base = 0;
 -      req.Size = 0x1000;
 -      req.AccessSpeed = ray_mem_speed;
 -      ret = pcmcia_request_window(link, &req, &local->amem_handle);
 +      link->resource[4]->start = 0;
 +      link->resource[4]->end = 0x1000;
 +      ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed);
        if (ret)
                goto failed;
 -      ret = pcmcia_map_mem_page(link, local->amem_handle, 0);
 +      ret = pcmcia_map_mem_page(link, link->resource[4], 0);
        if (ret)
                goto failed;
 -      local->amem = ioremap(req.Base, req.Size);
 +      local->amem = ioremap(link->resource[4]->start,
 +                      resource_size(link->resource[4]));
  
        dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
        dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
@@@ -742,7 -775,11 +742,7 @@@ static void join_net(u_long data
        local->card_status = CARD_DOING_ACQ;
  }
  
 -/*============================================================================
 -    After a card is removed, ray_release() will unregister the net
 -    device, and release the PCMCIA configuration.  If the device is
 -    still open, this will be postponed until it is closed.
 -=============================================================================*/
 +
  static void ray_release(struct pcmcia_device *link)
  {
        struct net_device *dev = link->priv;
@@@ -2765,6 -2802,7 +2765,7 @@@ static ssize_t ray_cs_essid_proc_write(
  static const struct file_operations ray_cs_essid_proc_fops = {
        .owner          = THIS_MODULE,
        .write          = ray_cs_essid_proc_write,
+       .llseek         = noop_llseek,
  };
  
  static ssize_t int_proc_write(struct file *file, const char __user *buffer,
  static const struct file_operations int_proc_fops = {
        .owner          = THIS_MODULE,
        .write          = int_proc_write,
+       .llseek         = noop_llseek,
  };
  #endif
  
@@@ -2810,7 -2849,9 +2812,7 @@@ MODULE_DEVICE_TABLE(pcmcia, ray_ids)
  
  static struct pcmcia_driver ray_driver = {
        .owner = THIS_MODULE,
 -      .drv = {
 -              .name = "ray_cs",
 -              },
 +      .name = "ray_cs",
        .probe = ray_probe,
        .remove = ray_detach,
        .id_table = ray_ids,
index ccf099e684a46e90e53bcb17ad72536cdc42a4de,9bb4d4bdc237be4b5797e4bcea4bcccf70dbfb04..89f63456646fa4c67b6ee74f7c657917be05a425
@@@ -59,6 -59,7 +59,7 @@@ static ssize_t timeout_write(struct fil
  static const struct file_operations timeout_fops = {
        .read           = timeout_read,
        .write          = timeout_write,
+       .llseek         = default_llseek,
  };
  
  #endif
@@@ -79,24 -80,22 +80,25 @@@ static ssize_t depth_write(struct file 
        if (*offset)
                return -EINVAL;
  
 +      if (!oprofile_ops.backtrace)
 +              return -EINVAL;
 +
        retval = oprofilefs_ulong_from_user(&val, buf, count);
        if (retval)
                return retval;
  
 -      retval = oprofile_set_backtrace(val);
 -
 +      retval = oprofile_set_ulong(&oprofile_backtrace_depth, val);
        if (retval)
                return retval;
 +
        return count;
  }
  
  
  static const struct file_operations depth_fops = {
        .read           = depth_read,
-       .write          = depth_write
+       .write          = depth_write,
+       .llseek         = default_llseek,
  };
  
  
@@@ -108,6 -107,7 +110,7 @@@ static ssize_t pointer_size_read(struc
  
  static const struct file_operations pointer_size_fops = {
        .read           = pointer_size_read,
+       .llseek         = default_llseek,
  };
  
  
@@@ -119,6 -119,7 +122,7 @@@ static ssize_t cpu_type_read(struct fil
  
  static const struct file_operations cpu_type_fops = {
        .read           = cpu_type_read,
+       .llseek         = default_llseek,
  };
  
  
@@@ -154,6 -155,7 +158,7 @@@ static ssize_t enable_write(struct fil
  static const struct file_operations enable_fops = {
        .read           = enable_read,
        .write          = enable_write,
+       .llseek         = default_llseek,
  };
  
  
@@@ -166,6 -168,7 +171,7 @@@ static ssize_t dump_write(struct file *
  
  static const struct file_operations dump_fops = {
        .write          = dump_write,
+       .llseek         = noop_llseek,
  };
  
  void oprofile_create_files(struct super_block *sb, struct dentry *root)
index 1944621930d96fc51a8f0497037b4dac74e0329b,6b6a1f71957d13efab64ce9bd88a19ad2404c9a1..95f711b251adf33a80dd69eab2a6b792a11313ac
@@@ -91,20 -91,16 +91,20 @@@ static ssize_t ulong_read_file(struct f
  
  static ssize_t ulong_write_file(struct file *file, char const __user *buf, size_t count, loff_t *offset)
  {
 -      unsigned long *value = file->private_data;
 +      unsigned long value;
        int retval;
  
        if (*offset)
                return -EINVAL;
  
 -      retval = oprofilefs_ulong_from_user(value, buf, count);
 +      retval = oprofilefs_ulong_from_user(&value, buf, count);
 +      if (retval)
 +              return retval;
  
 +      retval = oprofile_set_ulong(file->private_data, value);
        if (retval)
                return retval;
 +
        return count;
  }
  
@@@ -121,50 -117,61 +121,52 @@@ static const struct file_operations ulo
        .read           = ulong_read_file,
        .write          = ulong_write_file,
        .open           = default_open,
+       .llseek         = default_llseek,
  };
  
  
  static const struct file_operations ulong_ro_fops = {
        .read           = ulong_read_file,
        .open           = default_open,
+       .llseek         = default_llseek,
  };
  
  
 -static struct dentry *__oprofilefs_create_file(struct super_block *sb,
 +static int __oprofilefs_create_file(struct super_block *sb,
        struct dentry *root, char const *name, const struct file_operations *fops,
 -      int perm)
 +      int perm, void *priv)
  {
        struct dentry *dentry;
        struct inode *inode;
  
        dentry = d_alloc_name(root, name);
        if (!dentry)
 -              return NULL;
 +              return -ENOMEM;
        inode = oprofilefs_get_inode(sb, S_IFREG | perm);
        if (!inode) {
                dput(dentry);
 -              return NULL;
 +              return -ENOMEM;
        }
        inode->i_fop = fops;
        d_add(dentry, inode);
 -      return dentry;
 +      dentry->d_inode->i_private = priv;
 +      return 0;
  }
  
  
  int oprofilefs_create_ulong(struct super_block *sb, struct dentry *root,
        char const *name, unsigned long *val)
  {
 -      struct dentry *d = __oprofilefs_create_file(sb, root, name,
 -                                                   &ulong_fops, 0644);
 -      if (!d)
 -              return -EFAULT;
 -
 -      d->d_inode->i_private = val;
 -      return 0;
 +      return __oprofilefs_create_file(sb, root, name,
 +                                      &ulong_fops, 0644, val);
  }
  
  
  int oprofilefs_create_ro_ulong(struct super_block *sb, struct dentry *root,
        char const *name, unsigned long *val)
  {
 -      struct dentry *d = __oprofilefs_create_file(sb, root, name,
 -                                                   &ulong_ro_fops, 0444);
 -      if (!d)
 -              return -EFAULT;
 -
 -      d->d_inode->i_private = val;
 -      return 0;
 +      return __oprofilefs_create_file(sb, root, name,
 +                                      &ulong_ro_fops, 0444, val);
  }
  
  
@@@ -178,28 -185,38 +180,29 @@@ static ssize_t atomic_read_file(struct 
  static const struct file_operations atomic_ro_fops = {
        .read           = atomic_read_file,
        .open           = default_open,
+       .llseek         = default_llseek,
  };
  
  
  int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
        char const *name, atomic_t *val)
  {
 -      struct dentry *d = __oprofilefs_create_file(sb, root, name,
 -                                                   &atomic_ro_fops, 0444);
 -      if (!d)
 -              return -EFAULT;
 -
 -      d->d_inode->i_private = val;
 -      return 0;
 +      return __oprofilefs_create_file(sb, root, name,
 +                                      &atomic_ro_fops, 0444, val);
  }
  
  
  int oprofilefs_create_file(struct super_block *sb, struct dentry *root,
        char const *name, const struct file_operations *fops)
  {
 -      if (!__oprofilefs_create_file(sb, root, name, fops, 0644))
 -              return -EFAULT;
 -      return 0;
 +      return __oprofilefs_create_file(sb, root, name, fops, 0644, NULL);
  }
  
  
  int oprofilefs_create_file_perm(struct super_block *sb, struct dentry *root,
        char const *name, const struct file_operations *fops, int perm)
  {
 -      if (!__oprofilefs_create_file(sb, root, name, fops, perm))
 -              return -EFAULT;
 -      return 0;
 +      return __oprofilefs_create_file(sb, root, name, fops, perm, NULL);
  }
  
  
diff --combined drivers/rtc/rtc-m41t80.c
index 512dca16a42c4446045b8acfbde6a1daa5dc4ea2,ef151ce044303b3e460ad0dc81a6703e282a9571..5a8daa358066a5564f61276fb9e5bccf0a3bf640
@@@ -20,7 -20,7 +20,7 @@@
  #include <linux/module.h>
  #include <linux/rtc.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/string.h>
  #ifdef CONFIG_RTC_DRV_M41T80_WDT
  #include <linux/fs.h>
@@@ -68,7 -68,6 +68,7 @@@
  
  #define DRV_VERSION "0.05"
  
 +static DEFINE_MUTEX(m41t80_rtc_mutex);
  static const struct i2c_device_id m41t80_id[] = {
        { "m41t62", M41T80_FEATURE_SQ | M41T80_FEATURE_SQ_ALT },
        { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD },
@@@ -678,9 -677,9 +678,9 @@@ static long wdt_unlocked_ioctl(struct f
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&m41t80_rtc_mutex);
        ret = wdt_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&m41t80_rtc_mutex);
  
        return ret;
  }
  static int wdt_open(struct inode *inode, struct file *file)
  {
        if (MINOR(inode->i_rdev) == WATCHDOG_MINOR) {
 -              lock_kernel();
 +              mutex_lock(&m41t80_rtc_mutex);
                if (test_and_set_bit(0, &wdt_is_open)) {
 -                      unlock_kernel();
 +                      mutex_unlock(&m41t80_rtc_mutex);
                        return -EBUSY;
                }
                /*
                 *      Activate
                 */
                wdt_is_open = 1;
 -              unlock_kernel();
 +              mutex_unlock(&m41t80_rtc_mutex);
                return nonseekable_open(inode, file);
        }
        return -ENODEV;
@@@ -749,6 -748,7 +749,7 @@@ static const struct file_operations wdt
        .write  = wdt_write,
        .open   = wdt_open,
        .release = wdt_release,
+       .llseek = no_llseek,
  };
  
  static struct miscdevice wdt_dev = {
diff --combined drivers/scsi/3w-9xxx.c
index 09a139f61ca4cf1aed924e08b84cf3ecb8f84c56,67aad69cfbc27e3eccf3c2f3276bab681bd971cb..fcf08b3f52c1f2ee6b514c0b88ad2985c4f814da
@@@ -92,6 -92,7 +92,6 @@@
  #include <linux/pci.h>
  #include <linux/time.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  #include <asm/io.h>
  #include <asm/irq.h>
  
  /* Globals */
  #define TW_DRIVER_VERSION "2.26.02.014"
 +static DEFINE_MUTEX(twa_chrdev_mutex);
  static TW_Device_Extension *twa_device_extension_list[TW_MAX_SLOT];
  static unsigned int twa_device_extension_count;
  static int twa_major = -1;
@@@ -222,7 -222,8 +222,8 @@@ static const struct file_operations twa
        .owner          = THIS_MODULE,
        .unlocked_ioctl = twa_chrdev_ioctl,
        .open           = twa_chrdev_open,
-       .release        = NULL
+       .release        = NULL,
+       .llseek         = noop_llseek,
  };
  
  /* This function will complete an aen request from the isr */
@@@ -658,7 -659,7 +659,7 @@@ static long twa_chrdev_ioctl(struct fil
        int retval = TW_IOCTL_ERROR_OS_EFAULT;
        void __user *argp = (void __user *)arg;
  
 -      lock_kernel();
 +      mutex_lock(&twa_chrdev_mutex);
  
        /* Only let one of these through at a time */
        if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
@@@ -879,7 -880,7 +880,7 @@@ out3
  out2:
        mutex_unlock(&tw_dev->ioctl_lock);
  out:
 -      unlock_kernel();
 +      mutex_unlock(&twa_chrdev_mutex);
        return retval;
  } /* End twa_chrdev_ioctl() */
  
@@@ -890,6 -891,7 +891,6 @@@ static int twa_chrdev_open(struct inod
        unsigned int minor_number;
        int retval = TW_IOCTL_ERROR_OS_ENODEV;
  
 -      cycle_kernel_lock();
        minor_number = iminor(inode);
        if (minor_number >= twa_device_extension_count)
                goto out;
diff --combined drivers/scsi/3w-sas.c
index 7e5f2385e3e6bfad8b19301288bb4185b1169c68,7afac93d889fda72404f8b2962f28c02401c6457..6a95d111d207269a920fc57c8ceee220ac5d42d8
@@@ -64,6 -64,7 +64,6 @@@
  #include <linux/pci.h>
  #include <linux/time.h>
  #include <linux/mutex.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  #include <asm/io.h>
  #include <asm/irq.h>
@@@ -76,7 -77,6 +76,7 @@@
  
  /* Globals */
  #define TW_DRIVER_VERSION "3.26.02.000"
 +static DEFINE_MUTEX(twl_chrdev_mutex);
  static TW_Device_Extension *twl_device_extension_list[TW_MAX_SLOT];
  static unsigned int twl_device_extension_count;
  static int twl_major = -1;
@@@ -764,7 -764,7 +764,7 @@@ static long twl_chrdev_ioctl(struct fil
        int retval = -EFAULT;
        void __user *argp = (void __user *)arg;
  
 -      lock_kernel();
 +      mutex_lock(&twl_chrdev_mutex);
  
        /* Only let one of these through at a time */
        if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
@@@ -861,7 -861,7 +861,7 @@@ out3
  out2:
        mutex_unlock(&tw_dev->ioctl_lock);
  out:
 -      unlock_kernel();
 +      mutex_unlock(&twl_chrdev_mutex);
        return retval;
  } /* End twl_chrdev_ioctl() */
  
@@@ -876,6 -876,7 +876,6 @@@ static int twl_chrdev_open(struct inod
                goto out;
        }
  
 -      cycle_kernel_lock();
        minor_number = iminor(inode);
        if (minor_number >= twl_device_extension_count)
                goto out;
@@@ -889,7 -890,8 +889,8 @@@ static const struct file_operations twl
        .owner          = THIS_MODULE,
        .unlocked_ioctl = twl_chrdev_ioctl,
        .open           = twl_chrdev_open,
-       .release        = NULL
+       .release        = NULL,
+       .llseek         = noop_llseek,
  };
  
  /* This function passes sense data from firmware to scsi layer */
diff --combined drivers/scsi/3w-xxxx.c
index 081c864c11d27bd3df7019ae313c25c52926ba34,5a23373060376f84e6b4202f3700ebcd8ae0ffc8..b1125341f4c89431521f978ca850135603f2c779
  
  #include <linux/module.h>
  #include <linux/reboot.h>
 -#include <linux/smp_lock.h>
  #include <linux/spinlock.h>
  #include <linux/interrupt.h>
  #include <linux/moduleparam.h>
  
  /* Globals */
  #define TW_DRIVER_VERSION "1.26.02.003"
 +static DEFINE_MUTEX(tw_mutex);
  static TW_Device_Extension *tw_device_extension_list[TW_MAX_SLOT];
  static int tw_device_extension_count = 0;
  static int twe_major = -1;
@@@ -900,10 -900,10 +900,10 @@@ static long tw_chrdev_ioctl(struct fil
  
        dprintk(KERN_WARNING "3w-xxxx: tw_chrdev_ioctl()\n");
  
 -      lock_kernel();
 +      mutex_lock(&tw_mutex);
        /* Only let one of these through at a time */
        if (mutex_lock_interruptible(&tw_dev->ioctl_lock)) {
 -              unlock_kernel();
 +              mutex_unlock(&tw_mutex);
                return -EINTR;
        }
  
@@@ -1034,7 -1034,7 +1034,7 @@@ out2
        dma_free_coherent(&tw_dev->tw_pci_dev->dev, data_buffer_length_adjusted+sizeof(TW_New_Ioctl) - 1, cpu_addr, dma_handle);
  out:
        mutex_unlock(&tw_dev->ioctl_lock);
 -      unlock_kernel();
 +      mutex_unlock(&tw_mutex);
        return retval;
  } /* End tw_chrdev_ioctl() */
  
@@@ -1044,6 -1044,7 +1044,6 @@@ static int tw_chrdev_open(struct inode 
  {
        unsigned int minor_number;
  
 -      cycle_kernel_lock();
        dprintk(KERN_WARNING "3w-xxxx: tw_ioctl_open()\n");
  
        minor_number = iminor(inode);
@@@ -1058,7 -1059,8 +1058,8 @@@ static const struct file_operations tw_
        .owner          = THIS_MODULE,
        .unlocked_ioctl = tw_chrdev_ioctl,
        .open           = tw_chrdev_open,
-       .release        = NULL
+       .release        = NULL,
+       .llseek         = noop_llseek,
  };
  
  /* This function will free up device extension resources */
index 6e233362dd7b455bda776cbb32d802e43d8b83b1,13af86eec96e7198c49369373e01d0bc417fc632..dae46d779c7b1c03421af3fa665c6d11979ef76e
@@@ -38,7 -38,7 +38,7 @@@
  #include <linux/moduleparam.h>
  #include <linux/pci.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/spinlock.h>
  #include <linux/syscalls.h>
  #include <linux/delay.h>
@@@ -76,7 -76,6 +76,7 @@@ MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3
  MODULE_LICENSE("GPL");
  MODULE_VERSION(AAC_DRIVER_FULL_VERSION);
  
 +static DEFINE_MUTEX(aac_mutex);
  static LIST_HEAD(aac_devices);
  static int aac_cfg_major = -1;
  char aac_driver_version[] = AAC_DRIVER_FULL_VERSION;
@@@ -679,7 -678,7 +679,7 @@@ static int aac_cfg_open(struct inode *i
        unsigned minor_number = iminor(inode);
        int err = -ENODEV;
  
 -      lock_kernel();  /* BKL pushdown: nothing else protects this list */
 +      mutex_lock(&aac_mutex);  /* BKL pushdown: nothing else protects this list */
        list_for_each_entry(aac, &aac_devices, entry) {
                if (aac->id == minor_number) {
                        file->private_data = aac;
                        break;
                }
        }
 -      unlock_kernel();
 +      mutex_unlock(&aac_mutex);
  
        return err;
  }
@@@ -712,9 -711,9 +712,9 @@@ static long aac_cfg_ioctl(struct file *
        int ret;
        if (!capable(CAP_SYS_RAWIO))
                return -EPERM;
 -      lock_kernel();
 +      mutex_lock(&aac_mutex);
        ret = aac_do_ioctl(file->private_data, cmd, (void __user *)arg);
 -      unlock_kernel();
 +      mutex_unlock(&aac_mutex);
  
        return ret;
  }
  static long aac_compat_do_ioctl(struct aac_dev *dev, unsigned cmd, unsigned long arg)
  {
        long ret;
 -      lock_kernel();
 +      mutex_lock(&aac_mutex);
        switch (cmd) {
        case FSACTL_MINIPORT_REV_CHECK:
        case FSACTL_SENDFIB:
                ret = -ENOIOCTLCMD;
                break;
        }
 -      unlock_kernel();
 +      mutex_unlock(&aac_mutex);
        return ret;
  }
  
@@@ -1040,6 -1039,7 +1040,7 @@@ static const struct file_operations aac
        .compat_ioctl   = aac_compat_cfg_ioctl,
  #endif
        .open           = aac_cfg_open,
+       .llseek         = noop_llseek,
  };
  
  static struct scsi_host_template aac_driver_template = {
diff --combined drivers/scsi/ch.c
index e805c8fda23930938ed4f7c123ca707d97a2dc29,e40c9f7a002a19d12cb24552f885a81598a0009c..a15474eef5f7896fdb6cd5505fb7bf506be75f67
@@@ -22,6 -22,7 +22,6 @@@
  #include <linux/chio.h>                       /* here are all the ioctls */
  #include <linux/mutex.h>
  #include <linux/idr.h>
 -#include <linux/smp_lock.h>
  #include <linux/slab.h>
  
  #include <scsi/scsi.h>
@@@ -43,7 -44,6 +43,7 @@@ MODULE_LICENSE("GPL")
  MODULE_ALIAS_CHARDEV_MAJOR(SCSI_CHANGER_MAJOR);
  MODULE_ALIAS_SCSI_DEVICE(TYPE_MEDIUM_CHANGER);
  
 +static DEFINE_MUTEX(ch_mutex);
  static int init = 1;
  module_param(init, int, 0444);
  MODULE_PARM_DESC(init, \
@@@ -581,19 -581,19 +581,19 @@@ ch_open(struct inode *inode, struct fil
        scsi_changer *ch;
        int minor = iminor(inode);
  
 -      lock_kernel();
 +      mutex_lock(&ch_mutex);
        spin_lock(&ch_index_lock);
        ch = idr_find(&ch_index_idr, minor);
  
        if (NULL == ch || scsi_device_get(ch->device)) {
                spin_unlock(&ch_index_lock);
 -              unlock_kernel();
 +              mutex_unlock(&ch_mutex);
                return -ENXIO;
        }
        spin_unlock(&ch_index_lock);
  
        file->private_data = ch;
 -      unlock_kernel();
 +      mutex_unlock(&ch_mutex);
        return 0;
  }
  
@@@ -981,6 -981,7 +981,7 @@@ static const struct file_operations cha
  #ifdef CONFIG_COMPAT
        .compat_ioctl   = ch_ioctl_compat,
  #endif
+       .llseek         = noop_llseek,
  };
  
  static int __init init_ch_module(void)
diff --combined drivers/scsi/dpt_i2o.c
index 410ac1def8a6650f21ab331276c9c3940905b6f6,7a61206ed1c038ad2e42133b464bd2cd65f724b4..23dec006338512a479e60b5e9d0c5281dde2beca
@@@ -49,6 -49,7 +49,6 @@@ MODULE_DESCRIPTION("Adaptec I2O RAID Dr
  #include <linux/kernel.h>     /* for printk */
  #include <linux/sched.h>
  #include <linux/reboot.h>
 -#include <linux/smp_lock.h>
  #include <linux/spinlock.h>
  #include <linux/dma-mapping.h>
  
@@@ -75,7 -76,6 +75,7 @@@
   * Needed for our management apps
   *============================================================================
   */
 +static DEFINE_MUTEX(adpt_mutex);
  static dpt_sig_S DPTI_sig = {
        {'d', 'P', 't', 'S', 'i', 'G'}, SIG_VERSION,
  #ifdef __i386__
@@@ -126,6 -126,7 +126,7 @@@ static const struct file_operations adp
  #ifdef CONFIG_COMPAT
        .compat_ioctl   = compat_adpt_ioctl,
  #endif
+       .llseek         = noop_llseek,
  };
  
  /* Structures and definitions for synchronous message posting.
@@@ -1732,12 -1733,12 +1733,12 @@@ static int adpt_open(struct inode *inod
        int minor;
        adpt_hba* pHba;
  
 -      lock_kernel();
 +      mutex_lock(&adpt_mutex);
        //TODO check for root access
        //
        minor = iminor(inode);
        if (minor >= hba_count) {
 -              unlock_kernel();
 +              mutex_unlock(&adpt_mutex);
                return -ENXIO;
        }
        mutex_lock(&adpt_configuration_lock);
        }
        if (pHba == NULL) {
                mutex_unlock(&adpt_configuration_lock);
 -              unlock_kernel();
 +              mutex_unlock(&adpt_mutex);
                return -ENXIO;
        }
  
  
        pHba->in_use = 1;
        mutex_unlock(&adpt_configuration_lock);
 -      unlock_kernel();
 +      mutex_unlock(&adpt_mutex);
  
        return 0;
  }
@@@ -2160,9 -2161,9 +2161,9 @@@ static long adpt_unlocked_ioctl(struct 
   
        inode = file->f_dentry->d_inode;
   
 -      lock_kernel();
 +      mutex_lock(&adpt_mutex);
        ret = adpt_ioctl(inode, file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&adpt_mutex);
  
        return ret;
  }
@@@ -2176,7 -2177,7 +2177,7 @@@ static long compat_adpt_ioctl(struct fi
   
        inode = file->f_dentry->d_inode;
   
 -      lock_kernel();
 +      mutex_lock(&adpt_mutex);
   
        switch(cmd) {
                case DPT_SIGNATURE:
                        ret =  -ENOIOCTLCMD;
        }
   
 -      unlock_kernel();
 +      mutex_unlock(&adpt_mutex);
   
        return ret;
  }
diff --combined drivers/scsi/gdth.c
index e927607bbf89ce2b3f0ae4e344160f0b96dfd655,9886586df01fb9c3169ee1410565911dca0ef52b..5a3f93101017b601fe98b2bbf12d9b55fd27152b
  #include <linux/timer.h>
  #include <linux/dma-mapping.h>
  #include <linux/list.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/slab.h>
  
  #ifdef GDTH_RTC
  #include <scsi/scsi_host.h>
  #include "gdth.h"
  
 +static DEFINE_MUTEX(gdth_mutex);
  static void gdth_delay(int milliseconds);
  static void gdth_eval_mapping(u32 size, u32 *cyls, int *heads, int *secs);
  static irqreturn_t gdth_interrupt(int irq, void *dev_id);
@@@ -373,6 -372,7 +373,7 @@@ static const struct file_operations gdt
      .unlocked_ioctl   = gdth_unlocked_ioctl,
      .open    = gdth_open,
      .release = gdth_close,
+     .llseek = noop_llseek,
  };
  
  #include "gdth_proc.h"
@@@ -4043,12 -4043,12 +4044,12 @@@ static int gdth_open(struct inode *inod
  {
      gdth_ha_str *ha;
  
 -    lock_kernel();
 +    mutex_lock(&gdth_mutex);
      list_for_each_entry(ha, &gdth_instances, list) {
          if (!ha->sdev)
              ha->sdev = scsi_get_host_dev(ha->shost);
      }
 -    unlock_kernel();
 +    mutex_unlock(&gdth_mutex);
  
      TRACE(("gdth_open()\n"));
      return 0;
@@@ -4616,9 -4616,9 +4617,9 @@@ static long gdth_unlocked_ioctl(struct 
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&gdth_mutex);
        ret = gdth_ioctl(file, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&gdth_mutex);
  
        return ret;
  }
diff --combined drivers/scsi/megaraid.c
index 4d0cf5cd82cc42602552b70f90549be640109aa9,aac80f7bb999056f5d973092c5ab27927d58cbef..7ceb5cf12c6be3be77ccba93e4a1d550a9d80800
@@@ -46,7 -46,7 +46,7 @@@
  #include <linux/pci.h>
  #include <linux/init.h>
  #include <linux/dma-mapping.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/slab.h>
  #include <scsi/scsicam.h>
  
@@@ -62,7 -62,6 +62,7 @@@ MODULE_DESCRIPTION ("LSI Logic MegaRAI
  MODULE_LICENSE ("GPL");
  MODULE_VERSION(MEGARAID_MODULE_VERSION);
  
 +static DEFINE_MUTEX(megadev_mutex);
  static unsigned int max_cmd_per_lun = DEF_CMD_PER_LUN;
  module_param(max_cmd_per_lun, uint, 0);
  MODULE_PARM_DESC(max_cmd_per_lun, "Maximum number of commands which can be issued to a single LUN (default=DEF_CMD_PER_LUN=63)");
@@@ -102,6 -101,7 +102,7 @@@ static const struct file_operations meg
        .owner          = THIS_MODULE,
        .unlocked_ioctl = megadev_unlocked_ioctl,
        .open           = megadev_open,
+       .llseek         = noop_llseek,
  };
  
  /*
@@@ -3283,6 -3283,7 +3284,6 @@@ mega_init_scb(adapter_t *adapter
  static int
  megadev_open (struct inode *inode, struct file *filep)
  {
 -      cycle_kernel_lock();
        /*
         * Only allow superuser to access private ioctl interface
         */
@@@ -3701,9 -3702,9 +3702,9 @@@ megadev_unlocked_ioctl(struct file *fil
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&megadev_mutex);
        ret = megadev_ioctl(filep, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&megadev_mutex);
  
        return ret;
  }
index 42770a1e7b8a0c2b56e218675dfae6606b42308c,ab801232d77736155c4336a2b2ffa203631260ca..a7008c0c24f9f44ffc5fcb663a2f83ce514b55e4
   */
  #include <linux/sched.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include "megaraid_mm.h"
  
  
  // Entry points for char node driver
 +static DEFINE_MUTEX(mraid_mm_mutex);
  static int mraid_mm_open(struct inode *, struct file *);
  static long mraid_mm_unlocked_ioctl(struct file *, uint, unsigned long);
  
@@@ -76,6 -75,7 +76,7 @@@ static const struct file_operations lsi
        .compat_ioctl = mraid_mm_compat_ioctl,
  #endif
        .owner  = THIS_MODULE,
+       .llseek = noop_llseek,
  };
  
  static struct miscdevice megaraid_mm_dev = {
@@@ -99,6 -99,7 +100,6 @@@ mraid_mm_open(struct inode *inode, stru
         */
        if (!capable(CAP_SYS_ADMIN)) return (-EACCES);
  
 -      cycle_kernel_lock();
        return 0;
  }
  
@@@ -224,9 -225,9 +225,9 @@@ mraid_mm_unlocked_ioctl(struct file *fi
        int err;
  
        /* inconsistant: mraid_mm_compat_ioctl doesn't take the BKL */
 -      lock_kernel();
 +      mutex_lock(&mraid_mm_mutex);
        err = mraid_mm_ioctl(filep, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&mraid_mm_mutex);
  
        return err;
  }
index c4a595d8d23a3cfe78412a70e8c0cc186fb3da8c,209cc87b9a32387382e5661867507835cc8d0a95..51e2579a743a8c0f249577e64e520a014061e1f5
@@@ -33,6 -33,7 +33,6 @@@
  #include <linux/spinlock.h>
  #include <linux/interrupt.h>
  #include <linux/delay.h>
 -#include <linux/smp_lock.h>
  #include <linux/uio.h>
  #include <linux/slab.h>
  #include <asm/uaccess.h>
@@@ -3556,6 -3557,7 +3556,6 @@@ static void megasas_shutdown(struct pci
   */
  static int megasas_mgmt_open(struct inode *inode, struct file *filep)
  {
 -      cycle_kernel_lock();
        /*
         * Allow only those users with admin rights
         */
@@@ -3955,6 -3957,7 +3955,7 @@@ static const struct file_operations meg
  #ifdef CONFIG_COMPAT
        .compat_ioctl = megasas_mgmt_compat_ioctl,
  #endif
+       .llseek = noop_llseek,
  };
  
  /*
index 31cf126ed4409fecca997919989d46f2d07359bf,9a4e584ae3ccf1fb9949ca4fa0fd74362868e275..40cb8aeb21b104303246667ab137d0d4670cada5
@@@ -51,7 -51,7 +51,7 @@@
  #include <linux/types.h>
  #include <linux/pci.h>
  #include <linux/delay.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/compat.h>
  #include <linux/poll.h>
  
@@@ -61,7 -61,6 +61,7 @@@
  #include "mpt2sas_base.h"
  #include "mpt2sas_ctl.h"
  
 +static DEFINE_MUTEX(_ctl_mutex);
  static struct fasync_struct *async_queue;
  static DECLARE_WAIT_QUEUE_HEAD(ctl_poll_wait);
  
@@@ -2239,9 -2238,9 +2239,9 @@@ _ctl_ioctl(struct file *file, unsigned 
  {
        long ret;
  
 -      lock_kernel();
 +      mutex_lock(&_ctl_mutex);
        ret = _ctl_ioctl_main(file, cmd, (void __user *)arg);
 -      unlock_kernel();
 +      mutex_unlock(&_ctl_mutex);
        return ret;
  }
  
@@@ -2310,12 -2309,12 +2310,12 @@@ _ctl_ioctl_compat(struct file *file, un
  {
        long ret;
  
 -      lock_kernel();
 +      mutex_lock(&_ctl_mutex);
        if (cmd == MPT2COMMAND32)
                ret = _ctl_compat_mpt_command(file, cmd, arg);
        else
                ret = _ctl_ioctl_main(file, cmd, (void __user *)arg);
 -      unlock_kernel();
 +      mutex_unlock(&_ctl_mutex);
        return ret;
  }
  #endif
@@@ -2953,6 -2952,7 +2953,7 @@@ static const struct file_operations ctl
  #ifdef CONFIG_COMPAT
        .compat_ioctl = _ctl_ioctl_compat,
  #endif
+       .llseek = noop_llseek,
  };
  
  static struct miscdevice ctl_dev = {
index 02034460babbcfc8644c1589f7bd8607dc079069,bbb02f6e917c550ca8bcc382c33d5fb4ac740b80..0172de19700874280447d563520feea7d901125d
@@@ -22,6 -22,7 +22,6 @@@
  #include <linux/miscdevice.h>
  #include <linux/gfp.h>
  #include <linux/file.h>
 -#include <linux/smp_lock.h>
  #include <net/tcp.h>
  #include <scsi/scsi.h>
  #include <scsi/scsi_cmnd.h>
@@@ -322,6 -323,7 +322,6 @@@ static int tgt_open(struct inode *inode
  {
        tx_ring.tr_idx = rx_ring.tr_idx = 0;
  
 -      cycle_kernel_lock();
        return 0;
  }
  
@@@ -331,6 -333,7 +331,7 @@@ static const struct file_operations tgt
        .poll           = tgt_poll,
        .write          = tgt_write,
        .mmap           = tgt_mmap,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice tgt_miscdev = {
diff --combined drivers/scsi/sg.c
index b5507d59b5a62d17cdedf44f548f0ec5104b42f3,00baea1e2dbf1b973783cf868c3b742d6b23624c..58ec8f4efcc25a53bf262b4898f2da601e965d17
@@@ -49,7 -49,7 +49,7 @@@ static int sg_version_num = 30534;    /* 
  #include <linux/blkdev.h>
  #include <linux/delay.h>
  #include <linux/blktrace_api.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  
  #include "scsi.h"
  #include <scsi/scsi_dbg.h>
@@@ -103,8 -103,6 +103,8 @@@ static int scatter_elem_sz_prev = SG_SC
  static int sg_add(struct device *, struct class_interface *);
  static void sg_remove(struct device *, struct class_interface *);
  
 +static DEFINE_MUTEX(sg_mutex);
 +
  static DEFINE_IDR(sg_index_idr);
  static DEFINE_RWLOCK(sg_index_lock);  /* Also used to lock
                                                           file descriptor list for device */
@@@ -231,7 -229,7 +231,7 @@@ sg_open(struct inode *inode, struct fil
        int res;
        int retval;
  
 -      lock_kernel();
 +      mutex_lock(&sg_mutex);
        nonseekable_open(inode, filp);
        SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
        sdp = sg_get_dev(dev);
@@@ -316,7 -314,7 +316,7 @@@ sdp_put
  sg_put:
        if (sdp)
                sg_put_dev(sdp);
 -      unlock_kernel();
 +      mutex_unlock(&sg_mutex);
        return retval;
  }
  
@@@ -1094,9 -1092,9 +1094,9 @@@ sg_unlocked_ioctl(struct file *filp, un
  {
        int ret;
  
 -      lock_kernel();
 +      mutex_lock(&sg_mutex);
        ret = sg_ioctl(filp, cmd_in, arg);
 -      unlock_kernel();
 +      mutex_unlock(&sg_mutex);
  
        return ret;
  }
@@@ -1353,6 -1351,7 +1353,7 @@@ static const struct file_operations sg_
        .mmap = sg_mmap,
        .release = sg_release,
        .fasync = sg_fasync,
+       .llseek = no_llseek,
  };
  
  static struct class *sg_sysfs_class;
diff --combined drivers/serial/mfd.c
index 5dff45c76d32c5f026dc1ae408166a4f5e9ac6d2,6703f3e802a2d8948d036739f5218d36ceecf3b6..dc0967fb9ea64aadbf36a06f2d253131fb47cb3c
@@@ -27,7 -27,6 +27,7 @@@
  #include <linux/init.h>
  #include <linux/console.h>
  #include <linux/sysrq.h>
 +#include <linux/slab.h>
  #include <linux/serial_reg.h>
  #include <linux/circ_buf.h>
  #include <linux/delay.h>
@@@ -228,12 -227,14 +228,14 @@@ static const struct file_operations por
        .owner          = THIS_MODULE,
        .open           = hsu_show_regs_open,
        .read           = port_show_regs,
+       .llseek         = default_llseek,
  };
  
  static const struct file_operations dma_regs_ops = {
        .owner          = THIS_MODULE,
        .open           = hsu_show_regs_open,
        .read           = dma_show_regs,
+       .llseek         = default_llseek,
  };
  
  static int hsu_debugfs_init(struct hsu_port *hsu)
@@@ -1424,6 -1425,7 +1426,6 @@@ static void hsu_global_init(void
        }
  
        phsu = hsu;
 -
        hsu_debugfs_init(hsu);
        return;
  
@@@ -1435,20 -1437,18 +1437,20 @@@ err_free_region
  
  static void serial_hsu_remove(struct pci_dev *pdev)
  {
 -      struct hsu_port *hsu;
 -      int i;
 +      void *priv = pci_get_drvdata(pdev);
 +      struct uart_hsu_port *up;
  
 -      hsu = pci_get_drvdata(pdev);
 -      if (!hsu)
 +      if (!priv)
                return;
  
 -      for (i = 0; i < 3; i++)
 -              uart_remove_one_port(&serial_hsu_reg, &hsu->port[i].port);
 +      /* For port 0/1/2, priv is the address of uart_hsu_port */
 +      if (pdev->device != 0x081E) {
 +              up = priv;
 +              uart_remove_one_port(&serial_hsu_reg, &up->port);
 +      }
  
        pci_set_drvdata(pdev, NULL);
 -      free_irq(hsu->irq, hsu);
 +      free_irq(pdev->irq, priv);
        pci_disable_device(pdev);
  }
  
diff --combined drivers/spi/dw_spi.c
index 56247853c298aac0de06eae049429ed5581727c4,a32aa66d66bfe2f4e9f3025104dcf5df928afe64..90439314cf673ce19c33747ab4f283f0f3f0bc01
@@@ -131,6 -131,7 +131,7 @@@ static const struct file_operations mrs
        .owner          = THIS_MODULE,
        .open           = spi_show_regs_open,
        .read           = spi_show_regs,
+       .llseek         = default_llseek,
  };
  
  static int mrst_spi_debugfs_init(struct dw_spi *dws)
@@@ -181,6 -182,10 +182,6 @@@ static void flush(struct dw_spi *dws
        wait_till_not_busy(dws);
  }
  
 -static void null_cs_control(u32 command)
 -{
 -}
 -
  static int null_writer(struct dw_spi *dws)
  {
        u8 n_bytes = dws->n_bytes;
@@@ -318,7 -323,7 +319,7 @@@ static void giveback(struct dw_spi *dws
                                        struct spi_transfer,
                                        transfer_list);
  
 -      if (!last_transfer->cs_change)
 +      if (!last_transfer->cs_change && dws->cs_control)
                dws->cs_control(MRST_SPI_DEASSERT);
  
        msg->state = NULL;
@@@ -392,11 -397,6 +393,11 @@@ static irqreturn_t interrupt_transfer(s
  static irqreturn_t dw_spi_irq(int irq, void *dev_id)
  {
        struct dw_spi *dws = dev_id;
 +      u16 irq_status, irq_mask = 0x3f;
 +
 +      irq_status = dw_readw(dws, isr) & irq_mask;
 +      if (!irq_status)
 +              return IRQ_NONE;
  
        if (!dws->cur_msg) {
                spi_mask_intr(dws, SPI_INT_TXEI);
@@@ -545,13 -545,13 +546,13 @@@ static void pump_transfers(unsigned lon
         */
        if (dws->cs_control) {
                if (dws->rx && dws->tx)
 -                      chip->tmode = 0x00;
 +                      chip->tmode = SPI_TMOD_TR;
                else if (dws->rx)
 -                      chip->tmode = 0x02;
 +                      chip->tmode = SPI_TMOD_RO;
                else
 -                      chip->tmode = 0x01;
 +                      chip->tmode = SPI_TMOD_TO;
  
 -              cr0 &= ~(0x3 << SPI_MODE_OFFSET);
 +              cr0 &= ~SPI_TMOD_MASK;
                cr0 |= (chip->tmode << SPI_TMOD_OFFSET);
        }
  
@@@ -700,6 -700,9 +701,6 @@@ static int dw_spi_setup(struct spi_devi
                chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL);
                if (!chip)
                        return -ENOMEM;
 -
 -              chip->cs_control = null_cs_control;
 -              chip->enable_dma = 0;
        }
  
        /*
@@@ -881,7 -884,7 +882,7 @@@ int __devinit dw_spi_add_host(struct dw
        dws->dma_inited = 0;
        dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60);
  
 -      ret = request_irq(dws->irq, dw_spi_irq, 0,
 +      ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED,
                        "dw_spi", dws);
        if (ret < 0) {
                dev_err(&master->dev, "can not get IRQ\n");
diff --combined drivers/telephony/ixj.c
index b1e469983b1dde5d6b2a63f5f80af2015b8113ff,5c6239e5aa2147a61fb4dac69ca78de1b70a0df1..0d236f4bb8c2daf64c8e6b344752f4b71157dbbd
  #include <linux/fs.h>         /* everything... */
  #include <linux/errno.h>      /* error codes */
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/mm.h>
  #include <linux/ioport.h>
  #include <linux/interrupt.h>
  #define TYPE(inode) (iminor(inode) >> 4)
  #define NUM(inode) (iminor(inode) & 0xf)
  
 +static DEFINE_MUTEX(ixj_mutex);
  static int ixjdebug;
  static int hertz = HZ;
  static int samplerate = 100;
@@@ -6656,9 -6655,9 +6656,9 @@@ static long do_ixj_ioctl(struct file *f
  static long ixj_ioctl(struct file *file_p, unsigned int cmd, unsigned long arg)
  {
        long ret;
 -      lock_kernel();
 +      mutex_lock(&ixj_mutex);
        ret = do_ixj_ioctl(file_p, cmd, arg);
 -      unlock_kernel();
 +      mutex_unlock(&ixj_mutex);
        return ret;
  }
  
@@@ -6677,7 -6676,8 +6677,8 @@@ static const struct file_operations ixj
          .poll           = ixj_poll,
          .unlocked_ioctl = ixj_ioctl,
          .release        = ixj_release,
-         .fasync         = ixj_fasync
+         .fasync         = ixj_fasync,
+         .llseek        = default_llseek,
  };
  
  static int ixj_linetest(IXJ *j)
diff --combined drivers/usb/core/file.c
index 1e6ccef2cf0cbd9e817e7045dccfb03918efa9d7,580bcd396839a7b502ab1500e86829ae796b303f..9fe34fb78ef11c4d0dd88065502c6e92cd4398f3
@@@ -59,6 -59,7 +59,7 @@@ static int usb_open(struct inode * inod
  static const struct file_operations usb_fops = {
        .owner =        THIS_MODULE,
        .open =         usb_open,
+       .llseek =       noop_llseek,
  };
  
  static struct usb_class {
@@@ -159,9 -160,9 +160,9 @@@ void usb_major_cleanup(void
  int usb_register_dev(struct usb_interface *intf,
                     struct usb_class_driver *class_driver)
  {
 -      int retval = -EINVAL;
 +      int retval;
        int minor_base = class_driver->minor_base;
 -      int minor = 0;
 +      int minor;
        char name[20];
        char *temp;
  
         */
        minor_base = 0;
  #endif
 -      intf->minor = -1;
 -
 -      dbg ("looking for a minor, starting at %d", minor_base);
  
        if (class_driver->fops == NULL)
 -              goto exit;
 +              return -EINVAL;
 +      if (intf->minor >= 0)
 +              return -EADDRINUSE;
 +
 +      retval = init_usb_class();
 +      if (retval)
 +              return retval;
 +
 +      dev_dbg(&intf->dev, "looking for a minor, starting at %d", minor_base);
  
        down_write(&minor_rwsem);
        for (minor = minor_base; minor < MAX_USB_MINORS; ++minor) {
                        continue;
  
                usb_minors[minor] = class_driver->fops;
 -
 -              retval = 0;
 +              intf->minor = minor;
                break;
        }
        up_write(&minor_rwsem);
 -
 -      if (retval)
 -              goto exit;
 -
 -      retval = init_usb_class();
 -      if (retval)
 -              goto exit;
 -
 -      intf->minor = minor;
 +      if (intf->minor < 0)
 +              return -EXFULL;
  
        /* create a usb class device for this usb interface */
        snprintf(name, sizeof(name), class_driver->name, minor - minor_base);
                                      "%s", temp);
        if (IS_ERR(intf->usb_dev)) {
                down_write(&minor_rwsem);
 -              usb_minors[intf->minor] = NULL;
 +              usb_minors[minor] = NULL;
 +              intf->minor = -1;
                up_write(&minor_rwsem);
                retval = PTR_ERR(intf->usb_dev);
        }
 -exit:
        return retval;
  }
  EXPORT_SYMBOL_GPL(usb_register_dev);
diff --combined drivers/vhost/net.c
index 17927b1f9334ead1e854ed539dea352f8718c589,c8523ce2e4c625c8e3afb20729d7dbd77fc5ec70..861af4a8b79cd0b1968ffa91019934b460b61821
@@@ -127,10 -127,7 +127,10 @@@ static void handle_tx(struct vhost_net 
        size_t len, total_len = 0;
        int err, wmem;
        size_t hdr_size;
 -      struct socket *sock = rcu_dereference(vq->private_data);
 +      struct socket *sock;
 +
 +      sock = rcu_dereference_check(vq->private_data,
 +                                   lockdep_is_held(&vq->mutex));
        if (!sock)
                return;
  
@@@ -246,7 -243,7 +246,7 @@@ static int get_rx_bufs(struct vhost_vir
        int r, nlogs = 0;
  
        while (datalen > 0) {
 -              if (unlikely(headcount >= VHOST_NET_MAX_SG)) {
 +              if (unlikely(seg >= VHOST_NET_MAX_SG)) {
                        r = -ENOBUFS;
                        goto err;
                }
@@@ -585,10 -582,7 +585,10 @@@ static void vhost_net_disable_vq(struc
  static void vhost_net_enable_vq(struct vhost_net *n,
                                struct vhost_virtqueue *vq)
  {
 -      struct socket *sock = vq->private_data;
 +      struct socket *sock;
 +
 +      sock = rcu_dereference_protected(vq->private_data,
 +                                       lockdep_is_held(&vq->mutex));
        if (!sock)
                return;
        if (vq == n->vqs + VHOST_NET_VQ_TX) {
@@@ -604,8 -598,7 +604,8 @@@ static struct socket *vhost_net_stop_vq
        struct socket *sock;
  
        mutex_lock(&vq->mutex);
 -      sock = vq->private_data;
 +      sock = rcu_dereference_protected(vq->private_data,
 +                                       lockdep_is_held(&vq->mutex));
        vhost_net_disable_vq(n, vq);
        rcu_assign_pointer(vq->private_data, NULL);
        mutex_unlock(&vq->mutex);
@@@ -743,8 -736,7 +743,8 @@@ static long vhost_net_set_backend(struc
        }
  
        /* start polling new socket */
 -      oldsock = vq->private_data;
 +      oldsock = rcu_dereference_protected(vq->private_data,
 +                                          lockdep_is_held(&vq->mutex));
        if (sock != oldsock) {
                  vhost_net_disable_vq(n, vq);
                  rcu_assign_pointer(vq->private_data, sock);
@@@ -877,6 -869,7 +877,7 @@@ static const struct file_operations vho
        .compat_ioctl   = vhost_net_compat_ioctl,
  #endif
        .open           = vhost_net_open,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice vhost_net_misc = {
diff --combined drivers/watchdog/cpwd.c
index b7d96e6236a17f929627f8fd714422f3a7c048bd,51ae4e84f4f9efe9bedcdd30a9a090f43b60e35b..eca855a55c0d6abf96096e6b41847c93b06675db
@@@ -25,7 -25,7 +25,7 @@@
  #include <linux/ioport.h>
  #include <linux/timer.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
 +#include <linux/mutex.h>
  #include <linux/io.h>
  #include <linux/of.h>
  #include <linux/of_device.h>
@@@ -89,7 -89,6 +89,7 @@@ struct cpwd 
        } devs[WD_NUMDEVS];
  };
  
 +static DEFINE_MUTEX(cpwd_mutex);
  static struct cpwd *cpwd_device;
  
  /* Sun uses Altera PLD EPF8820ATC144-4
@@@ -369,7 -368,7 +369,7 @@@ static int cpwd_open(struct inode *inod
  {
        struct cpwd *p = cpwd_device;
  
 -      lock_kernel();
 +      mutex_lock(&cpwd_mutex);
        switch (iminor(inode)) {
        case WD0_MINOR:
        case WD1_MINOR:
                break;
  
        default:
 -              unlock_kernel();
 +              mutex_unlock(&cpwd_mutex);
                return -ENODEV;
        }
  
                                IRQF_SHARED, DRIVER_NAME, p)) {
                        printk(KERN_ERR PFX "Cannot register IRQ %d\n",
                                p->irq);
 -                      unlock_kernel();
 +                      mutex_unlock(&cpwd_mutex);
                        return -EBUSY;
                }
                p->initialized = true;
        }
  
 -      unlock_kernel();
 +      mutex_unlock(&cpwd_mutex);
  
        return nonseekable_open(inode, f);
  }
@@@ -483,9 -482,9 +483,9 @@@ static long cpwd_compat_ioctl(struct fi
        case WIOCSTART:
        case WIOCSTOP:
        case WIOCGSTAT:
 -              lock_kernel();
 +              mutex_lock(&cpwd_mutex);
                rval = cpwd_ioctl(file, cmd, arg);
 -              unlock_kernel();
 +              mutex_unlock(&cpwd_mutex);
                break;
  
        /* everything else is handled by the generic compat layer */
@@@ -525,6 -524,7 +525,7 @@@ static const struct file_operations cpw
        .write =                cpwd_write,
        .read =                 cpwd_read,
        .release =              cpwd_release,
+       .llseek =               no_llseek,
  };
  
  static int __devinit cpwd_probe(struct platform_device *op,
diff --combined fs/char_dev.c
index 143d393881cbd86865063649dd9b27773a5dcf57,e4a3318b812ad3c8da8c90ba97b752147d0229bf..e5b9df993b934f0876666f7c50153a467ef7c939
@@@ -40,9 -40,7 +40,9 @@@ struct backing_dev_info directly_mappab
  #endif
                /* permit direct mmap, for read, write or exec */
                BDI_CAP_MAP_DIRECT |
 -              BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP),
 +              BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP |
 +              /* no writeback happens */
 +              BDI_CAP_NO_ACCT_AND_WRITEBACK),
  };
  
  static struct kobj_map *cdev_map;
@@@ -456,6 -454,7 +456,7 @@@ static void cdev_purge(struct cdev *cde
   */
  const struct file_operations def_chr_fops = {
        .open = chrdev_open,
+       .llseek = noop_llseek,
  };
  
  static struct kobject *exact_match(dev_t dev, int *part, void *data)
diff --combined fs/coda/psdev.c
index 116af7546cf0de6ef076e04ad74b4a2e9aa4bade,9fa280bfcffe17f4208b67435f09687ec21bf194..fdc2f3ef7ecd6768d856511fb1cf12e7689282a5
@@@ -184,8 -184,8 +184,8 @@@ static ssize_t coda_psdev_write(struct 
        }
  
        /* adjust outsize. is this useful ?? */
 -        req->uc_outSize = nbytes;     
 -        req->uc_flags |= REQ_WRITE;
 +      req->uc_outSize = nbytes;
 +      req->uc_flags |= CODA_REQ_WRITE;
        count = nbytes;
  
        /* Convert filedescriptor into a file handle */
@@@ -346,6 -346,7 +346,7 @@@ static const struct file_operations cod
        .unlocked_ioctl = coda_psdev_ioctl,
        .open           = coda_psdev_open,
        .release        = coda_psdev_release,
+       .llseek         = noop_llseek,
  };
  
  static int init_coda_psdev(void)
diff --combined fs/ecryptfs/file.c
index 2b9a644b7583e2019a59c110bc84e2c3aaf1fb02,86e9da1c787e72f3e709332042f54dd0ebaf6dc7..91da02987bffef3aa07638d9dd9a8587a7b5a5b2
@@@ -31,6 -31,7 +31,6 @@@
  #include <linux/security.h>
  #include <linux/compat.h>
  #include <linux/fs_stack.h>
 -#include <linux/smp_lock.h>
  #include "ecryptfs_kernel.h"
  
  /**
@@@ -283,9 -284,11 +283,9 @@@ static int ecryptfs_fasync(int fd, stru
        int rc = 0;
        struct file *lower_file = NULL;
  
 -      lock_kernel();
        lower_file = ecryptfs_file_to_lower(file);
        if (lower_file->f_op && lower_file->f_op->fasync)
                rc = lower_file->f_op->fasync(fd, lower_file, flag);
 -      unlock_kernel();
        return rc;
  }
  
@@@ -329,6 -332,7 +329,7 @@@ const struct file_operations ecryptfs_d
        .fsync = ecryptfs_fsync,
        .fasync = ecryptfs_fasync,
        .splice_read = generic_file_splice_read,
+       .llseek = default_llseek,
  };
  
  const struct file_operations ecryptfs_main_fops = {
diff --combined fs/gfs2/file.c
index a51079bd4af1b7f0f2bf5c57675a1b883f762e9e,55d25a68b4961bfc42bd8f1b234c31e96e00052e..aa996471ec5c961d7d94c62c10a20d29ac8e1bbb
@@@ -382,10 -382,8 +382,10 @@@ static int gfs2_page_mkwrite(struct vm_
        rblocks = RES_DINODE + ind_blocks;
        if (gfs2_is_jdata(ip))
                rblocks += data_blocks ? data_blocks : 1;
 -      if (ind_blocks || data_blocks)
 +      if (ind_blocks || data_blocks) {
                rblocks += RES_STATFS + RES_QUOTA;
 +              rblocks += gfs2_rg_blocks(al);
 +      }
        ret = gfs2_trans_begin(sdp, rblocks, 0);
        if (ret)
                goto out_trans_fail;
@@@ -493,7 -491,7 +493,7 @@@ static int gfs2_open(struct inode *inod
                        goto fail;
  
                if (!(file->f_flags & O_LARGEFILE) &&
 -                  ip->i_disksize > MAX_NON_LFS) {
 +                  i_size_read(inode) > MAX_NON_LFS) {
                        error = -EOVERFLOW;
                        goto fail_gunlock;
                }
@@@ -622,8 -620,6 +622,8 @@@ static ssize_t gfs2_file_aio_write(stru
   * cluster; until we do, disable leases (by just returning -EINVAL),
   * unless the administrator has requested purely local locking.
   *
 + * Locking: called under lock_flocks
 + *
   * Returns: errno
   */
  
@@@ -775,6 -771,7 +775,7 @@@ const struct file_operations gfs2_dir_f
        .fsync          = gfs2_fsync,
        .lock           = gfs2_lock,
        .flock          = gfs2_flock,
+       .llseek         = default_llseek,
  };
  
  #endif /* CONFIG_GFS2_FS_LOCKING_DLM */
@@@ -801,5 -798,6 +802,6 @@@ const struct file_operations gfs2_dir_f
        .open           = gfs2_open,
        .release        = gfs2_close,
        .fsync          = gfs2_fsync,
+       .llseek         = default_llseek,
  };
  
diff --combined fs/ocfs2/stack_user.c
index 0e68f542ef2e25330c55ccd26ed43991570f5226,0dbc6dae1de83d043e0d3c153a3c374134cbcf1d..252e7c82f929c203aca6a294d24b49dd17612cee
@@@ -22,6 -22,7 +22,6 @@@
  #include <linux/miscdevice.h>
  #include <linux/mutex.h>
  #include <linux/slab.h>
 -#include <linux/smp_lock.h>
  #include <linux/reboot.h>
  #include <asm/uaccess.h>
  
@@@ -611,10 -612,12 +611,10 @@@ static int ocfs2_control_open(struct in
                return -ENOMEM;
        p->op_this_node = -1;
  
 -      lock_kernel();
        mutex_lock(&ocfs2_control_lock);
        file->private_data = p;
        list_add(&p->op_list, &ocfs2_control_private_list);
        mutex_unlock(&ocfs2_control_lock);
 -      unlock_kernel();
  
        return 0;
  }
@@@ -625,6 -628,7 +625,7 @@@ static const struct file_operations ocf
        .read    = ocfs2_control_read,
        .write   = ocfs2_control_write,
        .owner   = THIS_MODULE,
+       .llseek  = default_llseek,
  };
  
  static struct miscdevice ocfs2_control_device = {
diff --combined fs/proc/base.c
index 8e4addaa542458badbe0e62da644ec1c64194f99,bc307d7a5b7677a3c81845cf5e13ebf5273f1ffe..dc5d5f51f3fe4dc564a19e06cb330d09abc9b6a4
@@@ -1151,6 -1151,7 +1151,7 @@@ static ssize_t oom_score_adj_write(stru
  static const struct file_operations proc_oom_score_adj_operations = {
        .read           = oom_score_adj_read,
        .write          = oom_score_adj_write,
+       .llseek         = default_llseek,
  };
  
  #ifdef CONFIG_AUDITSYSCALL
@@@ -2039,11 -2040,13 +2040,13 @@@ static ssize_t proc_fdinfo_read(struct 
  static const struct file_operations proc_fdinfo_file_operations = {
        .open           = nonseekable_open,
        .read           = proc_fdinfo_read,
+       .llseek         = no_llseek,
  };
  
  static const struct file_operations proc_fd_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_readfd,
+       .llseek         = default_llseek,
  };
  
  /*
@@@ -2112,6 -2115,7 +2115,7 @@@ static int proc_readfdinfo(struct file 
  static const struct file_operations proc_fdinfo_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_readfdinfo,
+       .llseek         = default_llseek,
  };
  
  /*
@@@ -2343,6 -2347,7 +2347,7 @@@ static int proc_attr_dir_readdir(struc
  static const struct file_operations proc_attr_dir_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_attr_dir_readdir,
+       .llseek         = default_llseek,
  };
  
  static struct dentry *proc_attr_dir_lookup(struct inode *dir,
@@@ -2675,7 -2680,7 +2680,7 @@@ static const struct pid_entry tgid_base
        INF("auxv",       S_IRUSR, proc_pid_auxv),
        ONE("status",     S_IRUGO, proc_pid_status),
        ONE("personality", S_IRUSR, proc_pid_personality),
 -      INF("limits",     S_IRUSR, proc_pid_limits),
 +      INF("limits",     S_IRUGO, proc_pid_limits),
  #ifdef CONFIG_SCHED_DEBUG
        REG("sched",      S_IRUGO|S_IWUSR, proc_pid_sched_operations),
  #endif
@@@ -2751,6 -2756,7 +2756,7 @@@ static int proc_tgid_base_readdir(struc
  static const struct file_operations proc_tgid_base_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_tgid_base_readdir,
+       .llseek         = default_llseek,
  };
  
  static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd){
@@@ -3011,7 -3017,7 +3017,7 @@@ static const struct pid_entry tid_base_
        INF("auxv",      S_IRUSR, proc_pid_auxv),
        ONE("status",    S_IRUGO, proc_pid_status),
        ONE("personality", S_IRUSR, proc_pid_personality),
 -      INF("limits",    S_IRUSR, proc_pid_limits),
 +      INF("limits",    S_IRUGO, proc_pid_limits),
  #ifdef CONFIG_SCHED_DEBUG
        REG("sched",     S_IRUGO|S_IWUSR, proc_pid_sched_operations),
  #endif
@@@ -3088,6 -3094,7 +3094,7 @@@ static struct dentry *proc_tid_base_loo
  static const struct file_operations proc_tid_base_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_tid_base_readdir,
+       .llseek         = default_llseek,
  };
  
  static const struct inode_operations proc_tid_base_inode_operations = {
@@@ -3324,4 -3331,5 +3331,5 @@@ static const struct inode_operations pr
  static const struct file_operations proc_task_operations = {
        .read           = generic_read_dir,
        .readdir        = proc_task_readdir,
+       .llseek         = default_llseek,
  };
diff --combined fs/proc/task_mmu.c
index 1dbca4e8cc164d08276d4a1f5a875e7726fc7020,aa56920df3358431f533464901ff272ffc89d0cf..871e25ed006970667229eea95c56342836c53525
@@@ -363,13 -363,13 +363,13 @@@ static int smaps_pte_range(pmd_t *pmd, 
                        mss->referenced += PAGE_SIZE;
                mapcount = page_mapcount(page);
                if (mapcount >= 2) {
 -                      if (pte_dirty(ptent))
 +                      if (pte_dirty(ptent) || PageDirty(page))
                                mss->shared_dirty += PAGE_SIZE;
                        else
                                mss->shared_clean += PAGE_SIZE;
                        mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount;
                } else {
 -                      if (pte_dirty(ptent))
 +                      if (pte_dirty(ptent) || PageDirty(page))
                                mss->private_dirty += PAGE_SIZE;
                        else
                                mss->private_clean += PAGE_SIZE;
@@@ -539,6 -539,7 +539,7 @@@ static ssize_t clear_refs_write(struct 
  
  const struct file_operations proc_clear_refs_operations = {
        .write          = clear_refs_write,
+       .llseek         = noop_llseek,
  };
  
  struct pagemapread {
diff --combined include/linux/fs.h
index 75e27a25c6e3d492ec5c083ad205be490f77bf93,c8effc81f0c99a80d296c092856dc53e4846f900..0a81b87ea15813902fbb64108fa8931ffc80cce0
@@@ -1131,8 -1131,6 +1131,8 @@@ extern int vfs_setlease(struct file *, 
  extern int lease_modify(struct file_lock **, int);
  extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
  extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
 +extern void lock_flocks(void);
 +extern void unlock_flocks(void);
  #else /* !CONFIG_FILE_LOCKING */
  static inline int fcntl_getlk(struct file *file, struct flock __user *user)
  {
@@@ -1275,14 -1273,6 +1275,14 @@@ static inline int lock_may_write(struc
        return 1;
  }
  
 +static inline void lock_flocks(void)
 +{
 +}
 +
 +static inline void unlock_flocks(void)
 +{
 +}
 +
  #endif /* !CONFIG_FILE_LOCKING */
  
  
@@@ -1390,7 -1380,7 +1390,7 @@@ struct super_block 
         * Saved mount options for lazy filesystems using
         * generic_show_options()
         */
 -      char *s_options;
 +      char __rcu *s_options;
  };
  
  extern struct timespec current_fs_time(struct super_block *sb);
@@@ -2384,8 -2374,6 +2384,8 @@@ extern ssize_t simple_write_to_buffer(v
  
  extern int generic_file_fsync(struct file *, int);
  
 +extern int generic_check_addressable(unsigned, u64);
 +
  #ifdef CONFIG_MIGRATION
  extern int buffer_migrate_page(struct address_space *,
                                struct page *, struct page *);
@@@ -2462,6 -2450,7 +2462,7 @@@ static const struct file_operations __f
        .release = simple_attr_release,                                 \
        .read    = simple_attr_read,                                    \
        .write   = simple_attr_write,                                   \
+       .llseek  = generic_file_llseek,                                 \
  };
  
  static inline void __attribute__((format(printf, 1, 2)))
diff --combined kernel/kprobes.c
index ec4210c6501e1b549d18c2a89fa3cbe8725da35b,8b5ff2655ae07ce80f84fec60ec3737a7112ff27..56a891914273319e0e0a69ca911d7824db1341f8
@@@ -47,7 -47,6 +47,7 @@@
  #include <linux/memory.h>
  #include <linux/ftrace.h>
  #include <linux/cpu.h>
 +#include <linux/jump_label.h>
  
  #include <asm-generic/sections.h>
  #include <asm/cacheflush.h>
@@@ -400,7 -399,7 +400,7 @@@ static inline int kprobe_optready(struc
   * Return an optimized kprobe whose optimizing code replaces
   * instructions including addr (exclude breakpoint).
   */
 -struct kprobe *__kprobes get_optimized_kprobe(unsigned long addr)
 +static struct kprobe *__kprobes get_optimized_kprobe(unsigned long addr)
  {
        int i;
        struct kprobe *p = NULL;
@@@ -832,7 -831,6 +832,7 @@@ void __kprobes recycle_rp_inst(struct k
  
  void __kprobes kretprobe_hash_lock(struct task_struct *tsk,
                         struct hlist_head **head, unsigned long *flags)
 +__acquires(hlist_lock)
  {
        unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
        spinlock_t *hlist_lock;
  
  static void __kprobes kretprobe_table_lock(unsigned long hash,
        unsigned long *flags)
 +__acquires(hlist_lock)
  {
        spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
        spin_lock_irqsave(hlist_lock, *flags);
  
  void __kprobes kretprobe_hash_unlock(struct task_struct *tsk,
        unsigned long *flags)
 +__releases(hlist_lock)
  {
        unsigned long hash = hash_ptr(tsk, KPROBE_HASH_BITS);
        spinlock_t *hlist_lock;
        spin_unlock_irqrestore(hlist_lock, *flags);
  }
  
 -void __kprobes kretprobe_table_unlock(unsigned long hash, unsigned long *flags)
 +static void __kprobes kretprobe_table_unlock(unsigned long hash,
 +       unsigned long *flags)
 +__releases(hlist_lock)
  {
        spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
        spin_unlock_irqrestore(hlist_lock, *flags);
@@@ -1147,8 -1141,7 +1147,8 @@@ int __kprobes register_kprobe(struct kp
        preempt_disable();
        if (!kernel_text_address((unsigned long) p->addr) ||
            in_kprobes_functions((unsigned long) p->addr) ||
 -          ftrace_text_reserved(p->addr, p->addr)) {
 +          ftrace_text_reserved(p->addr, p->addr) ||
 +          jump_label_text_reserved(p->addr, p->addr)) {
                preempt_enable();
                return -EINVAL;
        }
@@@ -1346,19 -1339,18 +1346,19 @@@ int __kprobes register_jprobes(struct j
        if (num <= 0)
                return -EINVAL;
        for (i = 0; i < num; i++) {
 -              unsigned long addr;
 +              unsigned long addr, offset;
                jp = jps[i];
                addr = arch_deref_entry_point(jp->entry);
  
 -              if (!kernel_text_address(addr))
 -                      ret = -EINVAL;
 -              else {
 -                      /* Todo: Verify probepoint is a function entry point */
 +              /* Verify probepoint is a function entry point */
 +              if (kallsyms_lookup_size_offset(addr, NULL, &offset) &&
 +                  offset == 0) {
                        jp->kp.pre_handler = setjmp_pre_handler;
                        jp->kp.break_handler = longjmp_break_handler;
                        ret = register_kprobe(&jp->kp);
 -              }
 +              } else
 +                      ret = -EINVAL;
 +
                if (ret < 0) {
                        if (i > 0)
                                unregister_jprobes(jps, i);
@@@ -2000,6 -1992,7 +2000,7 @@@ static ssize_t write_enabled_file_bool(
  static const struct file_operations fops_kp = {
        .read =         read_enabled_file_bool,
        .write =        write_enabled_file_bool,
+       .llseek =       default_llseek,
  };
  
  static int __kprobes debugfs_kprobe_init(void)
diff --combined kernel/trace/blktrace.c
index 5328e8779d4d8658f4215a7e10d47de557f3c7c8,2d5f3a757316b3c0520f4e9f91c064f1067c11a6..bc251ed667248fb8c72a0dd59ddf3a9a42e1c23d
@@@ -23,6 -23,7 +23,6 @@@
  #include <linux/mutex.h>
  #include <linux/slab.h>
  #include <linux/debugfs.h>
 -#include <linux/smp_lock.h>
  #include <linux/time.h>
  #include <linux/uaccess.h>
  
@@@ -325,6 -326,7 +325,7 @@@ static const struct file_operations blk
        .owner =        THIS_MODULE,
        .open =         blk_dropped_open,
        .read =         blk_dropped_read,
+       .llseek =       default_llseek,
  };
  
  static int blk_msg_open(struct inode *inode, struct file *filp)
@@@ -364,6 -366,7 +365,7 @@@ static const struct file_operations blk
        .owner =        THIS_MODULE,
        .open =         blk_msg_open,
        .write =        blk_msg_write,
+       .llseek =       noop_llseek,
  };
  
  /*
@@@ -638,6 -641,7 +640,6 @@@ int blk_trace_ioctl(struct block_devic
        if (!q)
                return -ENXIO;
  
 -      lock_kernel();
        mutex_lock(&bdev->bd_mutex);
  
        switch (cmd) {
        }
  
        mutex_unlock(&bdev->bd_mutex);
 -      unlock_kernel();
        return ret;
  }
  
@@@ -1649,9 -1654,10 +1651,9 @@@ static ssize_t sysfs_blk_trace_attr_sho
        struct block_device *bdev;
        ssize_t ret = -ENXIO;
  
 -      lock_kernel();
        bdev = bdget(part_devt(p));
        if (bdev == NULL)
 -              goto out_unlock_kernel;
 +              goto out;
  
        q = blk_trace_get_queue(bdev);
        if (q == NULL)
@@@ -1679,7 -1685,8 +1681,7 @@@ out_unlock_bdev
        mutex_unlock(&bdev->bd_mutex);
  out_bdput:
        bdput(bdev);
 -out_unlock_kernel:
 -      unlock_kernel();
 +out:
        return ret;
  }
  
@@@ -1709,10 -1716,11 +1711,10 @@@ static ssize_t sysfs_blk_trace_attr_sto
  
        ret = -ENXIO;
  
 -      lock_kernel();
        p = dev_to_part(dev);
        bdev = bdget(part_devt(p));
        if (bdev == NULL)
 -              goto out_unlock_kernel;
 +              goto out;
  
        q = blk_trace_get_queue(bdev);
        if (q == NULL)
@@@ -1747,6 -1755,8 +1749,6 @@@ out_unlock_bdev
        mutex_unlock(&bdev->bd_mutex);
  out_bdput:
        bdput(bdev);
 -out_unlock_kernel:
 -      unlock_kernel();
  out:
        return ret ? ret : count;
  }
diff --combined kernel/trace/ftrace.c
index ebd80d50c474e60fd84fd4a577da69b052fe14eb,5e1ad476309060b6b697b6475f7fc5de96bbc5a2..f3dadae83883e89c7f48439531bfc6ac62c0ea99
@@@ -800,6 -800,7 +800,7 @@@ static const struct file_operations ftr
        .open           = tracing_open_generic,
        .read           = ftrace_profile_read,
        .write          = ftrace_profile_write,
+       .llseek         = default_llseek,
  };
  
  /* used to initialize the real stat files */
@@@ -884,8 -885,10 +885,8 @@@ enum 
        FTRACE_ENABLE_CALLS             = (1 << 0),
        FTRACE_DISABLE_CALLS            = (1 << 1),
        FTRACE_UPDATE_TRACE_FUNC        = (1 << 2),
 -      FTRACE_ENABLE_MCOUNT            = (1 << 3),
 -      FTRACE_DISABLE_MCOUNT           = (1 << 4),
 -      FTRACE_START_FUNC_RET           = (1 << 5),
 -      FTRACE_STOP_FUNC_RET            = (1 << 6),
 +      FTRACE_START_FUNC_RET           = (1 << 3),
 +      FTRACE_STOP_FUNC_RET            = (1 << 4),
  };
  
  static int ftrace_filtered;
@@@ -1224,6 -1227,8 +1225,6 @@@ static void ftrace_shutdown(int command
  
  static void ftrace_startup_sysctl(void)
  {
 -      int command = FTRACE_ENABLE_MCOUNT;
 -
        if (unlikely(ftrace_disabled))
                return;
  
        saved_ftrace_func = NULL;
        /* ftrace_start_up is true if we want ftrace running */
        if (ftrace_start_up)
 -              command |= FTRACE_ENABLE_CALLS;
 -
 -      ftrace_run_update_code(command);
 +              ftrace_run_update_code(FTRACE_ENABLE_CALLS);
  }
  
  static void ftrace_shutdown_sysctl(void)
  {
 -      int command = FTRACE_DISABLE_MCOUNT;
 -
        if (unlikely(ftrace_disabled))
                return;
  
        /* ftrace_start_up is true if ftrace is running */
        if (ftrace_start_up)
 -              command |= FTRACE_DISABLE_CALLS;
 -
 -      ftrace_run_update_code(command);
 +              ftrace_run_update_code(FTRACE_DISABLE_CALLS);
  }
  
  static cycle_t                ftrace_update_time;
@@@ -1358,29 -1369,24 +1359,29 @@@ enum 
  #define FTRACE_BUFF_MAX (KSYM_SYMBOL_LEN+4) /* room for wildcards */
  
  struct ftrace_iterator {
 -      struct ftrace_page      *pg;
 -      int                     hidx;
 -      int                     idx;
 -      unsigned                flags;
 -      struct trace_parser     parser;
 +      loff_t                          pos;
 +      loff_t                          func_pos;
 +      struct ftrace_page              *pg;
 +      struct dyn_ftrace               *func;
 +      struct ftrace_func_probe        *probe;
 +      struct trace_parser             parser;
 +      int                             hidx;
 +      int                             idx;
 +      unsigned                        flags;
  };
  
  static void *
 -t_hash_next(struct seq_file *m, void *v, loff_t *pos)
 +t_hash_next(struct seq_file *m, loff_t *pos)
  {
        struct ftrace_iterator *iter = m->private;
 -      struct hlist_node *hnd = v;
 +      struct hlist_node *hnd = NULL;
        struct hlist_head *hhd;
  
 -      WARN_ON(!(iter->flags & FTRACE_ITER_HASH));
 -
        (*pos)++;
 +      iter->pos = *pos;
  
 +      if (iter->probe)
 +              hnd = &iter->probe->node;
   retry:
        if (iter->hidx >= FTRACE_FUNC_HASHSIZE)
                return NULL;
                }
        }
  
 -      return hnd;
 +      if (WARN_ON_ONCE(!hnd))
 +              return NULL;
 +
 +      iter->probe = hlist_entry(hnd, struct ftrace_func_probe, node);
 +
 +      return iter;
  }
  
  static void *t_hash_start(struct seq_file *m, loff_t *pos)
        void *p = NULL;
        loff_t l;
  
 -      if (!(iter->flags & FTRACE_ITER_HASH))
 -              *pos = 0;
 -
 -      iter->flags |= FTRACE_ITER_HASH;
 +      if (iter->func_pos > *pos)
 +              return NULL;
  
        iter->hidx = 0;
 -      for (l = 0; l <= *pos; ) {
 -              p = t_hash_next(m, p, &l);
 +      for (l = 0; l <= (*pos - iter->func_pos); ) {
 +              p = t_hash_next(m, &l);
                if (!p)
                        break;
        }
 -      return p;
 +      if (!p)
 +              return NULL;
 +
 +      /* Only set this if we have an item */
 +      iter->flags |= FTRACE_ITER_HASH;
 +
 +      return iter;
  }
  
 -static int t_hash_show(struct seq_file *m, void *v)
 +static int
 +t_hash_show(struct seq_file *m, struct ftrace_iterator *iter)
  {
        struct ftrace_func_probe *rec;
 -      struct hlist_node *hnd = v;
  
 -      rec = hlist_entry(hnd, struct ftrace_func_probe, node);
 +      rec = iter->probe;
 +      if (WARN_ON_ONCE(!rec))
 +              return -EIO;
  
        if (rec->ops->print)
                return rec->ops->print(m, rec->ip, rec->ops, rec->data);
@@@ -1463,13 -1458,12 +1464,13 @@@ t_next(struct seq_file *m, void *v, lof
        struct dyn_ftrace *rec = NULL;
  
        if (iter->flags & FTRACE_ITER_HASH)
 -              return t_hash_next(m, v, pos);
 +              return t_hash_next(m, pos);
  
        (*pos)++;
 +      iter->pos = *pos;
  
        if (iter->flags & FTRACE_ITER_PRINTALL)
 -              return NULL;
 +              return t_hash_start(m, pos);
  
   retry:
        if (iter->idx >= iter->pg->index) {
                }
        }
  
 -      return rec;
 +      if (!rec)
 +              return t_hash_start(m, pos);
 +
 +      iter->func_pos = *pos;
 +      iter->func = rec;
 +
 +      return iter;
 +}
 +
 +static void reset_iter_read(struct ftrace_iterator *iter)
 +{
 +      iter->pos = 0;
 +      iter->func_pos = 0;
 +      iter->flags &= ~(FTRACE_ITER_PRINTALL & FTRACE_ITER_HASH);
  }
  
  static void *t_start(struct seq_file *m, loff_t *pos)
        loff_t l;
  
        mutex_lock(&ftrace_lock);
 +      /*
 +       * If an lseek was done, then reset and start from beginning.
 +       */
 +      if (*pos < iter->pos)
 +              reset_iter_read(iter);
 +
        /*
         * For set_ftrace_filter reading, if we have the filter
         * off, we can short cut and just print out that all
        if (iter->flags & FTRACE_ITER_HASH)
                return t_hash_start(m, pos);
  
 +      /*
 +       * Unfortunately, we need to restart at ftrace_pages_start
 +       * every time we let go of the ftrace_mutex. This is because
 +       * those pointers can change without the lock.
 +       */
        iter->pg = ftrace_pages_start;
        iter->idx = 0;
        for (l = 0; l <= *pos; ) {
                        break;
        }
  
 -      if (!p && iter->flags & FTRACE_ITER_FILTER)
 -              return t_hash_start(m, pos);
 +      if (!p) {
 +              if (iter->flags & FTRACE_ITER_FILTER)
 +                      return t_hash_start(m, pos);
  
 -      return p;
 +              return NULL;
 +      }
 +
 +      return iter;
  }
  
  static void t_stop(struct seq_file *m, void *p)
  static int t_show(struct seq_file *m, void *v)
  {
        struct ftrace_iterator *iter = m->private;
 -      struct dyn_ftrace *rec = v;
 +      struct dyn_ftrace *rec;
  
        if (iter->flags & FTRACE_ITER_HASH)
 -              return t_hash_show(m, v);
 +              return t_hash_show(m, iter);
  
        if (iter->flags & FTRACE_ITER_PRINTALL) {
                seq_printf(m, "#### all functions enabled ####\n");
                return 0;
        }
  
 +      rec = iter->func;
 +
        if (!rec)
                return 0;
  
@@@ -1638,8 -1602,8 +1639,8 @@@ ftrace_failures_open(struct inode *inod
  
        ret = ftrace_avail_open(inode, file);
        if (!ret) {
 -              m = (struct seq_file *)file->private_data;
 -              iter = (struct ftrace_iterator *)m->private;
 +              m = file->private_data;
 +              iter = m->private;
                iter->flags = FTRACE_ITER_FAILURES;
        }
  
@@@ -2455,7 -2419,7 +2456,7 @@@ static const struct file_operations ftr
        .open = ftrace_filter_open,
        .read = seq_read,
        .write = ftrace_filter_write,
 -      .llseek = no_llseek,
 +      .llseek = ftrace_regex_lseek,
        .release = ftrace_filter_release,
  };
  
@@@ -2669,6 -2633,7 +2670,7 @@@ static const struct file_operations ftr
        .read           = seq_read,
        .write          = ftrace_graph_write,
        .release        = ftrace_graph_release,
+       .llseek         = seq_lseek,
  };
  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
  
index c5a632a669e1f7a4ebc6a07889ef593265b3d76a,3aea966d16de8c7f81b6fd7536b8a6a353b214fa..c3dab054d18e2ff43b618ad29693351d0accc872
@@@ -405,7 -405,7 +405,7 @@@ static inline int test_time_stamp(u64 d
  #define BUF_MAX_DATA_SIZE (BUF_PAGE_SIZE - (sizeof(u32) * 2))
  
  /* Max number of timestamps that can fit on a page */
 -#define RB_TIMESTAMPS_PER_PAGE        (BUF_PAGE_SIZE / RB_LEN_TIME_STAMP)
 +#define RB_TIMESTAMPS_PER_PAGE        (BUF_PAGE_SIZE / RB_LEN_TIME_EXTEND)
  
  int ring_buffer_print_page_header(struct trace_seq *s)
  {
@@@ -2606,19 -2606,6 +2606,19 @@@ void ring_buffer_record_enable_cpu(stru
  }
  EXPORT_SYMBOL_GPL(ring_buffer_record_enable_cpu);
  
 +/*
 + * The total entries in the ring buffer is the running counter
 + * of entries entered into the ring buffer, minus the sum of
 + * the entries read from the ring buffer and the number of
 + * entries that were overwritten.
 + */
 +static inline unsigned long
 +rb_num_of_entries(struct ring_buffer_per_cpu *cpu_buffer)
 +{
 +      return local_read(&cpu_buffer->entries) -
 +              (local_read(&cpu_buffer->overrun) + cpu_buffer->read);
 +}
 +
  /**
   * ring_buffer_entries_cpu - get the number of entries in a cpu buffer
   * @buffer: The ring buffer
  unsigned long ring_buffer_entries_cpu(struct ring_buffer *buffer, int cpu)
  {
        struct ring_buffer_per_cpu *cpu_buffer;
 -      unsigned long ret;
  
        if (!cpumask_test_cpu(cpu, buffer->cpumask))
                return 0;
  
        cpu_buffer = buffer->buffers[cpu];
 -      ret = (local_read(&cpu_buffer->entries) - local_read(&cpu_buffer->overrun))
 -              - cpu_buffer->read;
  
 -      return ret;
 +      return rb_num_of_entries(cpu_buffer);
  }
  EXPORT_SYMBOL_GPL(ring_buffer_entries_cpu);
  
@@@ -2694,7 -2684,8 +2694,7 @@@ unsigned long ring_buffer_entries(struc
        /* if you care about this being correct, lock the buffer */
        for_each_buffer_cpu(buffer, cpu) {
                cpu_buffer = buffer->buffers[cpu];
 -              entries += (local_read(&cpu_buffer->entries) -
 -                          local_read(&cpu_buffer->overrun)) - cpu_buffer->read;
 +              entries += rb_num_of_entries(cpu_buffer);
        }
  
        return entries;
@@@ -3974,6 -3965,7 +3974,7 @@@ static const struct file_operations rb_
        .open           = tracing_open_generic,
        .read           = rb_simple_read,
        .write          = rb_simple_write,
+       .llseek         = default_llseek,
  };
  
  
index 398c0e8b332c1840e16bc0599c1230f9594d29a2,0369c5e099849ea8961a8bdb5818f3eb739b20ec..0725eeab1937ef24a301f2c0b0404f64ce95e026
@@@ -600,29 -600,21 +600,29 @@@ out
  
  enum {
        FORMAT_HEADER           = 1,
 -      FORMAT_PRINTFMT         = 2,
 +      FORMAT_FIELD_SEPERATOR  = 2,
 +      FORMAT_PRINTFMT         = 3,
  };
  
  static void *f_next(struct seq_file *m, void *v, loff_t *pos)
  {
        struct ftrace_event_call *call = m->private;
        struct ftrace_event_field *field;
 -      struct list_head *head;
 +      struct list_head *common_head = &ftrace_common_fields;
 +      struct list_head *head = trace_get_fields(call);
  
        (*pos)++;
  
        switch ((unsigned long)v) {
        case FORMAT_HEADER:
 -              head = &ftrace_common_fields;
 +              if (unlikely(list_empty(common_head)))
 +                      return NULL;
 +
 +              field = list_entry(common_head->prev,
 +                                 struct ftrace_event_field, link);
 +              return field;
  
 +      case FORMAT_FIELD_SEPERATOR:
                if (unlikely(list_empty(head)))
                        return NULL;
  
                return NULL;
        }
  
 -      head = trace_get_fields(call);
 -
 -      /*
 -       * To separate common fields from event fields, the
 -       * LSB is set on the first event field. Clear it in case.
 -       */
 -      v = (void *)((unsigned long)v & ~1L);
 -
        field = v;
 -      /*
 -       * If this is a common field, and at the end of the list, then
 -       * continue with main list.
 -       */
 -      if (field->link.prev == &ftrace_common_fields) {
 -              if (unlikely(list_empty(head)))
 -                      return NULL;
 -              field = list_entry(head->prev, struct ftrace_event_field, link);
 -              /* Set the LSB to notify f_show to print an extra newline */
 -              field = (struct ftrace_event_field *)
 -                      ((unsigned long)field | 1);
 -              return field;
 -      }
 -
 -      /* If we are done tell f_show to print the format */
 -      if (field->link.prev == head)
 +      if (field->link.prev == common_head)
 +              return (void *)FORMAT_FIELD_SEPERATOR;
 +      else if (field->link.prev == head)
                return (void *)FORMAT_PRINTFMT;
  
        field = list_entry(field->link.prev, struct ftrace_event_field, link);
@@@ -675,16 -688,22 +675,16 @@@ static int f_show(struct seq_file *m, v
                seq_printf(m, "format:\n");
                return 0;
  
 +      case FORMAT_FIELD_SEPERATOR:
 +              seq_putc(m, '\n');
 +              return 0;
 +
        case FORMAT_PRINTFMT:
                seq_printf(m, "\nprint fmt: %s\n",
                           call->print_fmt);
                return 0;
        }
  
 -      /*
 -       * To separate common fields from event fields, the
 -       * LSB is set on the first event field. Clear it and
 -       * print a newline if it is set.
 -       */
 -      if ((unsigned long)v & 1) {
 -              seq_putc(m, '\n');
 -              v = (void *)((unsigned long)v & ~1L);
 -      }
 -
        field = v;
  
        /*
@@@ -932,6 -951,7 +932,7 @@@ static const struct file_operations ftr
        .open = tracing_open_generic,
        .read = event_enable_read,
        .write = event_enable_write,
+       .llseek = default_llseek,
  };
  
  static const struct file_operations ftrace_event_format_fops = {
  static const struct file_operations ftrace_event_id_fops = {
        .open = tracing_open_generic,
        .read = event_id_read,
+       .llseek = default_llseek,
  };
  
  static const struct file_operations ftrace_event_filter_fops = {
        .open = tracing_open_generic,
        .read = event_filter_read,
        .write = event_filter_write,
+       .llseek = default_llseek,
  };
  
  static const struct file_operations ftrace_subsystem_filter_fops = {
        .open = tracing_open_generic,
        .read = subsystem_filter_read,
        .write = subsystem_filter_write,
+       .llseek = default_llseek,
  };
  
  static const struct file_operations ftrace_system_enable_fops = {
        .open = tracing_open_generic,
        .read = system_enable_read,
        .write = system_enable_write,
+       .llseek = default_llseek,
  };
  
  static const struct file_operations ftrace_show_header_fops = {
        .open = tracing_open_generic,
        .read = show_header,
+       .llseek = default_llseek,
  };
  
  static struct dentry *event_trace_events_dir(void)
diff --combined net/sunrpc/cache.c
index 29b11e0650153a2d71d29f89f8e8fa77e1490f16,6bc692582de59087d077eb230f4a7a8466ad433c..7dce81a926c5e000b1444d2909fad940b93d0cf4
@@@ -28,6 -28,7 +28,6 @@@
  #include <linux/workqueue.h>
  #include <linux/mutex.h>
  #include <linux/pagemap.h>
 -#include <linux/smp_lock.h>
  #include <asm/ioctls.h>
  #include <linux/sunrpc/types.h>
  #include <linux/sunrpc/cache.h>
@@@ -1347,10 -1348,15 +1347,10 @@@ static unsigned int cache_poll_procfs(s
  static long cache_ioctl_procfs(struct file *filp,
                               unsigned int cmd, unsigned long arg)
  {
 -      long ret;
        struct inode *inode = filp->f_path.dentry->d_inode;
        struct cache_detail *cd = PDE(inode)->data;
  
 -      lock_kernel();
 -      ret = cache_ioctl(inode, filp, cmd, arg, cd);
 -      unlock_kernel();
 -
 -      return ret;
 +      return cache_ioctl(inode, filp, cmd, arg, cd);
  }
  
  static int cache_open_procfs(struct inode *inode, struct file *filp)
@@@ -1435,6 -1441,7 +1435,7 @@@ static const struct file_operations cac
        .read           = read_flush_procfs,
        .write          = write_flush_procfs,
        .release        = release_flush_procfs,
+       .llseek         = no_llseek,
  };
  
  static void remove_cache_proc_entries(struct cache_detail *cd)
@@@ -1549,8 -1556,13 +1550,8 @@@ static long cache_ioctl_pipefs(struct f
  {
        struct inode *inode = filp->f_dentry->d_inode;
        struct cache_detail *cd = RPC_I(inode)->private;
 -      long ret;
  
 -      lock_kernel();
 -      ret = cache_ioctl(inode, filp, cmd, arg, cd);
 -      unlock_kernel();
 -
 -      return ret;
 +      return cache_ioctl(inode, filp, cmd, arg, cd);
  }
  
  static int cache_open_pipefs(struct inode *inode, struct file *filp)
@@@ -1635,6 -1647,7 +1636,7 @@@ const struct file_operations cache_flus
        .read           = read_flush_pipefs,
        .write          = write_flush_pipefs,
        .release        = release_flush_pipefs,
+       .llseek         = no_llseek,
  };
  
  int sunrpc_cache_register_pipefs(struct dentry *parent,
index 544ff5837cb640623dadd738fe8879d823574eda,a27086d16f05a23b950adea0a987ae47bda1ee54..0848292982a2315f9e491728afe2714ad767bca0
@@@ -29,7 -29,7 +29,7 @@@
   * aa_simple_write_to_buffer - common routine for getting policy from user
   * @op: operation doing the user buffer copy
   * @userbuf: user buffer to copy data from  (NOT NULL)
 - * @alloc_size: size of user buffer
 + * @alloc_size: size of user buffer (REQUIRES: @alloc_size >= @copy_size)
   * @copy_size: size of data to copy from user buffer
   * @pos: position write is at in the file (NOT NULL)
   *
@@@ -42,8 -42,6 +42,8 @@@ static char *aa_simple_write_to_buffer(
  {
        char *data;
  
 +      BUG_ON(copy_size > alloc_size);
 +
        if (*pos != 0)
                /* only writes from pos 0, that is complete writes */
                return ERR_PTR(-ESPIPE);
@@@ -88,7 -86,8 +88,8 @@@ static ssize_t profile_load(struct fil
  }
  
  static const struct file_operations aa_fs_profile_load = {
-       .write = profile_load
+       .write = profile_load,
+       .llseek = default_llseek,
  };
  
  /* .replace file hook fn to load and/or replace policy */
@@@ -109,7 -108,8 +110,8 @@@ static ssize_t profile_replace(struct f
  }
  
  static const struct file_operations aa_fs_profile_replace = {
-       .write = profile_replace
+       .write = profile_replace,
+       .llseek = default_llseek,
  };
  
  /* .remove file hook fn to remove loaded policy */
@@@ -136,7 -136,8 +138,8 @@@ static ssize_t profile_remove(struct fi
  }
  
  static const struct file_operations aa_fs_profile_remove = {
-       .write = profile_remove
+       .write = profile_remove,
+       .llseek = default_llseek,
  };
  
  /** Base file system setup **/
diff --combined virt/kvm/kvm_main.c
index 5186e728c53ed7e27ba6d32df31d37f7aa140ebc,e039f641d66bd6250ec78c157434f7d4f92b3f0f..60e5e4612b0b329fb616564fad02067934e90652
@@@ -1305,6 -1305,7 +1305,7 @@@ static struct file_operations kvm_vcpu_
        .unlocked_ioctl = kvm_vcpu_ioctl,
        .compat_ioctl   = kvm_vcpu_ioctl,
        .mmap           = kvm_vcpu_mmap,
+       .llseek         = noop_llseek,
  };
  
  /*
@@@ -1774,6 -1775,7 +1775,7 @@@ static struct file_operations kvm_vm_fo
        .compat_ioctl   = kvm_vm_compat_ioctl,
  #endif
        .mmap           = kvm_vm_mmap,
+       .llseek         = noop_llseek,
  };
  
  static int kvm_dev_ioctl_create_vm(void)
@@@ -1867,6 -1869,7 +1869,7 @@@ out
  static struct file_operations kvm_chardev_ops = {
        .unlocked_ioctl = kvm_dev_ioctl,
        .compat_ioctl   = kvm_dev_ioctl,
+       .llseek         = noop_llseek,
  };
  
  static struct miscdevice kvm_dev = {
@@@ -1970,12 -1973,10 +1973,12 @@@ static int kvm_cpu_hotplug(struct notif
  
  asmlinkage void kvm_handle_fault_on_reboot(void)
  {
 -      if (kvm_rebooting)
 +      if (kvm_rebooting) {
                /* spin while reset goes on */
 +              local_irq_enable();
                while (true)
                        ;
 +      }
        /* Fault while not rebooting.  We want the trace. */
        BUG();
  }