diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-08 12:13:18 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-09 10:43:21 +0100 |
commit | beea7892d4339e50f15e5131d51a95503678fdf6 (patch) | |
tree | dbbd00401e81488b14b7e4616a5f7d99e4710b6a /drivers/base/bus.c | |
parent | adac0375380a7d3e50194cc5b03b676b0321bded (diff) |
driver core: bus: bus_get_kset() cleanup
Convert the bus_get_kset() function function to use bus_to_subsys() and
not use the back-pointer to the private structure.
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230208111330.439504-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index b831173071ec..105b6af924af 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -956,7 +956,16 @@ void bus_notify(struct device *dev, enum bus_notifier_event value) struct kset *bus_get_kset(struct bus_type *bus) { - return &bus->p->subsys; + struct subsys_private *sp = bus_to_subsys(bus); + struct kset *kset; + + if (!sp) + return NULL; + + kset = &sp->subsys; + subsys_put(sp); + + return kset; } EXPORT_SYMBOL_GPL(bus_get_kset); |