diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-09-13 05:53:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-12 17:51:02 -0400 |
commit | 5901d0145c6b9e791bacd049eea11c9db9a3006e (patch) | |
tree | 1f474118fa9a644efc36c7e9adef7799ae8e1edd /drivers/base | |
parent | fc1ede5888ab8a9b3e7f8567b945beed35222885 (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.h | 1 | ||||
-rw-r--r-- | drivers/base/bus.c | 24 |
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); | |||
18 | extern int bus_add_device(struct device * dev); | 18 | extern int bus_add_device(struct device * dev); |
19 | extern void bus_attach_device(struct device * dev); | 19 | extern void bus_attach_device(struct device * dev); |
20 | extern void bus_remove_device(struct device * dev); | 20 | extern void bus_remove_device(struct device * dev); |
21 | extern struct bus_type *get_bus(struct bus_type * bus); | ||
22 | 21 | ||
23 | extern int bus_add_driver(struct device_driver *); | 22 | extern int bus_add_driver(struct device_driver *); |
24 | extern void bus_remove_driver(struct device_driver *); | 23 | extern 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 @@ | |||
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 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 | |||
33 | static void bus_put(struct bus_type *bus) | 39 | static 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 = { | |||
127 | int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) | 133 | int 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 | ||
138 | void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) | 144 | void 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) | |||
177 | static ssize_t driver_unbind(struct device_driver *drv, | 183 | static 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); | |||
204 | static ssize_t driver_bind(struct device_driver *drv, | 210 | static 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 | */ |
436 | int bus_add_device(struct device * dev) | 442 | int 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 | */ |
612 | int bus_add_driver(struct device_driver *drv) | 618 | int 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 | } |
732 | EXPORT_SYMBOL_GPL(device_reprobe); | 738 | EXPORT_SYMBOL_GPL(device_reprobe); |
733 | 739 | ||
734 | struct 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. |