Commit 0fed80f7 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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 <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cc972e89
...@@ -935,6 +935,12 @@ int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb) ...@@ -935,6 +935,12 @@ int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb)
} }
EXPORT_SYMBOL_GPL(bus_unregister_notifier); 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) int __init buses_init(void)
{ {
bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL);
......
...@@ -699,9 +699,12 @@ int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot, ...@@ -699,9 +699,12 @@ int __must_check pci_hp_change_slot_info(struct hotplug_slot *slot,
static int __init pci_hotplug_init (void) static int __init pci_hotplug_init (void)
{ {
int result; int result;
struct kset *pci_bus_kset;
pci_bus_kset = bus_get_kset(&pci_bus_type);
pci_hotplug_slots_kset = kset_create_and_add("slots", NULL, pci_hotplug_slots_kset = kset_create_and_add("slots", NULL,
&pci_bus_type.subsys.kobj); &pci_bus_kset->kobj);
if (!pci_hotplug_slots_kset) { if (!pci_hotplug_slots_kset) {
result = -ENOMEM; result = -ENOMEM;
err("Register subsys error\n"); err("Register subsys error\n");
......
...@@ -117,6 +117,8 @@ extern int bus_unregister_notifier(struct bus_type *bus, ...@@ -117,6 +117,8 @@ extern int bus_unregister_notifier(struct bus_type *bus,
#define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
unbound */ unbound */
extern struct kset *bus_get_kset(struct bus_type *bus);
struct device_driver { struct device_driver {
const char * name; const char * name;
struct bus_type * bus; struct bus_type * bus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment