Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 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>

authored by

Dmitry Torokhov and committed by
Linus Torvalds
3eb215de 85923b12

+7 -3
+7 -3
drivers/base/core.c
··· 586 586 static struct kobject * get_device_parent(struct device *dev, 587 587 struct device *parent) 588 588 { 589 - /* Set the parent to the class, not the parent device */ 590 - /* this keeps sysfs from having a symlink to make old udevs happy */ 591 - if (dev->class) 589 + /* 590 + * Set the parent to the class, not the parent device 591 + * for topmost devices in class hierarchy. 592 + * This keeps sysfs from having a symlink to make old 593 + * udevs happy 594 + */ 595 + if (dev->class && (!parent || parent->class != dev->class)) 592 596 return &dev->class->subsys.kobj; 593 597 else if (parent) 594 598 return &parent->kobj;