diff options
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r-- | drivers/char/misc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index eaace0db0ff4..999aa779c08a 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/device.h> | 49 | #include <linux/device.h> |
50 | #include <linux/tty.h> | 50 | #include <linux/tty.h> |
51 | #include <linux/kmod.h> | 51 | #include <linux/kmod.h> |
52 | #include <linux/smp_lock.h> | ||
52 | 53 | ||
53 | /* | 54 | /* |
54 | * Head entry for the doubly linked miscdevice list | 55 | * Head entry for the doubly linked miscdevice list |
@@ -118,6 +119,7 @@ static int misc_open(struct inode * inode, struct file * file) | |||
118 | int err = -ENODEV; | 119 | int err = -ENODEV; |
119 | const struct file_operations *old_fops, *new_fops = NULL; | 120 | const struct file_operations *old_fops, *new_fops = NULL; |
120 | 121 | ||
122 | lock_kernel(); | ||
121 | mutex_lock(&misc_mtx); | 123 | mutex_lock(&misc_mtx); |
122 | 124 | ||
123 | list_for_each_entry(c, &misc_list, list) { | 125 | list_for_each_entry(c, &misc_list, list) { |
@@ -155,6 +157,7 @@ static int misc_open(struct inode * inode, struct file * file) | |||
155 | fops_put(old_fops); | 157 | fops_put(old_fops); |
156 | fail: | 158 | fail: |
157 | mutex_unlock(&misc_mtx); | 159 | mutex_unlock(&misc_mtx); |
160 | unlock_kernel(); | ||
158 | return err; | 161 | return err; |
159 | } | 162 | } |
160 | 163 | ||
@@ -214,8 +217,8 @@ int misc_register(struct miscdevice * misc) | |||
214 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 217 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); |
215 | dev = MKDEV(MISC_MAJOR, misc->minor); | 218 | dev = MKDEV(MISC_MAJOR, misc->minor); |
216 | 219 | ||
217 | misc->this_device = device_create(misc_class, misc->parent, dev, | 220 | misc->this_device = device_create_drvdata(misc_class, misc->parent, |
218 | "%s", misc->name); | 221 | dev, NULL, "%s", misc->name); |
219 | if (IS_ERR(misc->this_device)) { | 222 | if (IS_ERR(misc->this_device)) { |
220 | err = PTR_ERR(misc->this_device); | 223 | err = PTR_ERR(misc->this_device); |
221 | goto out; | 224 | goto out; |