aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index e3b101077804..b23eeb2d4ead 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -449,7 +449,7 @@ int bus_add_device(struct device * dev)
449 error = device_add_attrs(bus, dev); 449 error = device_add_attrs(bus, dev);
450 if (error) 450 if (error)
451 goto out_put; 451 goto out_put;
452 error = sysfs_create_link(&bus->devices.kobj, 452 error = sysfs_create_link(&bus->devices_kset->kobj,
453 &dev->kobj, dev->bus_id); 453 &dev->kobj, dev->bus_id);
454 if (error) 454 if (error)
455 goto out_id; 455 goto out_id;
@@ -466,7 +466,7 @@ int bus_add_device(struct device * dev)
466out_deprecated: 466out_deprecated:
467 sysfs_remove_link(&dev->kobj, "subsystem"); 467 sysfs_remove_link(&dev->kobj, "subsystem");
468out_subsys: 468out_subsys:
469 sysfs_remove_link(&bus->devices.kobj, dev->bus_id); 469 sysfs_remove_link(&bus->devices_kset->kobj, dev->bus_id);
470out_id: 470out_id:
471 device_remove_attrs(bus, dev); 471 device_remove_attrs(bus, dev);
472out_put: 472out_put:
@@ -512,7 +512,7 @@ void bus_remove_device(struct device * dev)
512 if (dev->bus) { 512 if (dev->bus) {
513 sysfs_remove_link(&dev->kobj, "subsystem"); 513 sysfs_remove_link(&dev->kobj, "subsystem");
514 remove_deprecated_bus_links(dev); 514 remove_deprecated_bus_links(dev);
515 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); 515 sysfs_remove_link(&dev->bus->devices_kset->kobj, dev->bus_id);
516 device_remove_attrs(dev->bus, dev); 516 device_remove_attrs(dev->bus, dev);
517 if (dev->is_registered) { 517 if (dev->is_registered) {
518 dev->is_registered = 0; 518 dev->is_registered = 0;
@@ -862,11 +862,12 @@ int bus_register(struct bus_type * bus)
862 if (retval) 862 if (retval)
863 goto bus_uevent_fail; 863 goto bus_uevent_fail;
864 864
865 kobject_set_name(&bus->devices.kobj, "devices"); 865 bus->devices_kset = kset_create_and_add("devices", NULL,
866 bus->devices.kobj.parent = &bus->subsys.kobj; 866 &bus->subsys.kobj);
867 retval = kset_register(&bus->devices); 867 if (!bus->devices_kset) {
868 if (retval) 868 retval = -ENOMEM;
869 goto bus_devices_fail; 869 goto bus_devices_fail;
870 }
870 871
871 kobject_set_name(&bus->drivers.kobj, "drivers"); 872 kobject_set_name(&bus->drivers.kobj, "drivers");
872 bus->drivers.kobj.parent = &bus->subsys.kobj; 873 bus->drivers.kobj.parent = &bus->subsys.kobj;
@@ -894,7 +895,7 @@ bus_attrs_fail:
894bus_probe_files_fail: 895bus_probe_files_fail:
895 kset_unregister(&bus->drivers); 896 kset_unregister(&bus->drivers);
896bus_drivers_fail: 897bus_drivers_fail:
897 kset_unregister(&bus->devices); 898 kset_unregister(bus->devices_kset);
898bus_devices_fail: 899bus_devices_fail:
899 bus_remove_file(bus, &bus_attr_uevent); 900 bus_remove_file(bus, &bus_attr_uevent);
900bus_uevent_fail: 901bus_uevent_fail:
@@ -916,7 +917,7 @@ void bus_unregister(struct bus_type * bus)
916 bus_remove_attrs(bus); 917 bus_remove_attrs(bus);
917 remove_probe_files(bus); 918 remove_probe_files(bus);
918 kset_unregister(&bus->drivers); 919 kset_unregister(&bus->drivers);
919 kset_unregister(&bus->devices); 920 kset_unregister(bus->devices_kset);
920 bus_remove_file(bus, &bus_attr_uevent); 921 bus_remove_file(bus, &bus_attr_uevent);
921 subsystem_unregister(&bus->subsys); 922 subsystem_unregister(&bus->subsys);
922} 923}