diff options
Diffstat (limited to 'drivers/usb/misc/usblcd.c')
-rw-r--r-- | drivers/usb/misc/usblcd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 7828c764b323..6ae39e3e5046 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
21 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
22 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
@@ -30,6 +29,7 @@ | |||
30 | #define IOCTL_GET_DRV_VERSION 2 | 29 | #define IOCTL_GET_DRV_VERSION 2 |
31 | 30 | ||
32 | 31 | ||
32 | static DEFINE_MUTEX(lcd_mutex); | ||
33 | static const struct usb_device_id id_table[] = { | 33 | static const struct usb_device_id id_table[] = { |
34 | { .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, }, | 34 | { .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, }, |
35 | { }, | 35 | { }, |
@@ -74,12 +74,12 @@ static int lcd_open(struct inode *inode, struct file *file) | |||
74 | struct usb_interface *interface; | 74 | struct usb_interface *interface; |
75 | int subminor, r; | 75 | int subminor, r; |
76 | 76 | ||
77 | lock_kernel(); | 77 | mutex_lock(&lcd_mutex); |
78 | subminor = iminor(inode); | 78 | subminor = iminor(inode); |
79 | 79 | ||
80 | interface = usb_find_interface(&lcd_driver, subminor); | 80 | interface = usb_find_interface(&lcd_driver, subminor); |
81 | if (!interface) { | 81 | if (!interface) { |
82 | unlock_kernel(); | 82 | mutex_unlock(&lcd_mutex); |
83 | err ("USBLCD: %s - error, can't find device for minor %d", | 83 | err ("USBLCD: %s - error, can't find device for minor %d", |
84 | __func__, subminor); | 84 | __func__, subminor); |
85 | return -ENODEV; | 85 | return -ENODEV; |
@@ -89,7 +89,7 @@ static int lcd_open(struct inode *inode, struct file *file) | |||
89 | dev = usb_get_intfdata(interface); | 89 | dev = usb_get_intfdata(interface); |
90 | if (!dev) { | 90 | if (!dev) { |
91 | mutex_unlock(&open_disc_mutex); | 91 | mutex_unlock(&open_disc_mutex); |
92 | unlock_kernel(); | 92 | mutex_unlock(&lcd_mutex); |
93 | return -ENODEV; | 93 | return -ENODEV; |
94 | } | 94 | } |
95 | 95 | ||
@@ -101,13 +101,13 @@ static int lcd_open(struct inode *inode, struct file *file) | |||
101 | r = usb_autopm_get_interface(interface); | 101 | r = usb_autopm_get_interface(interface); |
102 | if (r < 0) { | 102 | if (r < 0) { |
103 | kref_put(&dev->kref, lcd_delete); | 103 | kref_put(&dev->kref, lcd_delete); |
104 | unlock_kernel(); | 104 | mutex_unlock(&lcd_mutex); |
105 | return r; | 105 | return r; |
106 | } | 106 | } |
107 | 107 | ||
108 | /* save our object in the file's private structure */ | 108 | /* save our object in the file's private structure */ |
109 | file->private_data = dev; | 109 | file->private_data = dev; |
110 | unlock_kernel(); | 110 | mutex_unlock(&lcd_mutex); |
111 | 111 | ||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
@@ -164,14 +164,14 @@ static long lcd_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
164 | 164 | ||
165 | switch (cmd) { | 165 | switch (cmd) { |
166 | case IOCTL_GET_HARD_VERSION: | 166 | case IOCTL_GET_HARD_VERSION: |
167 | lock_kernel(); | 167 | mutex_lock(&lcd_mutex); |
168 | bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice); | 168 | bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice); |
169 | sprintf(buf,"%1d%1d.%1d%1d", | 169 | sprintf(buf,"%1d%1d.%1d%1d", |
170 | (bcdDevice & 0xF000)>>12, | 170 | (bcdDevice & 0xF000)>>12, |
171 | (bcdDevice & 0xF00)>>8, | 171 | (bcdDevice & 0xF00)>>8, |
172 | (bcdDevice & 0xF0)>>4, | 172 | (bcdDevice & 0xF0)>>4, |
173 | (bcdDevice & 0xF)); | 173 | (bcdDevice & 0xF)); |
174 | unlock_kernel(); | 174 | mutex_unlock(&lcd_mutex); |
175 | if (copy_to_user((void __user *)arg,buf,strlen(buf))!=0) | 175 | if (copy_to_user((void __user *)arg,buf,strlen(buf))!=0) |
176 | return -EFAULT; | 176 | return -EFAULT; |
177 | break; | 177 | break; |