aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
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
commit5901d0145c6b9e791bacd049eea11c9db9a3006e (patch)
tree1f474118fa9a644efc36c7e9adef7799ae8e1edd /drivers/base
parentfc1ede5888ab8a9b3e7f8567b945beed35222885 (diff)
Driver core: remove get_bus()
get_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 *_get() functions in the kernel. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/base.h1
-rw-r--r--drivers/base/bus.c24
2 files changed, 12 insertions, 13 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h
index cebc7e754574..10b2fb6c9ce6 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -18,7 +18,6 @@ extern int attribute_container_init(void);
18extern int bus_add_device(struct device * dev); 18extern 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);
22 21
23extern int bus_add_driver(struct device_driver *); 22extern int bus_add_driver(struct device_driver *);
24extern void bus_remove_driver(struct device_driver *); 23extern void bus_remove_driver(struct device_driver *);
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 4f53b758ac2b..0a8d075f3e6c 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -30,6 +30,12 @@
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 struct bus_type *bus_get(struct bus_type *bus)
34{
35 return bus ? container_of(kset_get(&bus->subsys),
36 struct bus_type, subsys) : NULL;
37}
38
33static void bus_put(struct bus_type *bus) 39static void bus_put(struct bus_type *bus)
34{ 40{
35 kset_put(&bus->subsys); 41 kset_put(&bus->subsys);
@@ -127,7 +133,7 @@ static struct sysfs_ops bus_sysfs_ops = {
127int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) 133int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
128{ 134{
129 int error; 135 int error;
130 if (get_bus(bus)) { 136 if (bus_get(bus)) {
131 error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); 137 error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
132 bus_put(bus); 138 bus_put(bus);
133 } else 139 } else
@@ -137,7 +143,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
137 143
138void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) 144void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
139{ 145{
140 if (get_bus(bus)) { 146 if (bus_get(bus)) {
141 sysfs_remove_file(&bus->subsys.kobj, &attr->attr); 147 sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
142 bus_put(bus); 148 bus_put(bus);
143 } 149 }
@@ -177,7 +183,7 @@ static int driver_helper(struct device *dev, void *data)
177static ssize_t driver_unbind(struct device_driver *drv, 183static ssize_t driver_unbind(struct device_driver *drv,
178 const char *buf, size_t count) 184 const char *buf, size_t count)
179{ 185{
180 struct bus_type *bus = get_bus(drv->bus); 186 struct bus_type *bus = bus_get(drv->bus);
181 struct device *dev; 187 struct device *dev;
182 int err = -ENODEV; 188 int err = -ENODEV;
183 189
@@ -204,7 +210,7 @@ static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
204static ssize_t driver_bind(struct device_driver *drv, 210static ssize_t driver_bind(struct device_driver *drv,
205 const char *buf, size_t count) 211 const char *buf, size_t count)
206{ 212{
207 struct bus_type *bus = get_bus(drv->bus); 213 struct bus_type *bus = bus_get(drv->bus);
208 struct device *dev; 214 struct device *dev;
209 int err = -ENODEV; 215 int err = -ENODEV;
210 216
@@ -435,7 +441,7 @@ static inline void remove_deprecated_bus_links(struct device *dev) { }
435 */ 441 */
436int bus_add_device(struct device * dev) 442int bus_add_device(struct device * dev)
437{ 443{
438 struct bus_type * bus = get_bus(dev->bus); 444 struct bus_type * bus = bus_get(dev->bus);
439 int error = 0; 445 int error = 0;
440 446
441 if (bus) { 447 if (bus) {
@@ -611,7 +617,7 @@ static inline void remove_probe_files(struct bus_type *bus) {}
611 */ 617 */
612int bus_add_driver(struct device_driver *drv) 618int bus_add_driver(struct device_driver *drv)
613{ 619{
614 struct bus_type * bus = get_bus(drv->bus); 620 struct bus_type * bus = bus_get(drv->bus);
615 int error = 0; 621 int error = 0;
616 622
617 if (!bus) 623 if (!bus)
@@ -731,12 +737,6 @@ int device_reprobe(struct device *dev)
731} 737}
732EXPORT_SYMBOL_GPL(device_reprobe); 738EXPORT_SYMBOL_GPL(device_reprobe);
733 739
734struct bus_type *get_bus(struct bus_type *bus)
735{
736 return bus ? container_of(kset_get(&bus->subsys),
737 struct bus_type, subsys) : NULL;
738}
739
740/** 740/**
741 * find_bus - locate bus by name. 741 * find_bus - locate bus by name.
742 * @name: name of bus. 742 * @name: name of bus.