lkml.org 
[lkml]   [2009]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fs/char_dev.c: remove useless loop
There are two useless lines in fs/char_dev.c.

In register_chrdev there is a loop to change all '/' into '!' in the
kernel object name.
This code is useless as the same substitution is in kobject_set_name_vargs in
lib/kobject.c:
228 /* ewww... some of these buggers have '/' in the name ... */
229 while ((s = strchr(kobj->name, '/')))
230 s[0] = '!';

kobject_set_name_vargs is called by kobject_set_name.
kobject_set_name is called just above the useless loop.

renzo

Signed-off-by: Renzo Davoli <renzo@cs.unibo.it>
--
--- a/fs/char_dev.c 2009-07-20 19:06:51.000000000 +0200
+++ b/fs/char_dev.c 2009-07-20 19:14:26.000000000 +0200
@@ -278,8 +278,6 @@
cdev->owner = fops->owner;
cdev->ops = fops;
kobject_set_name(&cdev->kobj, "%s", name);
- for (s = strchr(kobject_name(&cdev->kobj),'/'); s; s = strchr(s, '/'))
- *s = '!';

err = cdev_add(cdev, MKDEV(cd->major, 0), 256);
if (err)

\
 
 \ /
  Last update: 2009-07-20 20:03    [W:0.035 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site