[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1624497729-158864-2-git-send-email-kan.liang@linux.intel.com>
Date: Wed, 23 Jun 2021 18:22:03 -0700
From: kan.liang@...ux.intel.com
To: peterz@...radead.org, mingo@...hat.com,
linux-kernel@...r.kernel.org
Cc: eranian@...gle.com, namhyung@...nel.org, acme@...nel.org,
jolsa@...hat.com, ak@...ux.intel.com,
Kan Liang <kan.liang@...ux.intel.com>,
gregkh@...uxfoundation.org, rafael.j.wysocki@...el.com
Subject: [PATCH 1/7] driver core: Add a way to get to bus devices kset
From: Kan Liang <kan.liang@...ux.intel.com>
Add an accessor function to get to the bus devices kset associated with
a struct bus_type.
The user of this is the following perf changes, which will need to get
to the kobj of the 'devices' directory of a certain bus.
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
Cc: gregkh@...uxfoundation.org
Cc: rafael.j.wysocki@...el.com
---
drivers/base/bus.c | 6 ++++++
include/linux/device/bus.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 36d0c65..3d621a8 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -899,6 +899,12 @@ struct kset *bus_get_kset(struct bus_type *bus)
}
EXPORT_SYMBOL_GPL(bus_get_kset);
+struct kset *bus_get_devices_kset(struct bus_type *bus)
+{
+ return bus->p->devices_kset;
+}
+EXPORT_SYMBOL_GPL(bus_get_devices_kset);
+
struct klist *bus_get_device_klist(struct bus_type *bus)
{
return &bus->p->klist_devices;
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 1ea5e1d..0ab9273 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -283,6 +283,7 @@ extern int bus_unregister_notifier(struct bus_type *bus,
#define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */
extern struct kset *bus_get_kset(struct bus_type *bus);
+extern struct kset *bus_get_devices_kset(struct bus_type *bus);
extern struct klist *bus_get_device_klist(struct bus_type *bus);
#endif
--
2.7.4
Powered by blists - more mailing lists