[RFC PATCH 10/12] export bus_get() / bus_put()

Enrico Weigelt, metux IT consult
2021-02-08T22:27:22Z

---
drivers/base/bus.c | 6 ++++--
include/linux/device/bus.h | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index a06ae2786092..2ef92a3c5d7b 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -39,7 +39,7 @@ static struct kset *system_kset;
static int __must_check bus_rescan_devices_helper(struct device *dev,
void *data);

-static struct bus_type *bus_get(struct bus_type *bus)
+struct bus_type *bus_get(struct bus_type *bus)
{
if (bus) {
kset_get(&bus->p->subsys);
@@ -47,12 +47,14 @@ static struct bus_type *bus_get(struct bus_type *bus)
}
return NULL;
}
+EXPORT_SYMBOL_GPL(bus_get);

-static void bus_put(struct bus_type *bus)
+void bus_put(struct bus_type *bus)
{
if (bus)
kset_put(&bus->p->subsys);
}
+EXPORT_SYMBOL_GPL(bus_put);

static ssize_t drv_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf)
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index b4cbcfe176c5..8d6b45df0a82 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -120,6 +120,9 @@ extern void bus_unregister(struct bus_type *bus);

extern int __must_check bus_rescan_devices(struct bus_type *bus);

+struct bus_type *bus_get(struct bus_type *bus);
+void bus_put(struct bus_type *bus);
+
struct bus_attribute {
struct attribute attr;
ssize_t (*show)(struct bus_type *bus, char *buf);
--
2.11.0