aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/bus.c15
-rw-r--r--drivers/base/driver.c2
2 files changed, 9 insertions, 8 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index b23eeb2d4ead..6796d3e46053 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -638,7 +638,7 @@ int bus_add_driver(struct device_driver *drv)
638 error = kobject_set_name(&drv->kobj, "%s", drv->name); 638 error = kobject_set_name(&drv->kobj, "%s", drv->name);
639 if (error) 639 if (error)
640 goto out_put_bus; 640 goto out_put_bus;
641 drv->kobj.kset = &bus->drivers; 641 drv->kobj.kset = bus->drivers_kset;
642 drv->kobj.ktype = &driver_ktype; 642 drv->kobj.ktype = &driver_ktype;
643 error = kobject_register(&drv->kobj); 643 error = kobject_register(&drv->kobj);
644 if (error) 644 if (error)
@@ -869,11 +869,12 @@ int bus_register(struct bus_type * bus)
869 goto bus_devices_fail; 869 goto bus_devices_fail;
870 } 870 }
871 871
872 kobject_set_name(&bus->drivers.kobj, "drivers"); 872 bus->drivers_kset = kset_create_and_add("drivers", NULL,
873 bus->drivers.kobj.parent = &bus->subsys.kobj; 873 &bus->subsys.kobj);
874 retval = kset_register(&bus->drivers); 874 if (!bus->drivers_kset) {
875 if (retval) 875 retval = -ENOMEM;
876 goto bus_drivers_fail; 876 goto bus_drivers_fail;
877 }
877 878
878 klist_init(&bus->klist_devices, klist_devices_get, klist_devices_put); 879 klist_init(&bus->klist_devices, klist_devices_get, klist_devices_put);
879 klist_init(&bus->klist_drivers, NULL, NULL); 880 klist_init(&bus->klist_drivers, NULL, NULL);
@@ -893,7 +894,7 @@ int bus_register(struct bus_type * bus)
893bus_attrs_fail: 894bus_attrs_fail:
894 remove_probe_files(bus); 895 remove_probe_files(bus);
895bus_probe_files_fail: 896bus_probe_files_fail:
896 kset_unregister(&bus->drivers); 897 kset_unregister(bus->drivers_kset);
897bus_drivers_fail: 898bus_drivers_fail:
898 kset_unregister(bus->devices_kset); 899 kset_unregister(bus->devices_kset);
899bus_devices_fail: 900bus_devices_fail:
@@ -916,7 +917,7 @@ void bus_unregister(struct bus_type * bus)
916 pr_debug("bus %s: unregistering\n", bus->name); 917 pr_debug("bus %s: unregistering\n", bus->name);
917 bus_remove_attrs(bus); 918 bus_remove_attrs(bus);
918 remove_probe_files(bus); 919 remove_probe_files(bus);
919 kset_unregister(&bus->drivers); 920 kset_unregister(bus->drivers_kset);
920 kset_unregister(bus->devices_kset); 921 kset_unregister(bus->devices_kset);
921 bus_remove_file(bus, &bus_attr_uevent); 922 bus_remove_file(bus, &bus_attr_uevent);
922 subsystem_unregister(&bus->subsys); 923 subsystem_unregister(&bus->subsys);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index eb11475293ed..1c9770dfb801 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -185,7 +185,7 @@ void driver_unregister(struct device_driver * drv)
185 */ 185 */
186struct device_driver *driver_find(const char *name, struct bus_type *bus) 186struct device_driver *driver_find(const char *name, struct bus_type *bus)
187{ 187{
188 struct kobject *k = kset_find_obj(&bus->drivers, name); 188 struct kobject *k = kset_find_obj(bus->drivers_kset, name);
189 if (k) 189 if (k)
190 return to_drv(k); 190 return to_drv(k);
191 return NULL; 191 return NULL;