diff options
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index bc38085dbb10..4f53b758ac2b 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -30,6 +30,11 @@ | |||
30 | static int __must_check bus_rescan_devices_helper(struct device *dev, | 30 | static int __must_check bus_rescan_devices_helper(struct device *dev, |
31 | void *data); | 31 | void *data); |
32 | 32 | ||
33 | static void bus_put(struct bus_type *bus) | ||
34 | { | ||
35 | kset_put(&bus->subsys); | ||
36 | } | ||
37 | |||
33 | static ssize_t | 38 | static ssize_t |
34 | drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) | 39 | drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) |
35 | { | 40 | { |
@@ -124,7 +129,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) | |||
124 | int error; | 129 | int error; |
125 | if (get_bus(bus)) { | 130 | if (get_bus(bus)) { |
126 | error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); | 131 | error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); |
127 | put_bus(bus); | 132 | bus_put(bus); |
128 | } else | 133 | } else |
129 | error = -EINVAL; | 134 | error = -EINVAL; |
130 | return error; | 135 | return error; |
@@ -134,7 +139,7 @@ void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) | |||
134 | { | 139 | { |
135 | if (get_bus(bus)) { | 140 | if (get_bus(bus)) { |
136 | sysfs_remove_file(&bus->subsys.kobj, &attr->attr); | 141 | sysfs_remove_file(&bus->subsys.kobj, &attr->attr); |
137 | put_bus(bus); | 142 | bus_put(bus); |
138 | } | 143 | } |
139 | } | 144 | } |
140 | 145 | ||
@@ -186,7 +191,7 @@ static ssize_t driver_unbind(struct device_driver *drv, | |||
186 | err = count; | 191 | err = count; |
187 | } | 192 | } |
188 | put_device(dev); | 193 | put_device(dev); |
189 | put_bus(bus); | 194 | bus_put(bus); |
190 | return err; | 195 | return err; |
191 | } | 196 | } |
192 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); | 197 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); |
@@ -219,7 +224,7 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
219 | err = -ENODEV; | 224 | err = -ENODEV; |
220 | } | 225 | } |
221 | put_device(dev); | 226 | put_device(dev); |
222 | put_bus(bus); | 227 | bus_put(bus); |
223 | return err; | 228 | return err; |
224 | } | 229 | } |
225 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); | 230 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); |
@@ -459,7 +464,7 @@ out_subsys: | |||
459 | out_id: | 464 | out_id: |
460 | device_remove_attrs(bus, dev); | 465 | device_remove_attrs(bus, dev); |
461 | out_put: | 466 | out_put: |
462 | put_bus(dev->bus); | 467 | bus_put(dev->bus); |
463 | return error; | 468 | return error; |
464 | } | 469 | } |
465 | 470 | ||
@@ -509,7 +514,7 @@ void bus_remove_device(struct device * dev) | |||
509 | } | 514 | } |
510 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); | 515 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); |
511 | device_release_driver(dev); | 516 | device_release_driver(dev); |
512 | put_bus(dev->bus); | 517 | bus_put(dev->bus); |
513 | } | 518 | } |
514 | } | 519 | } |
515 | 520 | ||
@@ -646,7 +651,7 @@ int bus_add_driver(struct device_driver *drv) | |||
646 | out_unregister: | 651 | out_unregister: |
647 | kobject_unregister(&drv->kobj); | 652 | kobject_unregister(&drv->kobj); |
648 | out_put_bus: | 653 | out_put_bus: |
649 | put_bus(bus); | 654 | bus_put(bus); |
650 | return error; | 655 | return error; |
651 | } | 656 | } |
652 | 657 | ||
@@ -671,7 +676,7 @@ void bus_remove_driver(struct device_driver * drv) | |||
671 | driver_detach(drv); | 676 | driver_detach(drv); |
672 | module_remove_driver(drv); | 677 | module_remove_driver(drv); |
673 | kobject_unregister(&drv->kobj); | 678 | kobject_unregister(&drv->kobj); |
674 | put_bus(drv->bus); | 679 | bus_put(drv->bus); |
675 | } | 680 | } |
676 | 681 | ||
677 | 682 | ||
@@ -732,12 +737,6 @@ struct bus_type *get_bus(struct bus_type *bus) | |||
732 | struct bus_type, subsys) : NULL; | 737 | struct bus_type, subsys) : NULL; |
733 | } | 738 | } |
734 | 739 | ||
735 | void put_bus(struct bus_type * bus) | ||
736 | { | ||
737 | kset_put(&bus->subsys); | ||
738 | } | ||
739 | |||
740 | |||
741 | /** | 740 | /** |
742 | * find_bus - locate bus by name. | 741 | * find_bus - locate bus by name. |
743 | * @name: name of bus. | 742 | * @name: name of bus. |
@@ -874,7 +873,7 @@ out: | |||
874 | * @bus: bus. | 873 | * @bus: bus. |
875 | * | 874 | * |
876 | * Unregister the child subsystems and the bus itself. | 875 | * Unregister the child subsystems and the bus itself. |
877 | * Finally, we call put_bus() to release the refcount | 876 | * Finally, we call bus_put() to release the refcount |
878 | */ | 877 | */ |
879 | void bus_unregister(struct bus_type * bus) | 878 | void bus_unregister(struct bus_type * bus) |
880 | { | 879 | { |