diff options
author | Kay Sievers <kay.sievers@suse.de> | 2006-06-15 09:31:56 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 15:40:49 -0400 |
commit | b9d9c82b4d081feb464f62dfc786c8621d09ecd2 (patch) | |
tree | 511d15b4d7aaba80a2c0fe49622a3224ca386122 /drivers/base/core.c | |
parent | 23681e479129854305da1da32f7f1eaf635ef22c (diff) |
[PATCH] Driver core: add generic "subsystem" link to all devices
Like the SUBSYTEM= key we find in the environment of the uevent, this
creates a generic "subsystem" link in sysfs for every device. Userspace
usually doesn't care at all if its a "class" or a "bus" device. This
provides an unified way to determine the subsytem of a device, regardless
of the way the driver core has created it.
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 252cf403f891..cc8bb97427d0 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -319,9 +319,12 @@ int device_add(struct device *dev) | |||
319 | dev->devt_attr = attr; | 319 | dev->devt_attr = attr; |
320 | } | 320 | } |
321 | 321 | ||
322 | if (dev->class) | 322 | if (dev->class) { |
323 | sysfs_create_link(&dev->kobj, &dev->class->subsys.kset.kobj, | ||
324 | "subsystem"); | ||
323 | sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, | 325 | sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj, |
324 | dev->bus_id); | 326 | dev->bus_id); |
327 | } | ||
325 | 328 | ||
326 | if ((error = device_pm_add(dev))) | 329 | if ((error = device_pm_add(dev))) |
327 | goto PMError; | 330 | goto PMError; |
@@ -422,8 +425,10 @@ void device_del(struct device * dev) | |||
422 | klist_del(&dev->knode_parent); | 425 | klist_del(&dev->knode_parent); |
423 | if (dev->devt_attr) | 426 | if (dev->devt_attr) |
424 | device_remove_file(dev, dev->devt_attr); | 427 | device_remove_file(dev, dev->devt_attr); |
425 | if (dev->class) | 428 | if (dev->class) { |
429 | sysfs_remove_link(&dev->kobj, "subsystem"); | ||
426 | sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); | 430 | sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); |
431 | } | ||
427 | device_remove_file(dev, &dev->uevent_attr); | 432 | device_remove_file(dev, &dev->uevent_attr); |
428 | 433 | ||
429 | /* Notify the platform of the removal, in case they | 434 | /* Notify the platform of the removal, in case they |