Commit 3eb215de26e6e94bf5fed9cb77230c383b30e53b
Committed by
Linus Torvalds
1 parent
85923b1246
Exists in
master
and in
20 other branches
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>
Showing 1 changed file with 7 additions and 3 deletions Side-by-side Diff
drivers/base/core.c
... | ... | @@ -586,9 +586,13 @@ |
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; |