Skip to content

Commit

Permalink
Driver core: fix SYSF_DEPRECATED breakage for nested classdevs
Browse files Browse the repository at this point in the history
We should only reparent to a class former class devices that
form the base of class hierarchy. Nested devices should still
grow from their real parents.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Tested-by: Andrey Borzenkov <arvidjaar@mail.ru>
Tested-by: Anssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dmitry Torokhov authored and Linus Torvalds committed Oct 7, 2007
1 parent 85923b1 commit 3eb215d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,9 +586,13 @@ void device_initialize(struct device *dev)
static struct kobject * get_device_parent(struct device *dev,
struct device *parent)
{
/* Set the parent to the class, not the parent device */
/* this keeps sysfs from having a symlink to make old udevs happy */
if (dev->class)
/*
* Set the parent to the class, not the parent device
* for topmost devices in class hierarchy.
* This keeps sysfs from having a symlink to make old
* udevs happy
*/
if (dev->class && (!parent || parent->class != dev->class))
return &dev->class->subsys.kobj;
else if (parent)
return &parent->kobj;
Expand Down

0 comments on commit 3eb215d

Please sign in to comment.