Commit fc1ede58 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1ef4cfac
...@@ -19,7 +19,6 @@ extern int bus_add_device(struct device * dev); ...@@ -19,7 +19,6 @@ 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 struct bus_type *get_bus(struct bus_type * bus);
extern void put_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,11 @@ ...@@ -30,6 +30,11 @@
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 void bus_put(struct bus_type *bus)
{
kset_put(&bus->subsys);
}
static ssize_t static ssize_t
drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
{ {
...@@ -124,7 +129,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) ...@@ -124,7 +129,7 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr)
int error; int error;
if (get_bus(bus)) { if (get_bus(bus)) {
error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); error = sysfs_create_file(&bus->subsys.kobj, &attr->attr);
put_bus(bus); bus_put(bus);
} else } else
error = -EINVAL; error = -EINVAL;
return error; return error;
...@@ -134,7 +139,7 @@ void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) ...@@ -134,7 +139,7 @@ void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr)
{ {
if (get_bus(bus)) { if (get_bus(bus)) {
sysfs_remove_file(&bus->subsys.kobj, &attr->attr); sysfs_remove_file(&bus->subsys.kobj, &attr->attr);
put_bus(bus); bus_put(bus);
} }
} }
...@@ -186,7 +191,7 @@ static ssize_t driver_unbind(struct device_driver *drv, ...@@ -186,7 +191,7 @@ static ssize_t driver_unbind(struct device_driver *drv,
err = count; err = count;
} }
put_device(dev); put_device(dev);
put_bus(bus); bus_put(bus);
return err; return err;
} }
static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind);
...@@ -219,7 +224,7 @@ static ssize_t driver_bind(struct device_driver *drv, ...@@ -219,7 +224,7 @@ static ssize_t driver_bind(struct device_driver *drv,
err = -ENODEV; err = -ENODEV;
} }
put_device(dev); put_device(dev);
put_bus(bus); bus_put(bus);
return err; return err;
} }
static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind);
...@@ -459,7 +464,7 @@ int bus_add_device(struct device * dev) ...@@ -459,7 +464,7 @@ int bus_add_device(struct device * dev)
out_id: out_id:
device_remove_attrs(bus, dev); device_remove_attrs(bus, dev);
out_put: out_put:
put_bus(dev->bus); bus_put(dev->bus);
return error; return error;
} }
...@@ -509,7 +514,7 @@ void bus_remove_device(struct device * dev) ...@@ -509,7 +514,7 @@ void bus_remove_device(struct device * dev)
} }
pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
device_release_driver(dev); device_release_driver(dev);
put_bus(dev->bus); bus_put(dev->bus);
} }
} }
...@@ -646,7 +651,7 @@ int bus_add_driver(struct device_driver *drv) ...@@ -646,7 +651,7 @@ int bus_add_driver(struct device_driver *drv)
out_unregister: out_unregister:
kobject_unregister(&drv->kobj); kobject_unregister(&drv->kobj);
out_put_bus: out_put_bus:
put_bus(bus); bus_put(bus);
return error; return error;
} }
...@@ -671,7 +676,7 @@ void bus_remove_driver(struct device_driver * drv) ...@@ -671,7 +676,7 @@ void bus_remove_driver(struct device_driver * drv)
driver_detach(drv); driver_detach(drv);
module_remove_driver(drv); module_remove_driver(drv);
kobject_unregister(&drv->kobj); kobject_unregister(&drv->kobj);
put_bus(drv->bus); bus_put(drv->bus);
} }
...@@ -732,12 +737,6 @@ struct bus_type *get_bus(struct bus_type *bus) ...@@ -732,12 +737,6 @@ struct bus_type *get_bus(struct bus_type *bus)
struct bus_type, subsys) : NULL; struct bus_type, subsys) : NULL;
} }
void put_bus(struct bus_type * bus)
{
kset_put(&bus->subsys);
}
/** /**
* find_bus - locate bus by name. * find_bus - locate bus by name.
* @name: name of bus. * @name: name of bus.
...@@ -874,7 +873,7 @@ int bus_register(struct bus_type * bus) ...@@ -874,7 +873,7 @@ int bus_register(struct bus_type * bus)
* @bus: bus. * @bus: bus.
* *
* Unregister the child subsystems and the bus itself. * Unregister the child subsystems and the bus itself.
* Finally, we call put_bus() to release the refcount * Finally, we call bus_put() to release the refcount
*/ */
void bus_unregister(struct bus_type * bus) void bus_unregister(struct bus_type * 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