aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-09-13 05:53:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 17:51:02 -0400
commitfc1ede5888ab8a9b3e7f8567b945beed35222885 (patch)
treeeddc7763a7e90d7644e655ec94e82f6c25af5e05
parent1ef4cfac01fb5e98900f5bdb2a722aac1daff11b (diff)
Driver core: remove put_bus()
put_bus() should not be globally visable as it is not used by anything other than drivers/base/bus.c. This patch removes the visability of it, and renames it to match all of the other *_put() functions in the kernel. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/base.h1
-rw-r--r--drivers/base/bus.c29
2 files changed, 14 insertions, 16 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index 47eb02d9f1af..cebc7e754574 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -19,7 +19,6 @@ extern int bus_add_device(struct device * dev);
19extern void bus_attach_device(struct device * dev); 19extern void bus_attach_device(struct device * dev);
20extern void bus_remove_device(struct device * dev); 20extern void bus_remove_device(struct device * dev);
21extern struct bus_type *get_bus(struct bus_type * bus); 21extern struct bus_type *get_bus(struct bus_type * bus);
22extern void put_bus(struct bus_type * bus);
23 22
24extern int bus_add_driver(struct device_driver *); 23extern int bus_add_driver(struct device_driver *);
25extern void bus_remove_driver(struct device_driver *); 24extern void bus_remove_driver(struct device_driver *);
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 @@
30static int __must_check bus_rescan_devices_helper(struct device *dev, 30static int __must_check bus_rescan_devices_helper(struct device *dev,
31 void *data); 31 void *data);
32 32
33static void bus_put(struct bus_type *bus)
34{
35 kset_put(&bus->subsys);
36}
37
33static ssize_t 38static ssize_t
34drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) 39drv_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}
192static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); 197static 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}
225static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); 230static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
@@ -459,7 +464,7 @@ out_subsys:
459out_id: 464out_id:
460 device_remove_attrs(bus, dev); 465 device_remove_attrs(bus, dev);
461out_put: 466out_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)
646out_unregister: 651out_unregister:
647 kobject_unregister(&drv->kobj); 652 kobject_unregister(&drv->kobj);
648out_put_bus: 653out_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
735void 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 */
879void bus_unregister(struct bus_type * bus) 878void bus_unregister(struct bus_type * bus)
880{ 879{