#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) {
- unlock_kernel();
+ if (!vstdev)
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;
}