From e320520b0a10d87feb160a859defca4fc29e578d Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 7 Oct 2007 12:22:21 -0400 Subject: [PATCH] --- yaml --- r: 65315 b: refs/heads/master c: 3eb215de26e6e94bf5fed9cb77230c383b30e53b h: refs/heads/master i: 65313: a03ca3d213e951bbe8f26d44d0264756f19b4871 65311: a9e7efeb9dbd0d7593853a2da84b3b87c3dd27fd v: v3 --- [refs] | 2 +- trunk/drivers/base/core.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 7578db45b56a..85e10ed8a4ed 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 85923b124624eb49ebef4731bb6b5670e792ff57 +refs/heads/master: 3eb215de26e6e94bf5fed9cb77230c383b30e53b diff --git a/trunk/drivers/base/core.c b/trunk/drivers/base/core.c index 67c92582d6ef..ec86d6fc2360 100644 --- a/trunk/drivers/base/core.c +++ b/trunk/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;