Commit 504450d0 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: bus.h: document bus notifiers better

The bus notifier values are not documented all that well, so clean this
up and make a real enumerated type for them and document them much
better.  When doing this, remove the hex values and just rely on the
enumerated type instead as that is all that is needed.
Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Reviewed-by: default avatarRafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230111092331.3946745-1-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9dd4541b
...@@ -257,21 +257,35 @@ extern int bus_register_notifier(struct bus_type *bus, ...@@ -257,21 +257,35 @@ extern int bus_register_notifier(struct bus_type *bus,
extern int bus_unregister_notifier(struct bus_type *bus, extern int bus_unregister_notifier(struct bus_type *bus,
struct notifier_block *nb); struct notifier_block *nb);
/* All 4 notifers below get called with the target struct device * /**
* as an argument. Note that those functions are likely to be called * enum bus_notifier_event - Bus Notifier events that have happened
* with the device lock held in the core, so be careful. * @BUS_NOTIFY_ADD_DEVICE: device is added to this bus
* @BUS_NOTIFY_DEL_DEVICE: device is about to be removed from this bus
* @BUS_NOTIFY_REMOVED_DEVICE: device is successfully removed from this bus
* @BUS_NOTIFY_BIND_DRIVER: a driver is about to be bound to this device on this bus
* @BUS_NOTIFY_BOUND_DRIVER: a driver is successfully bound to this device on this bus
* @BUS_NOTIFY_UNBIND_DRIVER: a driver is about to be unbound from this device on this bus
* @BUS_NOTIFY_UNBOUND_DRIVER: a driver is successfully unbound from this device on this bus
* @BUS_NOTIFY_DRIVER_NOT_BOUND: a driver failed to be bound to this device on this bus
*
* These are the value passed to a bus notifier when a specific event happens.
*
* Note that bus notifiers are likely to be called with the device lock already
* held by the driver core, so be careful in any notifier callback as to what
* you do with the device structure.
*
* All bus notifiers are called with the target struct device * as an argument.
*/ */
#define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */ enum bus_notifier_event {
#define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device to be removed */ BUS_NOTIFY_ADD_DEVICE,
#define BUS_NOTIFY_REMOVED_DEVICE 0x00000003 /* device removed */ BUS_NOTIFY_DEL_DEVICE,
#define BUS_NOTIFY_BIND_DRIVER 0x00000004 /* driver about to be BUS_NOTIFY_REMOVED_DEVICE,
bound */ BUS_NOTIFY_BIND_DRIVER,
#define BUS_NOTIFY_BOUND_DRIVER 0x00000005 /* driver bound to device */ BUS_NOTIFY_BOUND_DRIVER,
#define BUS_NOTIFY_UNBIND_DRIVER 0x00000006 /* driver about to be BUS_NOTIFY_UNBIND_DRIVER,
unbound */ BUS_NOTIFY_UNBOUND_DRIVER,
#define BUS_NOTIFY_UNBOUND_DRIVER 0x00000007 /* driver is unbound BUS_NOTIFY_DRIVER_NOT_BOUND,
from the device */ };
#define BUS_NOTIFY_DRIVER_NOT_BOUND 0x00000008 /* driver fails to be bound */
extern struct kset *bus_get_kset(struct bus_type *bus); extern struct kset *bus_get_kset(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