diff options
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r-- | drivers/char/misc.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index a5e0db9d7662..62c99fa59e2b 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -168,7 +168,6 @@ static const struct file_operations misc_fops = { | |||
168 | .open = misc_open, | 168 | .open = misc_open, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | |||
172 | /** | 171 | /** |
173 | * misc_register - register a miscellaneous device | 172 | * misc_register - register a miscellaneous device |
174 | * @misc: device structure | 173 | * @misc: device structure |
@@ -217,8 +216,8 @@ int misc_register(struct miscdevice * misc) | |||
217 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); | 216 | misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); |
218 | dev = MKDEV(MISC_MAJOR, misc->minor); | 217 | dev = MKDEV(MISC_MAJOR, misc->minor); |
219 | 218 | ||
220 | misc->this_device = device_create(misc_class, misc->parent, dev, NULL, | 219 | misc->this_device = device_create(misc_class, misc->parent, dev, |
221 | "%s", misc->name); | 220 | misc, "%s", misc->name); |
222 | if (IS_ERR(misc->this_device)) { | 221 | if (IS_ERR(misc->this_device)) { |
223 | err = PTR_ERR(misc->this_device); | 222 | err = PTR_ERR(misc->this_device); |
224 | goto out; | 223 | goto out; |
@@ -264,6 +263,15 @@ int misc_deregister(struct miscdevice *misc) | |||
264 | EXPORT_SYMBOL(misc_register); | 263 | EXPORT_SYMBOL(misc_register); |
265 | EXPORT_SYMBOL(misc_deregister); | 264 | EXPORT_SYMBOL(misc_deregister); |
266 | 265 | ||
266 | static char *misc_nodename(struct device *dev) | ||
267 | { | ||
268 | struct miscdevice *c = dev_get_drvdata(dev); | ||
269 | |||
270 | if (c->devnode) | ||
271 | return kstrdup(c->devnode, GFP_KERNEL); | ||
272 | return NULL; | ||
273 | } | ||
274 | |||
267 | static int __init misc_init(void) | 275 | static int __init misc_init(void) |
268 | { | 276 | { |
269 | int err; | 277 | int err; |
@@ -279,6 +287,7 @@ static int __init misc_init(void) | |||
279 | err = -EIO; | 287 | err = -EIO; |
280 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) | 288 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) |
281 | goto fail_printk; | 289 | goto fail_printk; |
290 | misc_class->nodename = misc_nodename; | ||
282 | return 0; | 291 | return 0; |
283 | 292 | ||
284 | fail_printk: | 293 | fail_printk: |