static int hiddev_open(struct inode *inode, struct file *file)
{
struct hiddev_list *list;
- int res;
+ int res, i;
- int i = iminor(inode) - HIDDEV_MINOR_BASE;
+ lock_kernel();
+ i = iminor(inode) - HIDDEV_MINOR_BASE;
if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i])
return -ENODEV;
usbhid_open(hid);
}
+ unlock_kernel();
return 0;
bail:
file->private_data = NULL;
kfree(list);
+ unlock_kernel();
return res;
}
{
int devnum = iminor(inode);
pdabusb_t s;
+ int r;
if (devnum < DABUSB_MINOR || devnum >= (DABUSB_MINOR + NRDABUSB))
return -EIO;
+ lock_kernel();
s = &dabusb[devnum - DABUSB_MINOR];
dbg("dabusb_open");
msleep_interruptible(500);
if (signal_pending (current)) {
+ unlock_kernel();
return -EAGAIN;
}
mutex_lock(&s->mutex);
if (usb_set_interface (s->usbdev, _DABUSB_IF, 1) < 0) {
mutex_unlock(&s->mutex);
dev_err(&s->usbdev->dev, "set_interface failed\n");
+ unlock_kernel();
return -EINVAL;
}
s->opened = 1;
file->f_pos = 0;
file->private_data = s;
- return nonseekable_open(inode, file);
+ r = nonseekable_open(inode, file);
+ unlock_kernel();
+ return r;
}
static int dabusb_release (struct inode *inode, struct file *file)
#include <linux/mutex.h>
#include <linux/uaccess.h>
+#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/poll.h>
int retval = 0;
struct usb_interface *interface;
+ lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);
unlock_disconnect_exit:
mutex_unlock(&disconnect_mutex);
+ unlock_kernel();
return retval;
}
#include <linux/mutex.h>
#include <linux/uaccess.h>
+#include <linux/smp_lock.h>
#include <linux/input.h>
#include <linux/usb.h>
#include <linux/poll.h>
int retval = 0;
struct usb_interface *interface;
+ lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);
unlock_disconnect_exit:
mutex_unlock(&disconnect_mutex);
+ unlock_kernel();
return retval;
}
#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/poll.h>
+#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/usb/cdc.h>
#include <asm/byteorder.h>
struct usb_interface *intf;
struct wdm_device *desc;
+ lock_kernel();
mutex_lock(&wdm_mutex);
intf = usb_find_interface(&wdm_driver, minor);
if (!intf)
usb_autopm_put_interface(desc->intf);
out:
mutex_unlock(&wdm_mutex);
+ unlock_kernel();
return rv;
}
#include <linux/slab.h>
#include <linux/lp.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#undef DEBUG
#include <linux/usb.h>
if (minor < 0)
return -ENODEV;
+ lock_kernel();
mutex_lock (&usblp_mutex);
retval = -ENODEV;
}
out:
mutex_unlock (&usblp_mutex);
+ unlock_kernel();
return retval;
}
#include <linux/uaccess.h>
#include <linux/kref.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/usb/tmc.h>
struct usbtmc_device_data *data;
int retval = 0;
+ lock_kernel();
intf = usb_find_interface(&usbtmc_driver, iminor(inode));
if (!intf) {
printk(KERN_ERR KBUILD_MODNAME
filp->private_data = data;
exit:
+ unlock_kernel();
return retval;
}
int err = -ENODEV;
const struct file_operations *old_fops, *new_fops = NULL;
- lock_kernel();
down_read(&minor_rwsem);
c = usb_minors[minor];
fops_put(old_fops);
done:
up_read(&minor_rwsem);
- unlock_kernel();
return err;
}
#include <linux/module.h>
#include <linux/wait.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <linux/usb.h>
#include <linux/fs.h>
int retval=0;
int errn=0;
+ lock_kernel();
mutex_lock(&mdc800->io_lock);
if (mdc800->state == NOT_CONNECTED)
error_out:
mutex_unlock(&mdc800->io_lock);
+ unlock_kernel();
return errn;
}
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#ifdef CONFIG_USB_DEBUG
dbg(2,"%s : enter", __func__);
+ lock_kernel();
subminor = iminor(inode);
if ((retval = mutex_lock_interruptible(&adutux_mutex))) {
exit_no_device:
mutex_unlock(&adutux_mutex);
exit_no_lock:
+ unlock_kernel();
dbg(2,"%s : leave, return value %d ", __func__, retval);
return retval;
}
#include <linux/module.h>
#include <linux/kref.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/workqueue.h>
*/
static int ftdi_elan_open(struct inode *inode, struct file *file)
{
- int subminor = iminor(inode);
- struct usb_interface *interface = usb_find_interface(&ftdi_elan_driver,
- subminor);
+ int subminor;
+ struct usb_interface *interface;
+
+ lock_kernel();
+ subminor = iminor(inode);
+ interface = usb_find_interface(&ftdi_elan_driver, subminor);
+
if (!interface) {
+ unlock_kernel();
printk(KERN_ERR "can't find device for minor %d\n", subminor);
return -ENODEV;
} else {
struct usb_ftdi *ftdi = usb_get_intfdata(interface);
if (!ftdi) {
+ unlock_kernel();
return -ENODEV;
} else {
if (down_interruptible(&ftdi->sw_lock)) {
+ unlock_kernel();
return -EINTR;
} else {
ftdi_elan_get_kref(ftdi);
file->private_data = ftdi;
+ unlock_kernel();
return 0;
}
}
#include <linux/module.h>
#include <linux/completion.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
struct usb_interface *interface;
int result;
+ lock_kernel();
/* get the interface from minor number and driver information */
interface = usb_find_interface (&idmouse_driver, iminor (inode));
- if (!interface)
+ if (!interface) {
+ unlock_kernel();
return -ENODEV;
+ }
mutex_lock(&open_disc_mutex);
/* get the device information block from the interface */
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&open_disc_mutex);
+ unlock_kernel();
return -ENODEV;
}
/* unlock this device */
mutex_unlock(&dev->lock);
+ unlock_kernel();
return result;
}
dbg("%s", __func__);
+ lock_kernel();
subminor = iminor(inode);
interface = usb_find_interface(&iowarrior_driver, subminor);
if (!interface) {
+ unlock_kernel();
err("%s - error, can't find device for minor %d", __func__,
subminor);
return -ENODEV;
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&iowarrior_open_disc_lock);
+ unlock_kernel();
return -ENODEV;
}
out:
mutex_unlock(&dev->mutex);
+ unlock_kernel();
return retval;
}
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/input.h>
int retval;
struct usb_interface *interface;
+ lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);
interface = usb_find_interface(&ld_usb_driver, subminor);
if (!interface) {
+ unlock_kernel();
err("%s - error, can't find device for minor %d\n",
__func__, subminor);
return -ENODEV;
dev = usb_get_intfdata(interface);
- if (!dev)
+ if (!dev) {
+ unlock_kernel();
return -ENODEV;
+ }
/* lock this device */
- if (mutex_lock_interruptible(&dev->mutex))
+ if (mutex_lock_interruptible(&dev->mutex)) {
+ unlock_kernel();
return -ERESTARTSYS;
+ }
/* allow opening only once */
if (dev->open_count) {
unlock_exit:
mutex_unlock(&dev->mutex);
+ unlock_kernel();
return retval;
}
#include <linux/module.h>
#include <linux/completion.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/usb.h>
#include <linux/poll.h>
dbg(2, "%s: enter", __func__);
+ lock_kernel();
nonseekable_open(inode, file);
subminor = iminor(inode);
mutex_unlock(&dev->lock);
exit:
+ unlock_kernel();
dbg(2, "%s: leave, return value %d ", __func__, retval);
return retval;
static int open_rio(struct inode *inode, struct file *file)
{
struct rio_usb_data *rio = &rio_instance;
-
+ lock_kernel();
mutex_lock(&(rio->lock));
if (rio->isopen || !rio->present) {
mutex_unlock(&(rio->lock));
dev_info(&rio->rio_dev->dev, "Rio opened.\n");
+ unlock_kernel();
return 0;
}
struct usb_interface *interface;
int subminor = iminor(inode);
- if (!(interface = usb_find_interface(&sisusb_driver, subminor)))
+ lock_kernel();
+ if (!(interface = usb_find_interface(&sisusb_driver, subminor))) {
+ unlock_kernel();
return -ENODEV;
+ }
- if (!(sisusb = usb_get_intfdata(interface)))
+ if (!(sisusb = usb_get_intfdata(interface))) {
+ unlock_kernel();
return -ENODEV;
+ }
mutex_lock(&sisusb->lock);
if (!sisusb->present || !sisusb->ready) {
mutex_unlock(&sisusb->lock);
+ unlock_kernel();
return -ENODEV;
}
if (sisusb->isopen) {
mutex_unlock(&sisusb->lock);
+ unlock_kernel();
return -EBUSY;
}
if (sisusb_init_gfxdevice(sisusb, 0)) {
mutex_unlock(&sisusb->lock);
dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n");
+ unlock_kernel();
return -EIO;
}
} else {
mutex_unlock(&sisusb->lock);
dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n");
+ unlock_kernel();
return -EIO;
}
}
file->private_data = sisusb;
mutex_unlock(&sisusb->lock);
+ unlock_kernel();
return 0;
}
struct usb_interface *interface;
int subminor, r;
+ lock_kernel();
subminor = iminor(inode);
interface = usb_find_interface(&lcd_driver, subminor);
if (!interface) {
+ unlock_kernel();
err ("USBLCD: %s - error, can't find device for minor %d",
__func__, subminor);
return -ENODEV;
dev = usb_get_intfdata(interface);
if (!dev) {
mutex_unlock(&open_disc_mutex);
+ unlock_kernel();
return -ENODEV;
}
r = usb_autopm_get_interface(interface);
if (r < 0) {
kref_put(&dev->kref, lcd_delete);
+ unlock_kernel();
return r;
}
/* save our object in the file's private structure */
file->private_data = dev;
+ unlock_kernel();
return 0;
}
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/mutex.h>
+#include <linux/smp_lock.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
struct vstusb_device *vstdev;
struct usb_interface *interface;
+ lock_kernel();
interface = usb_find_interface(&vstusb_driver, iminor(inode));
if (!interface) {
printk(KERN_ERR KBUILD_MODNAME
": %s - error, can't find device for minor %d\n",
__func__, iminor(inode));
+ unlock_kernel();
return -ENODEV;
}
vstdev = usb_get_intfdata(interface);
- if (!vstdev)
+ if (!vstdev) {
+ unlock_kernel();
return -ENODEV;
+ }
/* lock this device */
mutex_lock(&vstdev->lock);
/* can only open one time */
if ((!vstdev->present) || (vstdev->isopen)) {
mutex_unlock(&vstdev->lock);
+ unlock_kernel();
return -EBUSY;
}
dev_dbg(&vstdev->usb_dev->dev, "%s: opened\n", __func__);
mutex_unlock(&vstdev->lock);
+ unlock_kernel();
return 0;
}
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/kref.h>
+#include <linux/smp_lock.h>
#include <linux/uaccess.h>
#include <linux/usb.h>
#include <linux/mutex.h>
int subminor;
int retval = 0;
+ lock_kernel();
subminor = iminor(inode);
interface = usb_find_interface(&skel_driver, subminor);
mutex_unlock(&dev->io_mutex);
exit:
+ unlock_kernel();
return retval;
}