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>
This commit is contained in:
Greg Kroah-Hartman 2023-02-08 12:13:18 +01:00
parent adac037538
commit beea7892d4

View File

@ -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);