mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits) IB/umad: BKL is not needed for ib_umad_open() IB/uverbs: BKL is not needed for ib_uverbs_open() bf561-coreb: BKL unneeded for open() Call fasync() functions without the BKL snd/PCM: fasync BKL pushdown ipmi: fasync BKL pushdown ecryptfs: fasync BKL pushdown Bluetooth VHCI: fasync BKL pushdown tty_io: fasync BKL pushdown tun: fasync BKL pushdown i2o: fasync BKL pushdown mpt: fasync BKL pushdown Remove BKL from remote_llseek v2 Make FAT users happier by not deadlocking x86-mce: BKL pushdown vmwatchdog: BKL pushdown vmcp: BKL pushdown via-pmu: BKL pushdown uml-random: BKL pushdown uml-mmapper: BKL pushdown ...
This commit is contained in:
commit
d1794f2c5b
@ -194,6 +194,7 @@ static loff_t coreb_lseek(struct file *file, loff_t offset, int origin)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* No BKL needed here */
|
||||
static int coreb_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
spin_lock_irq(&coreb_lock);
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include "i2c.h"
|
||||
@ -375,10 +376,9 @@ int __init eeprom_init(void)
|
||||
}
|
||||
|
||||
/* Opens the device. */
|
||||
|
||||
static int eeprom_open(struct inode * inode, struct file * file)
|
||||
{
|
||||
|
||||
cycle_kernel_lock();
|
||||
if(iminor(inode) != EEPROM_MINOR_NR)
|
||||
return -ENXIO;
|
||||
if(imajor(inode) != EEPROM_MAJOR_NR)
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/init.h>
|
||||
@ -323,6 +324,7 @@ gpio_open(struct inode *inode, struct file *filp)
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
priv->minor = p;
|
||||
|
||||
/* initialize the io/alarm struct */
|
||||
@ -357,6 +359,7 @@ gpio_open(struct inode *inode, struct file *filp)
|
||||
alarmlist = priv;
|
||||
spin_unlock_irqrestore(&gpio_lock, flags);
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fs.h>
|
||||
@ -566,6 +567,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
|
||||
static int
|
||||
i2c_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/timer.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/dma.h>
|
||||
@ -443,18 +444,21 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
int dev = MINOR(inode->i_rdev);
|
||||
struct sync_port *port;
|
||||
int mode;
|
||||
int err = -EBUSY;
|
||||
|
||||
lock_kernel();
|
||||
DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
|
||||
|
||||
if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled) {
|
||||
DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev));
|
||||
return -ENODEV;
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
port = &ports[dev];
|
||||
/* Allow open this device twice (assuming one reader and one writer) */
|
||||
if (port->busy == 2) {
|
||||
DEBUG(printk(KERN_DEBUG "Device is busy.. \n"));
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
if (port->init_irqs) {
|
||||
if (port->use_dma) {
|
||||
@ -465,14 +469,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[0])) {
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 1 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (request_irq(25, rx_interrupt, 0,
|
||||
"synchronous serial 1 dma rx",
|
||||
&ports[0])) {
|
||||
free_irq(24, &port[0]);
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 1 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (cris_request_dma(8,
|
||||
"synchronous serial 1 dma tr",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -482,7 +486,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 1 "
|
||||
"TX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (cris_request_dma(9,
|
||||
"synchronous serial 1 dma rec",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -493,7 +497,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 1 "
|
||||
"RX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
RESET_DMA(8); WAIT_DMA(8);
|
||||
@ -520,14 +524,14 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[1])) {
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 3 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (request_irq(21, rx_interrupt, 0,
|
||||
"synchronous serial 3 dma rx",
|
||||
&ports[1])) {
|
||||
free_irq(20, &ports[1]);
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 3 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (cris_request_dma(4,
|
||||
"synchronous serial 3 dma tr",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -537,7 +541,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 3 "
|
||||
"TX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (cris_request_dma(5,
|
||||
"synchronous serial 3 dma rec",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -548,7 +552,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial port 3 "
|
||||
"RX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
RESET_DMA(4); WAIT_DMA(4);
|
||||
@ -581,7 +585,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[0])) {
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial manual irq");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
} else if (port == &ports[1]) {
|
||||
if (request_irq(8,
|
||||
@ -591,7 +595,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[1])) {
|
||||
printk(KERN_CRIT "Can't alloc "
|
||||
"sync serial manual irq");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
port->init_irqs = 0;
|
||||
@ -620,7 +624,11 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
*R_IRQ_MASK1_SET = 1 << port->data_avail_bit;
|
||||
DEBUG(printk(KERN_DEBUG "sser%d rec started\n", dev));
|
||||
}
|
||||
return 0;
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sync_serial_release(struct inode *inode, struct file *file)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/stddef.h>
|
||||
|
||||
@ -2302,11 +2303,11 @@ static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int cryptocop_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int p = iminor(inode);
|
||||
|
||||
cycle_kernel_lock();
|
||||
if (p != CRYPTOCOP_MINOR) return -EINVAL;
|
||||
|
||||
filp->private_data = NULL;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/etraxi2c.h>
|
||||
|
||||
@ -636,6 +637,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
|
||||
static int
|
||||
i2c_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/etraxgpio.h>
|
||||
#include <hwregs/reg_map.h>
|
||||
@ -390,6 +391,8 @@ static int gpio_open(struct inode *inode, struct file *filp)
|
||||
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
memset(priv, 0, sizeof(*priv));
|
||||
|
||||
priv->minor = p;
|
||||
@ -412,6 +415,7 @@ static int gpio_open(struct inode *inode, struct file *filp)
|
||||
spin_unlock_irq(&gpio_lock);
|
||||
}
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/etraxgpio.h>
|
||||
#include <hwregs/reg_map.h>
|
||||
@ -426,9 +427,10 @@ gpio_open(struct inode *inode, struct file *filp)
|
||||
return -EINVAL;
|
||||
|
||||
priv = kmalloc(sizeof(struct gpio_private), GFP_KERNEL);
|
||||
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
memset(priv, 0, sizeof(*priv));
|
||||
|
||||
priv->minor = p;
|
||||
@ -449,6 +451,7 @@ gpio_open(struct inode *inode, struct file *filp)
|
||||
alarmlist = priv;
|
||||
spin_unlock_irq(&alarm_lock);
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/major.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/init.h>
|
||||
@ -429,23 +430,26 @@ static inline int sync_data_avail_to_end(struct sync_port *port)
|
||||
static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int dev = iminor(inode);
|
||||
int ret = -EBUSY;
|
||||
sync_port *port;
|
||||
reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
|
||||
reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
|
||||
|
||||
lock_kernel();
|
||||
DEBUG(printk(KERN_DEBUG "Open sync serial port %d\n", dev));
|
||||
|
||||
if (dev < 0 || dev >= NBR_PORTS || !ports[dev].enabled)
|
||||
{
|
||||
DEBUG(printk(KERN_DEBUG "Invalid minor %d\n", dev));
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
port = &ports[dev];
|
||||
/* Allow open this device twice (assuming one reader and one writer) */
|
||||
if (port->busy == 2)
|
||||
{
|
||||
DEBUG(printk(KERN_DEBUG "Device is busy.. \n"));
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
||||
@ -459,7 +463,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
"synchronous serial 0 dma tr",
|
||||
&ports[0])) {
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (request_irq(DMA_IN_INTR_VECT,
|
||||
rx_interrupt,
|
||||
0,
|
||||
@ -467,7 +471,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[0])) {
|
||||
free_irq(DMA_OUT_INTR_VECT, &port[0]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (crisv32_request_dma(OUT_DMA_NBR,
|
||||
"synchronous serial 0 dma tr",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -476,7 +480,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
free_irq(DMA_OUT_INTR_VECT, &port[0]);
|
||||
free_irq(DMA_IN_INTR_VECT, &port[0]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 0 TX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (crisv32_request_dma(IN_DMA_NBR,
|
||||
"synchronous serial 0 dma rec",
|
||||
DMA_VERBOSE_ON_ERROR,
|
||||
@ -486,7 +490,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
free_irq(DMA_OUT_INTR_VECT, &port[0]);
|
||||
free_irq(DMA_IN_INTR_VECT, &port[0]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 1 RX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -499,7 +503,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
"synchronous serial 1 dma tr",
|
||||
&ports[1])) {
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 1 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (request_irq(DMA7_INTR_VECT,
|
||||
rx_interrupt,
|
||||
0,
|
||||
@ -507,7 +511,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
&ports[1])) {
|
||||
free_irq(DMA6_INTR_VECT, &ports[1]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 3 IRQ");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (crisv32_request_dma(
|
||||
SYNC_SER1_TX_DMA_NBR,
|
||||
"synchronous serial 1 dma tr",
|
||||
@ -517,7 +521,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
free_irq(DMA6_INTR_VECT, &ports[1]);
|
||||
free_irq(DMA7_INTR_VECT, &ports[1]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 3 TX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
} else if (crisv32_request_dma(
|
||||
SYNC_SER1_RX_DMA_NBR,
|
||||
"synchronous serial 3 dma rec",
|
||||
@ -528,7 +532,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
free_irq(DMA6_INTR_VECT, &ports[1]);
|
||||
free_irq(DMA7_INTR_VECT, &ports[1]);
|
||||
printk(KERN_CRIT "Can't allocate sync serial port 3 RX DMA channel");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -554,7 +558,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
"synchronous serial manual irq",
|
||||
&ports[0])) {
|
||||
printk("Can't allocate sync serial manual irq");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#ifdef CONFIG_ETRAXFS
|
||||
@ -565,7 +569,7 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
"synchronous serial manual irq",
|
||||
&ports[1])) {
|
||||
printk(KERN_CRIT "Can't allocate sync serial manual irq");
|
||||
return -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -578,7 +582,10 @@ static int sync_serial_open(struct inode *inode, struct file *file)
|
||||
} /* port->init_irqs */
|
||||
|
||||
port->busy++;
|
||||
return 0;
|
||||
ret = 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sync_serial_release(struct inode *inode, struct file *file)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/fcntl.h>
|
||||
@ -140,10 +141,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||
|
||||
static int rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
if(rtc_status)
|
||||
lock_kernel();
|
||||
if(rtc_status) {
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
rtc_status = 1;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/fcntl.h>
|
||||
@ -127,11 +128,14 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||
|
||||
static int rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
if( !atomic_dec_and_test(&rtc_ready) )
|
||||
{
|
||||
atomic_inc( &rtc_ready );
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include "excite_iodev.h"
|
||||
|
||||
@ -110,8 +111,14 @@ static int __exit iodev_remove(struct device *dev)
|
||||
|
||||
static int iodev_open(struct inode *i, struct file *f)
|
||||
{
|
||||
return request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
ret = request_irq(iodev_irq, iodev_irqhdl, IRQF_DISABLED,
|
||||
iodev_name, &miscdev);
|
||||
unlock_kernel();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int iodev_release(struct inode *i, struct file *f)
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/elf.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/moduleloader.h>
|
||||
#include <linux/interrupt.h>
|
||||
@ -392,8 +393,12 @@ out:
|
||||
static int file_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor = iminor(inode);
|
||||
int err;
|
||||
|
||||
return rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
|
||||
lock_kernel();
|
||||
err = rtlx_open(minor, (filp->f_flags & O_NONBLOCK) ? 0 : 1);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
static int file_release(struct inode *inode, struct file *filp)
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/elf.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/moduleloader.h>
|
||||
#include <linux/interrupt.h>
|
||||
@ -1050,17 +1051,20 @@ static int vpe_open(struct inode *inode, struct file *filp)
|
||||
enum vpe_state state;
|
||||
struct vpe_notifications *not;
|
||||
struct vpe *v;
|
||||
int ret;
|
||||
int ret, err = 0;
|
||||
|
||||
lock_kernel();
|
||||
if (minor != iminor(inode)) {
|
||||
/* assume only 1 device at the moment. */
|
||||
printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
|
||||
return -ENODEV;
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((v = get_vpe(tclimit)) == NULL) {
|
||||
printk(KERN_WARNING "VPE loader: unable to get vpe\n");
|
||||
return -ENODEV;
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
state = xchg(&v->state, VPE_STATE_INUSE);
|
||||
@ -1100,6 +1104,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
|
||||
v->shared_ptr = NULL;
|
||||
v->__start = 0;
|
||||
|
||||
out:
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/errno.h>
|
||||
@ -402,18 +403,26 @@ static int sbprof_zbprof_stop(void)
|
||||
static int sbprof_tb_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
int err = 0;
|
||||
|
||||
lock_kernel();
|
||||
minor = iminor(inode);
|
||||
if (minor != 0)
|
||||
return -ENODEV;
|
||||
if (minor != 0) {
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED)
|
||||
return -EBUSY;
|
||||
if (xchg(&sbp.open, SB_OPENING) != SB_CLOSED) {
|
||||
err = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(&sbp, 0, sizeof(struct sbprof_tb));
|
||||
sbp.sbprof_tbbuf = vmalloc(MAX_TBSAMPLE_BYTES);
|
||||
if (!sbp.sbprof_tbbuf)
|
||||
return -ENOMEM;
|
||||
if (!sbp.sbprof_tbbuf) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
memset(sbp.sbprof_tbbuf, 0, MAX_TBSAMPLE_BYTES);
|
||||
init_waitqueue_head(&sbp.tb_sync);
|
||||
init_waitqueue_head(&sbp.tb_read);
|
||||
@ -421,7 +430,9 @@ static int sbprof_tb_open(struct inode *inode, struct file *filp)
|
||||
|
||||
sbp.open = SB_OPEN;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
static int sbprof_tb_release(struct inode *inode, struct file *filp)
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@ -260,13 +261,16 @@ printk("Preparing to start counters\n");
|
||||
*/
|
||||
static int perf_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock(&perf_lock);
|
||||
if (perf_enabled) {
|
||||
spin_unlock(&perf_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
perf_enabled = 1;
|
||||
spin_unlock(&perf_lock);
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
@ -48,6 +49,7 @@ static unsigned char parm_block[32] = {
|
||||
|
||||
static int prng_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/fs.h>
|
||||
@ -32,17 +33,20 @@ static int openCnt;
|
||||
static int gio_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int minor;
|
||||
int ret = -ENOENT;
|
||||
|
||||
lock_kernel();
|
||||
minor = MINOR(inode->i_rdev);
|
||||
if (minor < DEVCOUNT) {
|
||||
if (openCnt > 0) {
|
||||
return -EALREADY;
|
||||
ret = -EALREADY;
|
||||
} else {
|
||||
openCnt++;
|
||||
return 0;
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return -ENOENT;
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int gio_close(struct inode *inode, struct file *filp)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/pm.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
@ -75,6 +76,7 @@ static inline void apc_free(void)
|
||||
|
||||
static int apc_open(struct inode *inode, struct file *f)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/param.h>
|
||||
#include <linux/string.h>
|
||||
@ -1659,10 +1660,14 @@ static int mini_rtc_ioctl(struct inode *inode, struct file *file,
|
||||
|
||||
static int mini_rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (mini_rtc_status & RTC_IS_OPEN)
|
||||
lock_kernel();
|
||||
if (mini_rtc_status & RTC_IS_OPEN) {
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
mini_rtc_status |= RTC_IS_OPEN;
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ static int harddog_open(struct inode *inode, struct file *file)
|
||||
int err = -EBUSY;
|
||||
char *sock = NULL;
|
||||
|
||||
lock_kernel();
|
||||
spin_lock(&lock);
|
||||
if(timer_alive)
|
||||
goto err;
|
||||
@ -82,9 +83,11 @@ static int harddog_open(struct inode *inode, struct file *file)
|
||||
|
||||
timer_alive = 1;
|
||||
spin_unlock(&lock);
|
||||
unlock_kernel();
|
||||
return nonseekable_open(inode, file);
|
||||
err:
|
||||
spin_unlock(&lock);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include "mem_user.h"
|
||||
|
||||
@ -77,6 +78,7 @@ out:
|
||||
|
||||
static int mmapper_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
* of the GNU General Public License, incorporated herein by reference.
|
||||
*/
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/interrupt.h>
|
||||
@ -33,6 +34,8 @@ static DECLARE_WAIT_QUEUE_HEAD(host_read_wait);
|
||||
|
||||
static int rng_dev_open (struct inode *inode, struct file *filp)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
|
||||
/* enforce read-only access to this chrdev */
|
||||
if ((filp->f_mode & FMODE_READ) == 0)
|
||||
return -EINVAL;
|
||||
|
@ -204,6 +204,7 @@
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/poll.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/timer.h>
|
||||
@ -1549,10 +1550,12 @@ static int do_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct apm_user *as;
|
||||
|
||||
lock_kernel();
|
||||
as = kmalloc(sizeof(*as), GFP_KERNEL);
|
||||
if (as == NULL) {
|
||||
printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n",
|
||||
sizeof(*as));
|
||||
unlock_kernel();
|
||||
return -ENOMEM;
|
||||
}
|
||||
as->magic = APM_BIOS_MAGIC;
|
||||
@ -1574,6 +1577,7 @@ static int do_open(struct inode *inode, struct file *filp)
|
||||
user_list = as;
|
||||
spin_unlock(&user_list_lock);
|
||||
filp->private_data = as;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/kallsyms.h>
|
||||
@ -532,10 +533,12 @@ static int open_exclu; /* already open exclusive? */
|
||||
|
||||
static int mce_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock(&mce_state_lock);
|
||||
|
||||
if (open_exclu || (open_count && (file->f_flags & O_EXCL))) {
|
||||
spin_unlock(&mce_state_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@ -544,6 +547,7 @@ static int mce_open(struct inode *inode, struct file *file)
|
||||
open_count++;
|
||||
|
||||
spin_unlock(&mce_state_lock);
|
||||
unlock_kernel();
|
||||
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/smp_lock.h>
|
||||
@ -107,15 +108,23 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
|
||||
|
||||
static int cpuid_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int cpu = iminor(file->f_path.dentry->d_inode);
|
||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
||||
unsigned int cpu;
|
||||
struct cpuinfo_x86 *c;
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
|
||||
if (cpu >= NR_CPUS || !cpu_online(cpu))
|
||||
return -ENXIO; /* No such CPU */
|
||||
cpu = iminor(file->f_path.dentry->d_inode);
|
||||
if (cpu >= NR_CPUS || !cpu_online(cpu)) {
|
||||
ret = -ENXIO; /* No such CPU */
|
||||
goto out;
|
||||
}
|
||||
c = &cpu_data(cpu);
|
||||
if (c->cpuid_level < 0)
|
||||
return -EIO; /* CPUID not supported */
|
||||
|
||||
return 0;
|
||||
ret = -EIO; /* CPUID not supported */
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -76,6 +76,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
@ -423,6 +424,7 @@ out:
|
||||
|
||||
static int microcode_open (struct inode *unused1, struct file *unused2)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
|
||||
}
|
||||
|
||||
|
@ -117,12 +117,20 @@ static int msr_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int cpu = iminor(file->f_path.dentry->d_inode);
|
||||
struct cpuinfo_x86 *c = &cpu_data(cpu);
|
||||
int ret = 0;
|
||||
|
||||
if (cpu >= NR_CPUS || !cpu_online(cpu))
|
||||
return -ENXIO; /* No such CPU */
|
||||
lock_kernel();
|
||||
cpu = iminor(file->f_path.dentry->d_inode);
|
||||
|
||||
if (cpu >= NR_CPUS || !cpu_online(cpu)) {
|
||||
ret = -ENXIO; /* No such CPU */
|
||||
goto out;
|
||||
}
|
||||
c = &cpu_data(cpu);
|
||||
if (!cpu_has(c, X86_FEATURE_MSR))
|
||||
return -EIO; /* MSR not supported */
|
||||
|
||||
ret = -EIO; /* MSR not supported */
|
||||
out:
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <linux/uio.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/bsg.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <scsi/scsi.h>
|
||||
#include <scsi/scsi_ioctl.h>
|
||||
@ -851,7 +852,11 @@ static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file)
|
||||
|
||||
static int bsg_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct bsg_device *bd = bsg_get_device(inode, file);
|
||||
struct bsg_device *bd;
|
||||
|
||||
lock_kernel();
|
||||
bd = bsg_get_device(inode, file);
|
||||
unlock_kernel();
|
||||
|
||||
if (IS_ERR(bd))
|
||||
return PTR_ERR(bd);
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include "aoe.h"
|
||||
|
||||
enum {
|
||||
@ -174,12 +175,16 @@ aoechr_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int n, i;
|
||||
|
||||
lock_kernel();
|
||||
n = iminor(inode);
|
||||
filp->private_data = (void *) (unsigned long) n;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
|
||||
if (chardevs[i].minor == n)
|
||||
if (chardevs[i].minor == n) {
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
unlock_kernel();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -162,6 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
|
||||
#include <linux/pg.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/sched.h> /* current, TASK_* */
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@ -515,12 +516,18 @@ static int pg_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int unit = iminor(inode) & 0x7f;
|
||||
struct pg *dev = &devices[unit];
|
||||
int ret = 0;
|
||||
|
||||
if ((unit >= PG_UNITS) || (!dev->present))
|
||||
return -ENODEV;
|
||||
lock_kernel();
|
||||
if ((unit >= PG_UNITS) || (!dev->present)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (test_and_set_bit(0, &dev->access))
|
||||
return -EBUSY;
|
||||
if (test_and_set_bit(0, &dev->access)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dev->busy) {
|
||||
pg_reset(dev);
|
||||
@ -533,12 +540,15 @@ static int pg_open(struct inode *inode, struct file *file)
|
||||
if (dev->bufptr == NULL) {
|
||||
clear_bit(0, &dev->access);
|
||||
printk("%s: buffer allocation failed\n", dev->name);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
file->private_data = dev;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pg_release(struct inode *inode, struct file *file)
|
||||
|
@ -650,8 +650,11 @@ static int pt_open(struct inode *inode, struct file *file)
|
||||
struct pt_unit *tape = pt + unit;
|
||||
int err;
|
||||
|
||||
if (unit >= PT_UNITS || (!tape->present))
|
||||
lock_kernel();
|
||||
if (unit >= PT_UNITS || (!tape->present)) {
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = -EBUSY;
|
||||
if (!atomic_dec_and_test(&tape->available))
|
||||
@ -678,10 +681,12 @@ static int pt_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
file->private_data = tape;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out:
|
||||
atomic_inc(&tape->available);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/sched.h>
|
||||
@ -263,9 +264,11 @@ static int vhci_open(struct inode *inode, struct file *file)
|
||||
skb_queue_head_init(&data->readq);
|
||||
init_waitqueue_head(&data->read_wait);
|
||||
|
||||
lock_kernel();
|
||||
hdev = hci_alloc_dev();
|
||||
if (!hdev) {
|
||||
kfree(data);
|
||||
unlock_kernel();
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -286,10 +289,12 @@ static int vhci_open(struct inode *inode, struct file *file)
|
||||
BT_ERR("Can't register HCI device");
|
||||
kfree(data);
|
||||
hci_free_dev(hdev);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
file->private_data = data;
|
||||
unlock_kernel();
|
||||
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
@ -313,18 +318,21 @@ static int vhci_release(struct inode *inode, struct file *file)
|
||||
static int vhci_fasync(int fd, struct file *file, int on)
|
||||
{
|
||||
struct vhci_data *data = file->private_data;
|
||||
int err;
|
||||
int err = 0;
|
||||
|
||||
lock_kernel();
|
||||
err = fasync_helper(fd, file, on, &data->fasync);
|
||||
if (err < 0)
|
||||
return err;
|
||||
goto out;
|
||||
|
||||
if (on)
|
||||
data->flags |= VHCI_FASYNC;
|
||||
else
|
||||
data->flags &= ~VHCI_FASYNC;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
static const struct file_operations vhci_fops = {
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
#include "agp.h"
|
||||
@ -677,6 +678,7 @@ static int agp_open(struct inode *inode, struct file *file)
|
||||
struct agp_client *client;
|
||||
int rc = -ENXIO;
|
||||
|
||||
lock_kernel();
|
||||
mutex_lock(&(agp_fe.agp_mutex));
|
||||
|
||||
if (minor != AGPGART_MINOR)
|
||||
@ -703,12 +705,14 @@ static int agp_open(struct inode *inode, struct file *file)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/miscdevice.h>
|
||||
@ -416,6 +417,7 @@ static int apm_open(struct inode * inode, struct file * filp)
|
||||
{
|
||||
struct apm_user *as;
|
||||
|
||||
lock_kernel();
|
||||
as = kzalloc(sizeof(*as), GFP_KERNEL);
|
||||
if (as) {
|
||||
/*
|
||||
@ -435,6 +437,7 @@ static int apm_open(struct inode * inode, struct file * filp)
|
||||
|
||||
filp->private_data = as;
|
||||
}
|
||||
unlock_kernel();
|
||||
|
||||
return as ? 0 : -ENOMEM;
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/tty.h>
|
||||
@ -67,11 +68,15 @@ static void set_led(char state)
|
||||
|
||||
static int briq_panel_open(struct inode *ino, struct file *filep)
|
||||
{
|
||||
/* enforce single access */
|
||||
if (vfd_is_open)
|
||||
lock_kernel();
|
||||
/* enforce single access, vfd_is_open is protected by BKL */
|
||||
if (vfd_is_open) {
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
vfd_is_open = 1;
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -17,6 +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>
|
||||
|
||||
@ -157,6 +158,7 @@ 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;
|
||||
|
@ -27,6 +27,7 @@
|
||||
* option) any later version.
|
||||
*/
|
||||
#include <linux/ds1286.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
@ -252,6 +253,7 @@ static int ds1286_ioctl(struct inode *inode, struct file *file,
|
||||
|
||||
static int ds1286_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock_irq(&ds1286_lock);
|
||||
|
||||
if (ds1286_status & RTC_IS_OPEN)
|
||||
@ -260,10 +262,12 @@ static int ds1286_open(struct inode *inode, struct file *file)
|
||||
ds1286_status |= RTC_IS_OPEN;
|
||||
|
||||
spin_unlock_irq(&ds1286_lock);
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out_busy:
|
||||
spin_lock_irq(&ds1286_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
@ -208,6 +209,12 @@ static void ds1620_read_state(struct therm *therm)
|
||||
therm->hi = cvt_9_to_int(ds1620_in(THERM_READ_TH, 9));
|
||||
}
|
||||
|
||||
static int ds1620_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
||||
static ssize_t
|
||||
ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
|
||||
{
|
||||
@ -336,7 +343,7 @@ static struct proc_dir_entry *proc_therm_ds1620;
|
||||
|
||||
static const struct file_operations ds1620_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = nonseekable_open,
|
||||
.open = ds1620_open,
|
||||
.read = ds1620_read,
|
||||
.ioctl = ds1620_ioctl,
|
||||
};
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/atarihw.h>
|
||||
#include <asm/traps.h>
|
||||
@ -436,13 +437,17 @@ static unsigned int dsp56k_poll(struct file *file, poll_table *wait)
|
||||
static int dsp56k_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int dev = iminor(inode) & 0x0f;
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
switch(dev)
|
||||
{
|
||||
case DSP56K_DEV_56001:
|
||||
|
||||
if (test_and_set_bit(0, &dsp56k.in_use))
|
||||
return -EBUSY;
|
||||
if (test_and_set_bit(0, &dsp56k.in_use)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
dsp56k.timeout = TIMEOUT;
|
||||
dsp56k.maxio = MAXIO;
|
||||
@ -458,10 +463,11 @@ static int dsp56k_open(struct inode *inode, struct file *file)
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENODEV;
|
||||
ret = -ENODEV;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int dsp56k_release(struct inode *inode, struct file *file)
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include <linux/errno.h> /* for -EBUSY */
|
||||
#include <linux/ioport.h> /* for request_region */
|
||||
#include <linux/delay.h> /* for loops_per_jiffy */
|
||||
#include <linux/smp_lock.h> /* cycle_kernel_lock() */
|
||||
#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 */
|
||||
@ -288,10 +289,12 @@ static int dtlk_ioctl(struct inode *inode,
|
||||
}
|
||||
}
|
||||
|
||||
/* Note that nobody ever sets dtlk_busy... */
|
||||
static int dtlk_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
TRACE_TEXT("(dtlk_open");
|
||||
|
||||
cycle_kernel_lock();
|
||||
nonseekable_open(inode, file);
|
||||
switch (iminor(inode)) {
|
||||
case DTLK_MINOR:
|
||||
|
@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/miscdevice.h>
|
||||
@ -272,6 +273,7 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@ -338,12 +339,16 @@ static int gen_rtc_ioctl(struct inode *inode, struct file *file,
|
||||
|
||||
static int gen_rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (gen_rtc_status & RTC_IS_OPEN)
|
||||
lock_kernel();
|
||||
if (gen_rtc_status & RTC_IS_OPEN) {
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
gen_rtc_status |= RTC_IS_OPEN;
|
||||
gen_rtc_irq_data = 0;
|
||||
irq_active = 0;
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/major.h>
|
||||
@ -193,6 +194,7 @@ static int hpet_open(struct inode *inode, struct file *file)
|
||||
if (file->f_mode & FMODE_WRITE)
|
||||
return -EINVAL;
|
||||
|
||||
lock_kernel();
|
||||
spin_lock_irq(&hpet_lock);
|
||||
|
||||
for (devp = NULL, hpetp = hpets; hpetp && !devp; hpetp = hpetp->hp_next)
|
||||
@ -207,6 +209,7 @@ static int hpet_open(struct inode *inode, struct file *file)
|
||||
|
||||
if (!devp) {
|
||||
spin_unlock_irq(&hpet_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@ -214,6 +217,7 @@ static int hpet_open(struct inode *inode, struct file *file)
|
||||
devp->hd_irqdata = 0;
|
||||
devp->hd_flags |= HPET_OPEN;
|
||||
spin_unlock_irq(&hpet_lock);
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@ -86,6 +87,7 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -98,6 +98,7 @@
|
||||
#include <linux/major.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <linux/tty.h>
|
||||
#include <linux/tty_flip.h>
|
||||
@ -2908,42 +2909,11 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg )
|
||||
static int
|
||||
ip2_ipl_open( struct inode *pInode, struct file *pFile )
|
||||
{
|
||||
unsigned int iplminor = iminor(pInode);
|
||||
i2eBordStrPtr pB;
|
||||
i2ChanStrPtr pCh;
|
||||
|
||||
#ifdef IP2DEBUG_IPL
|
||||
printk (KERN_DEBUG "IP2IPL: open\n" );
|
||||
#endif
|
||||
|
||||
switch(iplminor) {
|
||||
// These are the IPL devices
|
||||
case 0:
|
||||
case 4:
|
||||
case 8:
|
||||
case 12:
|
||||
break;
|
||||
|
||||
// These are the status devices
|
||||
case 1:
|
||||
case 5:
|
||||
case 9:
|
||||
case 13:
|
||||
break;
|
||||
|
||||
// These are the debug devices
|
||||
case 2:
|
||||
case 6:
|
||||
case 10:
|
||||
case 14:
|
||||
pB = i2BoardPtrTable[iplminor / 4];
|
||||
pCh = (i2ChanStrPtr) pB->i2eChannelPtr;
|
||||
break;
|
||||
|
||||
// This is the trace device
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <linux/bcd.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/ioport.h>
|
||||
@ -163,15 +164,18 @@ static long rtc_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
|
||||
static int rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock_irq(&rtc_lock);
|
||||
|
||||
if (rtc_status & RTC_IS_OPEN) {
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
rtc_status |= RTC_IS_OPEN;
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
struct ipmi_file_private
|
||||
{
|
||||
@ -100,7 +101,9 @@ static int ipmi_fasync(int fd, struct file *file, int on)
|
||||
struct ipmi_file_private *priv = file->private_data;
|
||||
int result;
|
||||
|
||||
lock_kernel(); /* could race against open() otherwise */
|
||||
result = fasync_helper(fd, file, on, &priv->fasync_queue);
|
||||
unlock_kernel();
|
||||
|
||||
return (result);
|
||||
}
|
||||
@ -121,6 +124,7 @@ static int ipmi_open(struct inode *inode, struct file *file)
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
priv->file = file;
|
||||
|
||||
rv = ipmi_create_user(if_num,
|
||||
@ -129,7 +133,7 @@ static int ipmi_open(struct inode *inode, struct file *file)
|
||||
&(priv->user));
|
||||
if (rv) {
|
||||
kfree(priv);
|
||||
return rv;
|
||||
goto out;
|
||||
}
|
||||
|
||||
file->private_data = priv;
|
||||
@ -144,7 +148,9 @@ static int ipmi_open(struct inode *inode, struct file *file)
|
||||
priv->default_retries = -1;
|
||||
priv->default_retry_time_ms = 0;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int ipmi_release(struct inode *inode, struct file *file)
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/ipmi.h>
|
||||
#include <linux/ipmi_smi.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/watchdog.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/init.h>
|
||||
@ -818,6 +819,8 @@ static int ipmi_open(struct inode *ino, struct file *filep)
|
||||
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
|
||||
* first heartbeat.
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <linux/mc146818rtc.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
@ -414,6 +415,8 @@ static int lcd_ioctl(struct inode *inode, struct file *file,
|
||||
|
||||
static int lcd_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
|
||||
if (!lcd_present)
|
||||
return -ENXIO;
|
||||
else
|
||||
|
@ -126,6 +126,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <linux/parport.h>
|
||||
#undef LP_STATS
|
||||
@ -489,14 +490,21 @@ static ssize_t lp_read(struct file * file, char __user * buf,
|
||||
static int lp_open(struct inode * inode, struct file * file)
|
||||
{
|
||||
unsigned int minor = iminor(inode);
|
||||
int ret = 0;
|
||||
|
||||
if (minor >= LP_NO)
|
||||
return -ENXIO;
|
||||
if ((LP_F(minor) & LP_EXIST) == 0)
|
||||
return -ENXIO;
|
||||
if (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor)))
|
||||
return -EBUSY;
|
||||
|
||||
lock_kernel();
|
||||
if (minor >= LP_NO) {
|
||||
ret = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
if ((LP_F(minor) & LP_EXIST) == 0) {
|
||||
ret = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
if (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor))) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
/* If ABORTOPEN is set and the printer is offline or out of paper,
|
||||
we may still want to open it to perform ioctl()s. Therefore we
|
||||
have commandeered O_NONBLOCK, even though it is being used in
|
||||
@ -510,21 +518,25 @@ static int lp_open(struct inode * inode, struct file * file)
|
||||
if (status & LP_POUTPA) {
|
||||
printk(KERN_INFO "lp%d out of paper\n", minor);
|
||||
LP_F(minor) &= ~LP_BUSY;
|
||||
return -ENOSPC;
|
||||
ret = -ENOSPC;
|
||||
goto out;
|
||||
} else if (!(status & LP_PSELECD)) {
|
||||
printk(KERN_INFO "lp%d off-line\n", minor);
|
||||
LP_F(minor) &= ~LP_BUSY;
|
||||
return -EIO;
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
} else if (!(status & LP_PERRORP)) {
|
||||
printk(KERN_ERR "lp%d printer error\n", minor);
|
||||
LP_F(minor) &= ~LP_BUSY;
|
||||
return -EIO;
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
lp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL);
|
||||
if (!lp_table[minor].lp_buffer) {
|
||||
LP_F(minor) &= ~LP_BUSY;
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
/* Determine if the peripheral supports ECP mode */
|
||||
lp_claim_parport_or_block (&lp_table[minor]);
|
||||
@ -540,7 +552,9 @@ static int lp_open(struct inode * inode, struct file * file)
|
||||
parport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);
|
||||
lp_release_parport (&lp_table[minor]);
|
||||
lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int lp_release(struct inode * inode, struct file * file)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/system.h>
|
||||
@ -382,15 +383,19 @@ static int mbcs_open(struct inode *ip, struct file *fp)
|
||||
struct mbcs_soft *soft;
|
||||
int minor;
|
||||
|
||||
lock_kernel();
|
||||
minor = iminor(ip);
|
||||
|
||||
/* Nothing protects access to this list... */
|
||||
list_for_each_entry(soft, &soft_list, list) {
|
||||
if (soft->nasid == minor) {
|
||||
fp->private_data = soft->cxdev;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#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>
|
||||
@ -889,6 +890,9 @@ static const struct file_operations kmsg_fops = {
|
||||
|
||||
static int memory_open(struct inode * inode, struct file * filp)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
switch (iminor(inode)) {
|
||||
case 1:
|
||||
filp->f_op = &mem_fops;
|
||||
@ -932,11 +936,13 @@ static int memory_open(struct inode * inode, struct file * filp)
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
unlock_kernel();
|
||||
return -ENXIO;
|
||||
}
|
||||
if (filp->f_op && filp->f_op->open)
|
||||
return filp->f_op->open(inode,filp);
|
||||
return 0;
|
||||
ret = filp->f_op->open(inode,filp);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations memory_fops = {
|
||||
|
@ -49,6 +49,7 @@
|
||||
#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
|
||||
@ -118,6 +119,7 @@ static int misc_open(struct inode * inode, struct file * file)
|
||||
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) {
|
||||
@ -155,6 +157,7 @@ static int misc_open(struct inode * inode, struct file * file)
|
||||
fops_put(old_fops);
|
||||
fail:
|
||||
mutex_unlock(&misc_mtx);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include <linux/serial.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/serial_8250.h>
|
||||
#include "smapi.h"
|
||||
@ -100,6 +101,7 @@ static int mwave_open(struct inode *inode, struct file *file)
|
||||
PRINTK_2(TRACE_MWAVE,
|
||||
"mwavedd::mwave_open, exit return retval %x\n", retval);
|
||||
|
||||
cycle_kernel_lock();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
@ -333,12 +334,14 @@ nvram_ioctl(struct inode *inode, struct file *file,
|
||||
static int
|
||||
nvram_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock(&nvram_state_lock);
|
||||
|
||||
if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
|
||||
(nvram_open_mode & NVRAM_EXCL) ||
|
||||
((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
|
||||
spin_unlock(&nvram_state_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
@ -349,6 +352,7 @@ nvram_open(struct inode *inode, struct file *file)
|
||||
nvram_open_cnt++;
|
||||
|
||||
spin_unlock(&nvram_state_lock);
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#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"
|
||||
@ -217,6 +218,7 @@ 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)
|
||||
|
@ -66,6 +66,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/ppdev.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define PP_VERSION "ppdev: user-space parallel port driver"
|
||||
@ -638,6 +639,7 @@ static int pp_open (struct inode * inode, struct file * file)
|
||||
unsigned int minor = iminor(inode);
|
||||
struct pp_struct *pp;
|
||||
|
||||
cycle_kernel_lock();
|
||||
if (minor >= PARPORT_MAX)
|
||||
return -ENXIO;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
@ -53,6 +54,7 @@ static int raw_open(struct inode *inode, struct file *filp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
lock_kernel();
|
||||
mutex_lock(&raw_mutex);
|
||||
|
||||
/*
|
||||
@ -79,6 +81,7 @@ static int raw_open(struct inode *inode, struct file *filp)
|
||||
bdev->bd_inode->i_mapping;
|
||||
filp->private_data = bdev;
|
||||
mutex_unlock(&raw_mutex);
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/bcd.h>
|
||||
@ -734,6 +735,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||
* needed here. Or anywhere else in this driver. */
|
||||
static int rtc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
spin_lock_irq(&rtc_lock);
|
||||
|
||||
if (rtc_status & RTC_IS_OPEN)
|
||||
@ -743,10 +745,12 @@ static int rtc_open(struct inode *inode, struct file *file)
|
||||
|
||||
rtc_irq_data = 0;
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out_busy:
|
||||
spin_unlock_irq(&rtc_lock);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#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>
|
||||
|
||||
@ -51,6 +52,7 @@ 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);
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/sn/io.h>
|
||||
#include <asm/sn/sn_sal.h>
|
||||
#include <asm/sn/module.h>
|
||||
@ -104,6 +105,7 @@ scdrv_open(struct inode *inode, struct file *file)
|
||||
file->private_data = sd;
|
||||
|
||||
/* hook this subchannel up to the system controller interrupt */
|
||||
lock_kernel();
|
||||
rv = request_irq(SGI_UART_VECTOR, scdrv_interrupt,
|
||||
IRQF_SHARED | IRQF_DISABLED,
|
||||
SYSCTL_BASENAME, sd);
|
||||
@ -111,9 +113,10 @@ scdrv_open(struct inode *inode, struct file *file)
|
||||
ia64_sn_irtr_close(sd->sd_nasid, sd->sd_subch);
|
||||
kfree(sd);
|
||||
printk("%s: irq request failed (%d)\n", __func__, rv);
|
||||
unlock_kernel();
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/kfifo.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/io.h>
|
||||
@ -906,12 +907,14 @@ static int sonypi_misc_release(struct inode *inode, struct file *file)
|
||||
|
||||
static int sonypi_misc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
lock_kernel();
|
||||
mutex_lock(&sonypi_device.lock);
|
||||
/* Flush input queue on first open */
|
||||
if (!sonypi_device.open_count)
|
||||
kfifo_reset(sonypi_device.fifo);
|
||||
sonypi_device.open_count++;
|
||||
mutex_unlock(&sonypi_device.lock);
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#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>
|
||||
@ -236,6 +237,7 @@ static int tanbac_tb0219_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int minor;
|
||||
|
||||
cycle_kernel_lock();
|
||||
minor = iminor(inode);
|
||||
switch (minor) {
|
||||
case 0:
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/device.h>
|
||||
@ -204,11 +205,14 @@ static int tlclk_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (test_and_set_bit(0, &useflags))
|
||||
return -EBUSY;
|
||||
lock_kernel();
|
||||
if (test_and_set_bit(0, &useflags)) {
|
||||
result = -EBUSY;
|
||||
/* this legacy device is always one per system and it doesn't
|
||||
* know how to handle multiple concurrent clients.
|
||||
*/
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Make sure there is no interrupt pending while
|
||||
* initialising interrupt handler */
|
||||
@ -218,13 +222,14 @@ static int tlclk_open(struct inode *inode, struct file *filp)
|
||||
* we can't share this IRQ */
|
||||
result = request_irq(telclk_interrupt, &tlclk_interrupt,
|
||||
IRQF_DISABLED, "telco_clock", tlclk_interrupt);
|
||||
if (result == -EBUSY) {
|
||||
if (result == -EBUSY)
|
||||
printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
inb(TLCLK_REG6); /* Clear interrupt events */
|
||||
else
|
||||
inb(TLCLK_REG6); /* Clear interrupt events */
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return result;
|
||||
}
|
||||
|
||||
static int tlclk_release(struct inode *inode, struct file *filp)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include "tpm.h"
|
||||
|
||||
@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file)
|
||||
int rc = 0, minor = iminor(inode);
|
||||
struct tpm_chip *chip = NULL, *pos;
|
||||
|
||||
lock_kernel();
|
||||
spin_lock(&driver_lock);
|
||||
|
||||
list_for_each_entry(pos, &tpm_chip_list, list) {
|
||||
@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file)
|
||||
if (chip->data_buffer == NULL) {
|
||||
chip->num_opens--;
|
||||
put_device(chip->dev);
|
||||
unlock_kernel();
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
atomic_set(&chip->data_pending, 0);
|
||||
|
||||
file->private_data = chip;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
spin_unlock(&driver_lock);
|
||||
unlock_kernel();
|
||||
return rc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tpm_open);
|
||||
|
@ -2665,7 +2665,7 @@ static void release_dev(struct file *filp)
|
||||
* ->siglock protects ->signal/->sighand
|
||||
*/
|
||||
|
||||
static int tty_open(struct inode *inode, struct file *filp)
|
||||
static int __tty_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct tty_struct *tty;
|
||||
int noctty, retval;
|
||||
@ -2779,6 +2779,19 @@ got_driver:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* BKL pushdown: scary code avoidance wrapper */
|
||||
static int tty_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
ret = __tty_open(inode, filp);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef CONFIG_UNIX98_PTYS
|
||||
/**
|
||||
* ptmx_open - open a unix 98 pty master
|
||||
@ -2792,7 +2805,7 @@ got_driver:
|
||||
* allocated_ptys_lock handles the list of free pty numbers
|
||||
*/
|
||||
|
||||
static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
static int __ptmx_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct tty_struct *tty;
|
||||
int retval;
|
||||
@ -2831,6 +2844,16 @@ out:
|
||||
devpts_kill_index(index);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int ptmx_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
ret = __ptmx_open(inode, filp);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -2886,15 +2909,16 @@ static int tty_fasync(int fd, struct file *filp, int on)
|
||||
{
|
||||
struct tty_struct *tty;
|
||||
unsigned long flags;
|
||||
int retval;
|
||||
int retval = 0;
|
||||
|
||||
lock_kernel();
|
||||
tty = (struct tty_struct *)filp->private_data;
|
||||
if (tty_paranoia_check(tty, filp->f_path.dentry->d_inode, "tty_fasync"))
|
||||
return 0;
|
||||
goto out;
|
||||
|
||||
retval = fasync_helper(fd, filp, on, &tty->fasync);
|
||||
if (retval <= 0)
|
||||
return retval;
|
||||
goto out;
|
||||
|
||||
if (on) {
|
||||
enum pid_type type;
|
||||
@ -2912,12 +2936,15 @@ static int tty_fasync(int fd, struct file *filp, int on)
|
||||
spin_unlock_irqrestore(&tty->ctrl_lock, flags);
|
||||
retval = __f_setown(filp, pid, type, 0);
|
||||
if (retval)
|
||||
return retval;
|
||||
goto out;
|
||||
} else {
|
||||
if (!tty->fasync && !waitqueue_active(&tty->read_wait))
|
||||
tty->minimum_to_wake = N_TTY_BUF_SIZE;
|
||||
}
|
||||
return 0;
|
||||
retval = 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <linux/kbd_kern.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/byteorder.h>
|
||||
@ -460,9 +461,13 @@ static int
|
||||
vcs_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
unsigned int currcons = iminor(inode) & 127;
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
if(currcons && !vc_cons_allocated(currcons-1))
|
||||
return -ENXIO;
|
||||
return 0;
|
||||
ret = -ENXIO;
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct file_operations vcs_fops = {
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <linux/completion.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/ioctls.h>
|
||||
@ -687,6 +688,7 @@ static int viotap_open(struct inode *inode, struct file *file)
|
||||
if (op == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
get_dev_info(file->f_path.dentry->d_inode, &devi);
|
||||
|
||||
/* Note: We currently only support one mode! */
|
||||
@ -717,6 +719,7 @@ static int viotap_open(struct inode *inode, struct file *file)
|
||||
|
||||
free_op:
|
||||
free_op_struct(op);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
@ -547,6 +548,7 @@ static int gpio_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
unsigned int pin;
|
||||
|
||||
cycle_kernel_lock();
|
||||
pin = iminor(inode);
|
||||
if (pin >= giu_nr_pins)
|
||||
return -EBADF;
|
||||
|
@ -85,6 +85,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/fs.h>
|
||||
@ -504,11 +505,12 @@ static int hwicap_open(struct inode *inode, struct file *file)
|
||||
struct hwicap_drvdata *drvdata;
|
||||
int status;
|
||||
|
||||
lock_kernel();
|
||||
drvdata = container_of(inode->i_cdev, struct hwicap_drvdata, cdev);
|
||||
|
||||
status = mutex_lock_interruptible(&drvdata->sem);
|
||||
if (status)
|
||||
return status;
|
||||
goto out;
|
||||
|
||||
if (drvdata->is_open) {
|
||||
status = -EBUSY;
|
||||
@ -528,6 +530,8 @@ static int hwicap_open(struct inode *inode, struct file *file)
|
||||
|
||||
error:
|
||||
mutex_unlock(&drvdata->sem);
|
||||
out:
|
||||
unlock_kernel();
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "drmP.h"
|
||||
#include "drm_sarea.h"
|
||||
#include <linux/poll.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
static int drm_open_helper(struct inode *inode, struct file *filp,
|
||||
struct drm_device * dev);
|
||||
@ -174,12 +175,14 @@ int drm_stub_open(struct inode *inode, struct file *filp)
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
/* BKL pushdown: note that nothing else serializes idr_find() */
|
||||
lock_kernel();
|
||||
minor = idr_find(&drm_minors_idr, minor_id);
|
||||
if (!minor)
|
||||
return -ENODEV;
|
||||
goto out;
|
||||
|
||||
if (!(dev = minor->dev))
|
||||
return -ENODEV;
|
||||
goto out;
|
||||
|
||||
old_fops = filp->f_op;
|
||||
filp->f_op = fops_get(&dev->driver->fops);
|
||||
@ -189,6 +192,8 @@ int drm_stub_open(struct inode *inode, struct file *filp)
|
||||
}
|
||||
fops_put(old_fops);
|
||||
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <linux/major.h>
|
||||
#include <linux/hid.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <linux/hidraw.h>
|
||||
|
||||
@ -157,6 +158,7 @@ static int hidraw_open(struct inode *inode, struct file *file)
|
||||
struct hidraw_list *list;
|
||||
int err = 0;
|
||||
|
||||
lock_kernel();
|
||||
if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) {
|
||||
err = -ENOMEM;
|
||||
goto out;
|
||||
@ -183,6 +185,7 @@ static int hidraw_open(struct inode *inode, struct file *file)
|
||||
out_unlock:
|
||||
spin_unlock(&minors_lock);
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-dev.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
static struct i2c_driver i2cdev_driver;
|
||||
@ -441,14 +442,20 @@ static int i2cdev_open(struct inode *inode, struct file *file)
|
||||
struct i2c_client *client;
|
||||
struct i2c_adapter *adap;
|
||||
struct i2c_dev *i2c_dev;
|
||||
int ret = 0;
|
||||
|
||||
lock_kernel();
|
||||
i2c_dev = i2c_dev_get_by_minor(minor);
|
||||
if (!i2c_dev)
|
||||
return -ENODEV;
|
||||
if (!i2c_dev) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
adap = i2c_get_adapter(i2c_dev->adap->nr);
|
||||
if (!adap)
|
||||
return -ENODEV;
|
||||
if (!adap) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* This creates an anonymous i2c_client, which may later be
|
||||
* pointed to some address using I2C_SLAVE or I2C_SLAVE_FORCE.
|
||||
@ -460,7 +467,8 @@ static int i2cdev_open(struct inode *inode, struct file *file)
|
||||
client = kzalloc(sizeof(*client), GFP_KERNEL);
|
||||
if (!client) {
|
||||
i2c_put_adapter(adap);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr);
|
||||
client->driver = &i2cdev_driver;
|
||||
@ -468,7 +476,9 @@ static int i2cdev_open(struct inode *inode, struct file *file)
|
||||
client->adapter = adap;
|
||||
file->private_data = client;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int i2cdev_release(struct inode *inode, struct file *file)
|
||||
|
@ -2421,9 +2421,12 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
|
||||
if (i >= MAX_HWIFS * MAX_DRIVES)
|
||||
return -ENXIO;
|
||||
|
||||
lock_kernel();
|
||||
tape = ide_tape_chrdev_get(i);
|
||||
if (!tape)
|
||||
if (!tape) {
|
||||
unlock_kernel();
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
debug_log(DBG_CHRDEV, "Enter %s\n", __func__);
|
||||
|
||||
@ -2482,10 +2485,12 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
|
||||
}
|
||||
}
|
||||
}
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out_put_tape:
|
||||
ide_tape_put(tape);
|
||||
unlock_kernel();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/idr.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
@ -1159,6 +1160,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct ib_ucm_file *file;
|
||||
|
||||
cycle_kernel_lock();
|
||||
file = kmalloc(sizeof(*file), GFP_KERNEL);
|
||||
if (!file)
|
||||
return -ENOMEM;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include <rdma/rdma_user_cm.h>
|
||||
#include <rdma/ib_marshall.h>
|
||||
@ -1156,6 +1157,7 @@ static int ucma_open(struct inode *inode, struct file *filp)
|
||||
if (!file)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
INIT_LIST_HEAD(&file->event_list);
|
||||
INIT_LIST_HEAD(&file->ctx_list);
|
||||
init_waitqueue_head(&file->poll_wait);
|
||||
@ -1163,6 +1165,7 @@ static int ucma_open(struct inode *inode, struct file *filp)
|
||||
|
||||
filp->private_data = file;
|
||||
file->filp = filp;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -777,6 +777,19 @@ static long ib_umad_compat_ioctl(struct file *filp, unsigned int cmd,
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ib_umad_open() does not need the BKL:
|
||||
*
|
||||
* - umad_port[] accesses are protected by port_lock, the
|
||||
* ib_umad_port structures are properly reference counted, and
|
||||
* everything else is purely local to the file being created, so
|
||||
* races against other open calls are not a problem;
|
||||
* - the ioctl method does not affect any global state outside of the
|
||||
* file structure being operated on;
|
||||
* - the port is added to umad_port[] as the last part of module
|
||||
* initialization so the open method will either immediately run
|
||||
* -ENXIO, or all required initialization will be done.
|
||||
*/
|
||||
static int ib_umad_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct ib_umad_port *port;
|
||||
|
@ -610,6 +610,18 @@ static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
return file->device->ib_dev->mmap(file->ucontext, vma);
|
||||
}
|
||||
|
||||
/*
|
||||
* ib_uverbs_open() does not need the BKL:
|
||||
*
|
||||
* - dev_table[] accesses are protected by map_lock, the
|
||||
* ib_uverbs_device structures are properly reference counted, and
|
||||
* everything else is purely local to the file being created, so
|
||||
* races against other open calls are not a problem;
|
||||
* - there is no ioctl method to race against;
|
||||
* - the device is added to dev_table[] as the last part of module
|
||||
* initialization, the open method will either immediately run
|
||||
* -ENXIO, or all required initialization will be done.
|
||||
*/
|
||||
static int ib_uverbs_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct ib_uverbs_device *dev;
|
||||
@ -651,7 +663,6 @@ err_module:
|
||||
|
||||
err:
|
||||
kref_put(&dev->ref, ib_uverbs_release_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
#include "ipath_kernel.h"
|
||||
@ -1815,6 +1816,7 @@ done:
|
||||
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;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/rcupdate.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
|
||||
MODULE_DESCRIPTION("Input core");
|
||||
@ -1588,13 +1589,17 @@ EXPORT_SYMBOL(input_unregister_handle);
|
||||
|
||||
static int input_open_file(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct input_handler *handler = input_table[iminor(inode) >> 5];
|
||||
struct input_handler *handler;
|
||||
const struct file_operations *old_fops, *new_fops = NULL;
|
||||
int err;
|
||||
|
||||
lock_kernel();
|
||||
/* No load-on-demand here? */
|
||||
if (!handler || !(new_fops = fops_get(handler->fops)))
|
||||
return -ENODEV;
|
||||
handler = input_table[iminor(inode) >> 5];
|
||||
if (!handler || !(new_fops = fops_get(handler->fops))) {
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
* That's _really_ odd. Usually NULL ->open means "nothing special",
|
||||
@ -1602,7 +1607,8 @@ static int input_open_file(struct inode *inode, struct file *file)
|
||||
*/
|
||||
if (!new_fops->open) {
|
||||
fops_put(new_fops);
|
||||
return -ENODEV;
|
||||
err = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
old_fops = file->f_op;
|
||||
file->f_op = new_fops;
|
||||
@ -1614,6 +1620,8 @@ static int input_open_file(struct inode *inode, struct file *file)
|
||||
file->f_op = fops_get(old_fops);
|
||||
}
|
||||
fops_put(old_fops);
|
||||
out:
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#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>
|
||||
@ -408,6 +409,7 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/uinput.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
|
||||
{
|
||||
@ -222,6 +223,7 @@ static int uinput_open(struct inode *inode, struct file *file)
|
||||
if (!newdev)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
mutex_init(&newdev->mutex);
|
||||
spin_lock_init(&newdev->requests_lock);
|
||||
init_waitqueue_head(&newdev->requests_waitq);
|
||||
@ -229,6 +231,7 @@ static int uinput_open(struct inode *inode, struct file *file)
|
||||
newdev->state = UIST_NEW_DEVICE;
|
||||
|
||||
file->private_data = newdev;
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define MOUSEDEV_MIX 31
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
@ -545,16 +546,21 @@ static int mousedev_open(struct inode *inode, struct file *file)
|
||||
if (i >= MOUSEDEV_MINORS)
|
||||
return -ENODEV;
|
||||
|
||||
lock_kernel();
|
||||
error = mutex_lock_interruptible(&mousedev_table_mutex);
|
||||
if (error)
|
||||
if (error) {
|
||||
unlock_kernel();
|
||||
return error;
|
||||
}
|
||||
mousedev = mousedev_table[i];
|
||||
if (mousedev)
|
||||
get_device(&mousedev->dev);
|
||||
mutex_unlock(&mousedev_table_mutex);
|
||||
|
||||
if (!mousedev)
|
||||
if (!mousedev) {
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
client = kzalloc(sizeof(struct mousedev_client), GFP_KERNEL);
|
||||
if (!client) {
|
||||
@ -573,6 +579,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
|
||||
goto err_free_client;
|
||||
|
||||
file->private_data = client;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
err_free_client:
|
||||
@ -580,6 +587,7 @@ static int mousedev_open(struct inode *inode, struct file *file)
|
||||
kfree(client);
|
||||
err_put_mousedev:
|
||||
put_device(&mousedev->dev);
|
||||
unlock_kernel();
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/serio.h>
|
||||
@ -81,9 +82,10 @@ static int serio_raw_open(struct inode *inode, struct file *file)
|
||||
struct serio_raw_list *list;
|
||||
int retval = 0;
|
||||
|
||||
lock_kernel();
|
||||
retval = mutex_lock_interruptible(&serio_raw_mutex);
|
||||
if (retval)
|
||||
return retval;
|
||||
goto out_bkl;
|
||||
|
||||
if (!(serio_raw = serio_raw_locate(iminor(inode)))) {
|
||||
retval = -ENODEV;
|
||||
@ -108,6 +110,8 @@ static int serio_raw_open(struct inode *inode, struct file *file)
|
||||
|
||||
out:
|
||||
mutex_unlock(&serio_raw_mutex);
|
||||
out_bkl:
|
||||
unlock_kernel();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <linux/signal.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/wait.h>
|
||||
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
|
||||
@ -983,13 +984,17 @@ capi_ioctl(struct inode *inode, struct file *file,
|
||||
static int
|
||||
capi_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
if (file->private_data)
|
||||
return -EEXIST;
|
||||
|
||||
if ((file->private_data = capidev_alloc()) == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
return nonseekable_open(inode, file);
|
||||
ret = -EEXIST;
|
||||
else if ((file->private_data = capidev_alloc()) == NULL)
|
||||
ret = -ENOMEM;
|
||||
else
|
||||
ret = nonseekable_open(inode, file);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include "platform.h"
|
||||
@ -127,14 +128,19 @@ static unsigned int maint_poll(struct file *file, poll_table * wait)
|
||||
|
||||
static int maint_open(struct inode *ino, struct file *filep)
|
||||
{
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
/* only one open is allowed, so we test
|
||||
it atomically */
|
||||
if (test_and_set_bit(0, &opened))
|
||||
return (-EBUSY);
|
||||
|
||||
filep->private_data = NULL;
|
||||
|
||||
return nonseekable_open(ino, filep);
|
||||
ret = -EBUSY;
|
||||
else {
|
||||
filep->private_data = NULL;
|
||||
ret = nonseekable_open(ino, filep);
|
||||
}
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int maint_close(struct inode *ino, struct file *filep)
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#include "platform.h"
|
||||
@ -400,6 +401,7 @@ static unsigned int um_idi_poll(struct file *file, poll_table * wait)
|
||||
|
||||
static int um_idi_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <linux/list.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/smp_lock.h>
|
||||
|
||||
#include "platform.h"
|
||||
#undef ID_MASK
|
||||
@ -580,6 +581,7 @@ xdi_copy_from_user(void *os_handle, void *dst, const void __user *src, int lengt
|
||||
*/
|
||||
static int divas_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -1732,7 +1732,7 @@ isdn_open(struct inode *ino, struct file *filep)
|
||||
int chidx;
|
||||
int retval = -ENODEV;
|
||||
|
||||
|
||||
lock_kernel();
|
||||
if (minor == ISDN_MINOR_STATUS) {
|
||||
infostruct *p;
|
||||
|
||||
@ -1783,6 +1783,7 @@ isdn_open(struct inode *ino, struct file *filep)
|
||||
#endif
|
||||
out:
|
||||
nonseekable_open(ino, filep);
|
||||
unlock_kernel();
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
@ -644,12 +644,18 @@ do_adb_query(struct adb_request *req)
|
||||
static int adb_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct adbdev_state *state;
|
||||
int ret = 0;
|
||||
|
||||
if (iminor(inode) > 0 || adb_controller == NULL)
|
||||
return -ENXIO;
|
||||
lock_kernel();
|
||||
if (iminor(inode) > 0 || adb_controller == NULL) {
|
||||
ret = -ENXIO;
|
||||
goto out;
|
||||
}
|
||||
state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
|
||||
if (state == 0)
|
||||
return -ENOMEM;
|
||||
if (state == 0) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
file->private_data = state;
|
||||
spin_lock_init(&state->lock);
|
||||
atomic_set(&state->n_pending, 0);
|
||||
@ -657,7 +663,9 @@ static int adb_open(struct inode *inode, struct file *file)
|
||||
init_waitqueue_head(&state->wait_queue);
|
||||
state->inuse = 1;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int adb_release(struct inode *inode, struct file *file)
|
||||
|
@ -3,6 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/miscdevice.h>
|
||||
@ -119,6 +120,7 @@ anslcd_ioctl( struct inode * inode, struct file * file,
|
||||
static int
|
||||
anslcd_open( struct inode * inode, struct file * file )
|
||||
{
|
||||
cycle_kernel_lock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
* the userland interface
|
||||
*/
|
||||
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
@ -1086,10 +1087,12 @@ static int smu_open(struct inode *inode, struct file *file)
|
||||
pp->mode = smu_file_commands;
|
||||
init_waitqueue_head(&pp->wait);
|
||||
|
||||
lock_kernel();
|
||||
spin_lock_irqsave(&smu_clist_lock, flags);
|
||||
list_add(&pp->list, &smu_clist);
|
||||
spin_unlock_irqrestore(&smu_clist_lock, flags);
|
||||
file->private_data = pp;
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
*
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -2047,6 +2048,7 @@ pmu_open(struct inode *inode, struct file *file)
|
||||
pp->rb_get = pp->rb_put = 0;
|
||||
spin_lock_init(&pp->lock);
|
||||
init_waitqueue_head(&pp->wait);
|
||||
lock_kernel();
|
||||
spin_lock_irqsave(&all_pvt_lock, flags);
|
||||
#if defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_PMAC_BACKLIGHT)
|
||||
pp->backlight_locker = 0;
|
||||
@ -2054,6 +2056,7 @@ pmu_open(struct inode *inode, struct file *file)
|
||||
list_add(&pp->list, &all_pmu_pvt);
|
||||
spin_unlock_irqrestore(&all_pvt_lock, flags);
|
||||
file->private_data = pp;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <linux/fs.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include "dvbdev.h"
|
||||
|
||||
static int dvbdev_debug;
|
||||
@ -74,6 +75,7 @@ static int dvb_device_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
struct dvb_device *dvbdev;
|
||||
|
||||
lock_kernel();
|
||||
dvbdev = dvbdev_find_device (iminor(inode));
|
||||
|
||||
if (dvbdev && dvbdev->fops) {
|
||||
@ -90,8 +92,10 @@ static int dvb_device_open(struct inode *inode, struct file *file)
|
||||
file->f_op = fops_get(old_fops);
|
||||
}
|
||||
fops_put(old_fops);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/delay.h>
|
||||
@ -27,13 +28,16 @@ static int rds_f_open(struct inode *in, struct file *fi)
|
||||
if (rds_users)
|
||||
return -EBUSY;
|
||||
|
||||
lock_kernel();
|
||||
rds_users++;
|
||||
if ((text_buffer=kmalloc(66, GFP_KERNEL)) == 0) {
|
||||
rds_users--;
|
||||
printk(KERN_NOTICE "aci-rds: Out of memory by open()...\n");
|
||||
unlock_kernel();
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
@ -442,6 +443,7 @@ static int video_open(struct inode *inode, struct file *file)
|
||||
|
||||
if(minor>=VIDEO_NUM_DEVICES)
|
||||
return -ENODEV;
|
||||
lock_kernel();
|
||||
mutex_lock(&videodev_lock);
|
||||
vfl=video_device[minor];
|
||||
if(vfl==NULL) {
|
||||
@ -451,6 +453,7 @@ static int video_open(struct inode *inode, struct file *file)
|
||||
vfl=video_device[minor];
|
||||
if (vfl==NULL) {
|
||||
mutex_unlock(&videodev_lock);
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
@ -464,6 +467,7 @@ static int video_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
fops_put(old_fops);
|
||||
mutex_unlock(&videodev_lock);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -548,11 +548,15 @@ static int
|
||||
mptctl_fasync(int fd, struct file *filep, int mode)
|
||||
{
|
||||
MPT_ADAPTER *ioc;
|
||||
int ret;
|
||||
|
||||
lock_kernel();
|
||||
list_for_each_entry(ioc, &ioc_list, list)
|
||||
ioc->aen_event_read_flag=0;
|
||||
|
||||
return fasync_helper(fd, filep, mode, &async_queue);
|
||||
ret = fasync_helper(fd, filep, mode, &async_queue);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1061,6 +1061,7 @@ static int cfg_open(struct inode *inode, struct file *file)
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
|
||||
lock_kernel();
|
||||
file->private_data = (void *)(i2o_cfg_info_id++);
|
||||
tmp->fp = file;
|
||||
tmp->fasync = NULL;
|
||||
@ -1074,6 +1075,7 @@ static int cfg_open(struct inode *inode, struct file *file)
|
||||
spin_lock_irqsave(&i2o_config_lock, flags);
|
||||
open_files = tmp;
|
||||
spin_unlock_irqrestore(&i2o_config_lock, flags);
|
||||
unlock_kernel();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1082,15 +1084,17 @@ static int cfg_fasync(int fd, struct file *fp, int on)
|
||||
{
|
||||
ulong id = (ulong) fp->private_data;
|
||||
struct i2o_cfg_info *p;
|
||||
int ret = -EBADF;
|
||||
|
||||
lock_kernel();
|
||||
for (p = open_files; p; p = p->next)
|
||||
if (p->q_id == id)
|
||||
break;
|
||||
|
||||
if (!p)
|
||||
return -EBADF;
|
||||
|
||||
return fasync_helper(fd, fp, on, &p->fasync);
|
||||
if (p)
|
||||
ret = fasync_helper(fd, fp, on, &p->fasync);
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cfg_release(struct inode *inode, struct file *file)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user