Commit 5901d014 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent fc1ede58
...@@ -18,7 +18,6 @@ extern int attribute_container_init(void); ...@@ -18,7 +18,6 @@ extern int attribute_container_init(void);
extern int bus_add_device(struct device * dev); extern int bus_add_device(struct device * dev);
extern void bus_attach_device(struct device * dev); extern void bus_attach_device(struct device * dev);
extern void bus_remove_device(struct device * dev); extern void bus_remove_device(struct device * dev);
extern struct bus_type *get_bus(struct bus_type * bus);
extern int bus_add_driver(struct device_driver *); extern int bus_add_driver(struct device_driver *);
extern void bus_remove_driver(struct device_driver *); extern void bus_remove_driver(struct device_driver *);
......
...@@ -30,6 +30,12 @@ ...@@ -30,6 +30,12 @@
static int __must_check bus_rescan_devices_helper(struct device *dev, static int __must_check bus_rescan_devices_helper(struct device *dev,
void *data); void *data);
static struct bus_type *bus_get(struct bus_type *bus)
{
return bus ? container_of(kset_get(&bus->subsys),
struct bus_type, subsys) : NULL;
}
static void bus_put(struct bus_type *bus) static void bus_put(struct bus_type *bus)
{ {
kset_put(&bus->subsys); kset_put(&bus->subsys);
...@@ -127,7 +133,7 @@ static struct sysfs_ops bus_sysfs_ops = { ...@@ -127,7 +133,7 @@ static struct sysfs_ops bus_sysfs_ops = {
int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
{ {
int error; int error;
if (get_bus(bus)) { if (bus_get(bus)) {
error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
bus_put(bus); bus_put(bus);
} else } else
...@@ -137,7 +143,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) ...@@ -137,7 +143,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
{ {
if (get_bus(bus)) { if (bus_get(bus)) {
sysfs_remove_file(&bus->subsys.kobj, &attr->attr); sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
bus_put(bus); bus_put(bus);
} }
...@@ -177,7 +183,7 @@ static int driver_helper(struct device *dev, void *data) ...@@ -177,7 +183,7 @@ static int driver_helper(struct device *dev, void *data)
static ssize_t driver_unbind(struct device_driver *drv, static ssize_t driver_unbind(struct device_driver *drv,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct bus_type *bus = get_bus(drv->bus); struct bus_type *bus = bus_get(drv->bus);
struct device *dev; struct device *dev;
int err = -ENODEV; int err = -ENODEV;
...@@ -204,7 +210,7 @@ static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); ...@@ -204,7 +210,7 @@ static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
static ssize_t driver_bind(struct device_driver *drv, static ssize_t driver_bind(struct device_driver *drv,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct bus_type *bus = get_bus(drv->bus); struct bus_type *bus = bus_get(drv->bus);
struct device *dev; struct device *dev;
int err = -ENODEV; int err = -ENODEV;
...@@ -435,7 +441,7 @@ static inline void remove_deprecated_bus_links(struct device *dev) { } ...@@ -435,7 +441,7 @@ static inline void remove_deprecated_bus_links(struct device *dev) { }
*/ */
int bus_add_device(struct device * dev) int bus_add_device(struct device * dev)
{ {
struct bus_type * bus = get_bus(dev->bus); struct bus_type * bus = bus_get(dev->bus);
int error = 0; int error = 0;
if (bus) { if (bus) {
...@@ -611,7 +617,7 @@ static inline void remove_probe_files(struct bus_type *bus) {} ...@@ -611,7 +617,7 @@ static inline void remove_probe_files(struct bus_type *bus) {}
*/ */
int bus_add_driver(struct device_driver *drv) int bus_add_driver(struct device_driver *drv)
{ {
struct bus_type * bus = get_bus(drv->bus); struct bus_type * bus = bus_get(drv->bus);
int error = 0; int error = 0;
if (!bus) if (!bus)
...@@ -731,12 +737,6 @@ int device_reprobe(struct device *dev) ...@@ -731,12 +737,6 @@ int device_reprobe(struct device *dev)
} }
EXPORT_SYMBOL_GPL(device_reprobe); EXPORT_SYMBOL_GPL(device_reprobe);
struct bus_type *get_bus(struct bus_type *bus)
{
return bus ? container_of(kset_get(&bus->subsys),
struct bus_type, subsys) : NULL;
}
/** /**
* find_bus - locate bus by name. * find_bus - locate bus by name.
* @name: name of bus. * @name: name of bus.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment