diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-10-07 18:22:21 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-08 01:42:22 +0200 |
commit | 3eb215de26e6e94bf5fed9cb77230c383b30e53b (patch) | |
tree | 3500a575ea6458bf9f256427abebfa69458db151 /drivers/base | |
parent | Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/iee... (diff) | |
download | linux-3eb215de26e6e94bf5fed9cb77230c383b30e53b.tar.xz linux-3eb215de26e6e94bf5fed9cb77230c383b30e53b.zip |
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>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 67c92582d6ef..ec86d6fc2360 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -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; |