diff options
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r-- | drivers/hid/hidraw.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index 1ca6f4635eeb..0c6b4d4e7e27 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/major.h> | 30 | #include <linux/major.h> |
31 | #include <linux/hid.h> | 31 | #include <linux/hid.h> |
32 | #include <linux/mutex.h> | 32 | #include <linux/mutex.h> |
33 | #include <linux/smp_lock.h> | ||
33 | 34 | ||
34 | #include <linux/hidraw.h> | 35 | #include <linux/hidraw.h> |
35 | 36 | ||
@@ -157,6 +158,7 @@ static int hidraw_open(struct inode *inode, struct file *file) | |||
157 | struct hidraw_list *list; | 158 | struct hidraw_list *list; |
158 | int err = 0; | 159 | int err = 0; |
159 | 160 | ||
161 | lock_kernel(); | ||
160 | if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) { | 162 | if (!(list = kzalloc(sizeof(struct hidraw_list), GFP_KERNEL))) { |
161 | err = -ENOMEM; | 163 | err = -ENOMEM; |
162 | goto out; | 164 | goto out; |
@@ -183,6 +185,7 @@ static int hidraw_open(struct inode *inode, struct file *file) | |||
183 | out_unlock: | 185 | out_unlock: |
184 | spin_unlock(&minors_lock); | 186 | spin_unlock(&minors_lock); |
185 | out: | 187 | out: |
188 | unlock_kernel(); | ||
186 | return err; | 189 | return err; |
187 | 190 | ||
188 | } | 191 | } |
@@ -319,8 +322,9 @@ int hidraw_connect(struct hid_device *hid) | |||
319 | goto out; | 322 | goto out; |
320 | } | 323 | } |
321 | 324 | ||
322 | dev->dev = device_create(hidraw_class, NULL, MKDEV(hidraw_major, minor), | 325 | dev->dev = device_create_drvdata(hidraw_class, NULL, |
323 | "%s%d", "hidraw", minor); | 326 | MKDEV(hidraw_major, minor), NULL, |
327 | "%s%d", "hidraw", minor); | ||
324 | 328 | ||
325 | if (IS_ERR(dev->dev)) { | 329 | if (IS_ERR(dev->dev)) { |
326 | spin_lock(&minors_lock); | 330 | spin_lock(&minors_lock); |