aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-06-15 09:31:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-06-21 15:40:49 -0400
commitb9d9c82b4d081feb464f62dfc786c8621d09ecd2 (patch)
tree511d15b4d7aaba80a2c0fe49622a3224ca386122 /drivers/base/class.c
parent23681e479129854305da1da32f7f1eaf635ef22c (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/class.c')
-rw-r--r--drivers/base/class.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 50e841a33af0..9aa127460262 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -561,6 +561,7 @@ int class_device_add(struct class_device *class_dev)
561 goto out2; 561 goto out2;
562 562
563 /* add the needed attributes to this device */ 563 /* add the needed attributes to this device */
564 sysfs_create_link(&class_dev->kobj, &parent_class->subsys.kset.kobj, "subsystem");
564 class_dev->uevent_attr.attr.name = "uevent"; 565 class_dev->uevent_attr.attr.name = "uevent";
565 class_dev->uevent_attr.attr.mode = S_IWUSR; 566 class_dev->uevent_attr.attr.mode = S_IWUSR;
566 class_dev->uevent_attr.attr.owner = parent_class->owner; 567 class_dev->uevent_attr.attr.owner = parent_class->owner;
@@ -737,6 +738,7 @@ void class_device_del(struct class_device *class_dev)
737 sysfs_remove_link(&class_dev->kobj, "device"); 738 sysfs_remove_link(&class_dev->kobj, "device");
738 sysfs_remove_link(&class_dev->dev->kobj, class_name); 739 sysfs_remove_link(&class_dev->dev->kobj, class_name);
739 } 740 }
741 sysfs_remove_link(&class_dev->kobj, "subsystem");
740 class_device_remove_file(class_dev, &class_dev->uevent_attr); 742 class_device_remove_file(class_dev, &class_dev->uevent_attr);
741 if (class_dev->devt_attr) 743 if (class_dev->devt_attr)
742 class_device_remove_file(class_dev, class_dev->devt_attr); 744 class_device_remove_file(class_dev, class_dev->devt_attr);