driver core: remove fields from struct bus_type
struct bus_type is static everywhere in the kernel. This moves the kobject in the structure out of it, and a bunch of other private only to the driver core fields are now moved to a private structure. This lets us dynamically create the backing kobject properly and gives us the chance to be able to document to users exactly how to use the struct bus_type as there are no fields they can improperly access. Thanks to Kay for the build fixes on this patch. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
@@ -769,7 +769,7 @@ int device_add(struct device *dev)
|
||||
|
||||
/* notify clients of device entry (new way) */
|
||||
if (dev->bus)
|
||||
blocking_notifier_call_chain(&dev->bus->bus_notifier,
|
||||
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
|
||||
BUS_NOTIFY_ADD_DEVICE, dev);
|
||||
|
||||
error = device_create_file(dev, &uevent_attr);
|
||||
@@ -820,7 +820,7 @@ int device_add(struct device *dev)
|
||||
dpm_sysfs_remove(dev);
|
||||
PMError:
|
||||
if (dev->bus)
|
||||
blocking_notifier_call_chain(&dev->bus->bus_notifier,
|
||||
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
|
||||
BUS_NOTIFY_DEL_DEVICE, dev);
|
||||
device_remove_attrs(dev);
|
||||
AttrsError:
|
||||
@@ -999,7 +999,7 @@ void device_del(struct device * dev)
|
||||
if (platform_notify_remove)
|
||||
platform_notify_remove(dev);
|
||||
if (dev->bus)
|
||||
blocking_notifier_call_chain(&dev->bus->bus_notifier,
|
||||
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
|
||||
BUS_NOTIFY_DEL_DEVICE, dev);
|
||||
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
|
||||
kobject_del(&dev->kobj);
|
||||
|
Reference in New Issue
Block a user