Skip to content

Commit

Permalink
Merge branch 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/tip/linux-2.6-tip

* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  agp: Remove the BKL from agp_open
  inifiband: Remove BKL from ipath_open()
  mips: Remove BKL from tb0219
  drivers: Remove BKL from scx200_gpio
  drivers: Remove BKL from pc8736x_gpio
  parisc: Remove BKL from eisa_eeprom
  rtc: Remove BKL from efirtc
  input: Remove BKL from hp_sdc_rtc
  hw_random: Remove BKL from core
  macintosh: Remove BKL from ans-lcd
  nvram: Drop the bkl from non-generic nvram_llseek()
  nvram: Drop the bkl from nvram_llseek()
  mem_class: Drop the bkl from memory_open()
  spi: Remove BKL from spidev_open
  drivers: Remove BKL from cs5535_gpio
  drivers: Remove BKL from misc_open
  • Loading branch information
Linus Torvalds committed Dec 9, 2009
2 parents 3b8ecd2 + 55e858c commit 18821b0
Show file tree
Hide file tree
Showing 16 changed files with 52 additions and 98 deletions.
28 changes: 11 additions & 17 deletions drivers/char/agp/frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,25 +676,25 @@ static int agp_open(struct inode *inode, struct file *file)
int minor = iminor(inode);
struct agp_file_private *priv;
struct agp_client *client;
int rc = -ENXIO;

lock_kernel();
mutex_lock(&(agp_fe.agp_mutex));

if (minor != AGPGART_MINOR)
goto err_out;
return -ENXIO;

mutex_lock(&(agp_fe.agp_mutex));

priv = kzalloc(sizeof(struct agp_file_private), GFP_KERNEL);
if (priv == NULL)
goto err_out_nomem;
if (priv == NULL) {
mutex_unlock(&(agp_fe.agp_mutex));
return -ENOMEM;
}

set_bit(AGP_FF_ALLOW_CLIENT, &priv->access_flags);
priv->my_pid = current->pid;

if (capable(CAP_SYS_RAWIO)) {
if (capable(CAP_SYS_RAWIO))
/* Root priv, can be controller */
set_bit(AGP_FF_ALLOW_CONTROLLER, &priv->access_flags);
}

client = agp_find_client_by_pid(current->pid);

if (client != NULL) {
Expand All @@ -704,16 +704,10 @@ static int agp_open(struct inode *inode, struct file *file)
file->private_data = (void *) priv;
agp_insert_file_private(priv);
DBG("private=%p, client=%p", priv, client);
mutex_unlock(&(agp_fe.agp_mutex));
unlock_kernel();
return 0;

err_out_nomem:
rc = -ENOMEM;
err_out:
mutex_unlock(&(agp_fe.agp_mutex));
unlock_kernel();
return rc;

return 0;
}


Expand Down
3 changes: 1 addition & 2 deletions drivers/char/cs5535_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <linux/cdev.h>
#include <linux/ioport.h>
#include <linux/pci.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/io.h>

Expand Down Expand Up @@ -158,7 +158,6 @@ static int cs5535_gpio_open(struct inode *inode, struct file *file)
{
u32 m = iminor(inode);

cycle_kernel_lock();
/* the mask says which pins are usable by this driver */
if ((mask & (1 << m)) == 0)
return -EINVAL;
Expand Down
12 changes: 1 addition & 11 deletions drivers/char/efirtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
* - Add module support
*/


#include <linux/smp_lock.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
Expand Down Expand Up @@ -174,13 +172,12 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
return -EINVAL;

case RTC_RD_TIME:
lock_kernel();
spin_lock_irqsave(&efi_rtc_lock, flags);

status = efi.get_time(&eft, &cap);

spin_unlock_irqrestore(&efi_rtc_lock,flags);
unlock_kernel();

if (status != EFI_SUCCESS) {
/* should never happen */
printk(KERN_ERR "efitime: can't read time\n");
Expand All @@ -202,13 +199,11 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,

convert_to_efi_time(&wtime, &eft);

lock_kernel();
spin_lock_irqsave(&efi_rtc_lock, flags);

status = efi.set_time(&eft);

spin_unlock_irqrestore(&efi_rtc_lock,flags);
unlock_kernel();

return status == EFI_SUCCESS ? 0 : -EINVAL;

Expand All @@ -224,7 +219,6 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,

convert_to_efi_time(&wtime, &eft);

lock_kernel();
spin_lock_irqsave(&efi_rtc_lock, flags);
/*
* XXX Fixme:
Expand All @@ -235,19 +229,16 @@ static long efi_rtc_ioctl(struct file *file, unsigned int cmd,
status = efi.set_wakeup_time((efi_bool_t)enabled, &eft);

spin_unlock_irqrestore(&efi_rtc_lock,flags);
unlock_kernel();

return status == EFI_SUCCESS ? 0 : -EINVAL;

case RTC_WKALM_RD:

lock_kernel();
spin_lock_irqsave(&efi_rtc_lock, flags);

status = efi.get_wakeup_time((efi_bool_t *)&enabled, (efi_bool_t *)&pending, &eft);

spin_unlock_irqrestore(&efi_rtc_lock,flags);
unlock_kernel();

if (status != EFI_SUCCESS) return -EINVAL;

Expand Down Expand Up @@ -277,7 +268,6 @@ static int efi_rtc_open(struct inode *inode, struct file *file)
* We do accept multiple open files at the same time as we
* synchronize on the per call operation.
*/
cycle_kernel_lock();
return 0;
}

Expand Down
9 changes: 3 additions & 6 deletions drivers/char/generic_nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
#ifdef CONFIG_PPC_PMAC
Expand All @@ -32,7 +31,6 @@ static ssize_t nvram_len;

static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
{
lock_kernel();
switch (origin) {
case 1:
offset += file->f_pos;
Expand All @@ -41,12 +39,11 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
offset += nvram_len;
break;
}
if (offset < 0) {
unlock_kernel();
if (offset < 0)
return -EINVAL;
}

file->f_pos = offset;
unlock_kernel();

return file->f_pos;
}

Expand Down
1 change: 0 additions & 1 deletion drivers/char/hw_random/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ static int rng_dev_open(struct inode *inode, struct file *filp)
return -EINVAL;
if (filp->f_mode & FMODE_WRITE)
return -EINVAL;
cycle_kernel_lock();
return 0;
}

Expand Down
17 changes: 5 additions & 12 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <linux/bootmem.h>
#include <linux/splice.h>
#include <linux/pfn.h>
#include <linux/smp_lock.h>

#include <asm/uaccess.h>
#include <asm/io.h>
Expand Down Expand Up @@ -892,29 +891,23 @@ static int memory_open(struct inode *inode, struct file *filp)
{
int minor;
const struct memdev *dev;
int ret = -ENXIO;

lock_kernel();

minor = iminor(inode);
if (minor >= ARRAY_SIZE(devlist))
goto out;
return -ENXIO;

dev = &devlist[minor];
if (!dev->fops)
goto out;
return -ENXIO;

filp->f_op = dev->fops;
if (dev->dev_info)
filp->f_mapping->backing_dev_info = dev->dev_info;

if (dev->fops->open)
ret = dev->fops->open(inode, filp);
else
ret = 0;
out:
unlock_kernel();
return ret;
return dev->fops->open(inode, filp);

return 0;
}

static const struct file_operations memory_fops = {
Expand Down
5 changes: 1 addition & 4 deletions drivers/char/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
#include <linux/device.h>
#include <linux/tty.h>
#include <linux/kmod.h>
#include <linux/smp_lock.h>

/*
* Head entry for the doubly linked miscdevice list
Expand Down Expand Up @@ -118,8 +117,7 @@ static int misc_open(struct inode * inode, struct file * file)
struct miscdevice *c;
int err = -ENODEV;
const struct file_operations *old_fops, *new_fops = NULL;

lock_kernel();

mutex_lock(&misc_mtx);

list_for_each_entry(c, &misc_list, list) {
Expand Down Expand Up @@ -157,7 +155,6 @@ static int misc_open(struct inode * inode, struct file * file)
fops_put(old_fops);
fail:
mutex_unlock(&misc_mtx);
unlock_kernel();
return err;
}

Expand Down
4 changes: 1 addition & 3 deletions drivers/char/nvram.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#define NVRAM_VERSION "1.3"

#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/nvram.h>

#define PC 1
Expand Down Expand Up @@ -214,7 +213,6 @@ void nvram_set_checksum(void)

static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
{
lock_kernel();
switch (origin) {
case 0:
/* nothing to do */
Expand All @@ -226,7 +224,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
offset += NVRAM_BYTES;
break;
}
unlock_kernel();

return (offset >= 0) ? (file->f_pos = offset) : -EINVAL;
}

Expand Down
2 changes: 0 additions & 2 deletions drivers/char/pc8736x_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <linux/mutex.h>
#include <linux/nsc_gpio.h>
#include <linux/platform_device.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>

#define DEVNAME "pc8736x_gpio"
Expand Down Expand Up @@ -223,7 +222,6 @@ static int pc8736x_gpio_open(struct inode *inode, struct file *file)
unsigned m = iminor(inode);
file->private_data = &pc8736x_gpio_ops;

cycle_kernel_lock();
dev_dbg(&pdev->dev, "open %d\n", m);

if (m >= PC8736X_GPIO_CT)
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/scx200_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/io.h>

Expand Down Expand Up @@ -52,7 +51,6 @@ static int scx200_gpio_open(struct inode *inode, struct file *file)
unsigned m = iminor(inode);
file->private_data = &scx200_gpio_ops;

cycle_kernel_lock();
if (m >= MAX_PINS)
return -EINVAL;
return nonseekable_open(inode, file);
Expand Down
6 changes: 1 addition & 5 deletions drivers/char/tb0219.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/smp_lock.h>

#include <asm/io.h>
#include <asm/reboot.h>
Expand All @@ -38,7 +37,7 @@ MODULE_PARM_DESC(major, "Major device number");

static void (*old_machine_restart)(char *command);
static void __iomem *tb0219_base;
static spinlock_t tb0219_lock;
static DEFINE_SPINLOCK(tb0219_lock);

#define tb0219_read(offset) readw(tb0219_base + (offset))
#define tb0219_write(offset, value) writew((value), tb0219_base + (offset))
Expand Down Expand Up @@ -237,7 +236,6 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file)
{
unsigned int minor;

cycle_kernel_lock();
minor = iminor(inode);
switch (minor) {
case 0:
Expand Down Expand Up @@ -306,8 +304,6 @@ static int __devinit tb0219_probe(struct platform_device *dev)
return retval;
}

spin_lock_init(&tb0219_lock);

old_machine_restart = _machine_restart;
_machine_restart = tb0219_restart;

Expand Down
1 change: 0 additions & 1 deletion drivers/infiniband/hw/ipath/ipath_file_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,6 @@ static int find_shared_port(struct file *fp,
static int ipath_open(struct inode *in, struct file *fp)
{
/* The real work is performed later in ipath_assign_port() */
cycle_kernel_lock();
fp->private_data = kzalloc(sizeof(struct ipath_filedata), GFP_KERNEL);
return fp->private_data ? 0 : -ENOMEM;
}
Expand Down
2 changes: 0 additions & 2 deletions drivers/input/misc/hp_sdc_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#include <linux/hp_sdc.h>
#include <linux/errno.h>
#include <linux/smp_lock.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/module.h>
Expand Down Expand Up @@ -409,7 +408,6 @@ static unsigned int hp_sdc_rtc_poll(struct file *file, poll_table *wait)

static int hp_sdc_rtc_open(struct inode *inode, struct file *file)
{
cycle_kernel_lock();
return 0;
}

Expand Down
Loading

0 comments on commit 18821b0

Please sign in to comment.