summaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-06-15 15:31:56 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 12:40:49 -0700
commitb9d9c82b4d081feb464f62dfc786c8621d09ecd2 (patch)
tree511d15b4d7aaba80a2c0fe49622a3224ca386122 /drivers/base/bus.c
parent23681e479129854305da1da32f7f1eaf635ef22c (diff)
downloadop-kernel-dev-b9d9c82b4d081feb464f62dfc786c8621d09ecd2.zip
op-kernel-dev-b9d9c82b4d081feb464f62dfc786c8621d09ecd2.tar.gz
[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/bus.c')
-rw-r--r--drivers/base/bus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 64ba901..050d86d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -374,6 +374,7 @@ int bus_add_device(struct device * dev)
error = device_add_attrs(bus, dev);
if (!error) {
sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
+ sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "subsystem");
sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
}
}
@@ -408,6 +409,7 @@ void bus_attach_device(struct device * dev)
void bus_remove_device(struct device * dev)
{
if (dev->bus) {
+ sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->kobj, "bus");
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
OpenPOWER on IntegriCloud