Commit 3eb215de authored by Dmitry Torokhov's avatar Dmitry Torokhov Committed by Linus Torvalds

Driver core: fix SYSF_DEPRECATED breakage for nested classdevs

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: default avatarDmitry Torokhov <dtor@mail.ru>
Tested-by: default avatarAndrey Borzenkov <arvidjaar@mail.ru>
Tested-by: default avatarAnssi Hannula <anssi.hannula@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 85923b12
...@@ -586,9 +586,13 @@ void device_initialize(struct device *dev) ...@@ -586,9 +586,13 @@ void device_initialize(struct device *dev)
static struct kobject * get_device_parent(struct device *dev, static struct kobject * get_device_parent(struct device *dev,
struct device *parent) 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 */ * Set the parent to the class, not the parent device
if (dev->class) * 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; return &dev->class->subsys.kobj;
else if (parent) else if (parent)
return &parent->kobj; return &parent->kobj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment