error = device_add_attrs(bus, dev);
if (error)
goto out_put;
- error = sysfs_create_link(&bus->devices.kobj,
+ error = sysfs_create_link(&bus->devices_kset->kobj,
&dev->kobj, dev->bus_id);
if (error)
goto out_id;
out_deprecated:
sysfs_remove_link(&dev->kobj, "subsystem");
out_subsys:
- sysfs_remove_link(&bus->devices.kobj, dev->bus_id);
+ sysfs_remove_link(&bus->devices_kset->kobj, dev->bus_id);
out_id:
device_remove_attrs(bus, dev);
out_put:
if (dev->bus) {
sysfs_remove_link(&dev->kobj, "subsystem");
remove_deprecated_bus_links(dev);
- sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
+ sysfs_remove_link(&dev->bus->devices_kset->kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev);
if (dev->is_registered) {
dev->is_registered = 0;
if (retval)
goto bus_uevent_fail;
- kobject_set_name(&bus->devices.kobj, "devices");
- bus->devices.kobj.parent = &bus->subsys.kobj;
- retval = kset_register(&bus->devices);
- if (retval)
+ bus->devices_kset = kset_create_and_add("devices", NULL,
+ &bus->subsys.kobj);
+ if (!bus->devices_kset) {
+ retval = -ENOMEM;
goto bus_devices_fail;
+ }
kobject_set_name(&bus->drivers.kobj, "drivers");
bus->drivers.kobj.parent = &bus->subsys.kobj;
bus_probe_files_fail:
kset_unregister(&bus->drivers);
bus_drivers_fail:
- kset_unregister(&bus->devices);
+ kset_unregister(bus->devices_kset);
bus_devices_fail:
bus_remove_file(bus, &bus_attr_uevent);
bus_uevent_fail:
bus_remove_attrs(bus);
remove_probe_files(bus);
kset_unregister(&bus->drivers);
- kset_unregister(&bus->devices);
+ kset_unregister(bus->devices_kset);
bus_remove_file(bus, &bus_attr_uevent);
subsystem_unregister(&bus->subsys);
}