From foo@baz Tue Apr 9 12:12:43 2002 Date: Thu, 1 Nov 2007 19:41:16 -0700 To: Greg KH From: Greg Kroah-Hartman Subject: driver core: add way to get to bus kset This allows an easier way to get to the kset associated with a struct bus_type (you have three to choose from...) This will make it easier to move these fields to be dynamic in a future patch. Cc: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- drivers/base/bus.c | 6 ++++++ drivers/pci/hotplug/pci_hotplug_core.c | 5 ++++- include/linux/device.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -935,6 +935,12 @@ int bus_unregister_notifier(struct bus_t } EXPORT_SYMBOL_GPL(bus_unregister_notifier); +struct kset *bus_get_kset(struct bus_type *bus) +{ + return &bus->subsys; +} +EXPORT_SYMBOL_GPL(bus_get_kset); + int __init buses_init(void) { bus_kset = kset_create_and_register("bus", &bus_uevent_ops, NULL); --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c @@ -699,9 +699,12 @@ int __must_check pci_hp_change_slot_info static int __init pci_hotplug_init (void) { int result; + struct kset *pci_bus_kset; + + pci_bus_kset = bus_get_kset(&pci_bus_type); pci_hotplug_slots_kset = kset_create_and_register("slots", NULL, - &pci_bus_type.subsys.kobj); + &pci_bus_kset->kobj); if (!pci_hotplug_slots_kset) { result = -ENOMEM; err("Register subsys error\n"); --- a/include/linux/device.h +++ b/include/linux/device.h @@ -117,6 +117,8 @@ extern int bus_unregister_notifier(struc #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be unbound */ +extern struct kset *bus_get_kset(struct bus_type *bus); + struct device_driver { const char * name; struct bus_type * bus;