aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/bus.c2
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/core.c9
3 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 64ba9011d1a8..050d86d0b872 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -374,6 +374,7 @@ int bus_add_device(struct device * dev)
374 error = device_add_attrs(bus, dev); 374 error = device_add_attrs(bus, dev);
375 if (!error) { 375 if (!error) {
376 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id); 376 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
377 sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "subsystem");
377 sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus"); 378 sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
378 } 379 }
379 } 380 }
@@ -408,6 +409,7 @@ void bus_attach_device(struct device * dev)
408void bus_remove_device(struct device * dev) 409void bus_remove_device(struct device * dev)
409{ 410{
410 if (dev->bus) { 411 if (dev->bus) {
412 sysfs_remove_link(&dev->kobj, "subsystem");
411 sysfs_remove_link(&dev->kobj, "bus"); 413 sysfs_remove_link(&dev->kobj, "bus");
412 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); 414 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
413 device_remove_attrs(dev->bus, dev); 415 device_remove_attrs(dev->bus, dev);
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);
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