diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-11 10:23:31 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 09:00:48 +0100 |
commit | ed9f918174cb35ba51d2fc86a613305dd8bc4cfe (patch) | |
tree | a0a3fb21add95b53e1921168f758068aa0cd0c6c /drivers/base/bus.c | |
parent | driver core: bus.h: document bus notifiers better (diff) | |
download | linux-ed9f918174cb35ba51d2fc86a613305dd8bc4cfe.tar.xz linux-ed9f918174cb35ba51d2fc86a613305dd8bc4cfe.zip |
driver core: bus: move bus notifier logic into bus.c
The logic to touch the bus notifier was open-coded in numberous places
in the driver core. Clean that up by creating a local bus_notify()
function and have everyone call this function instead, making the
reading of the caller code simpler and easier to maintain over time.
Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230111092331.3946745-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 428c26c6b615..cf1b8f00b4c0 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -850,6 +850,14 @@ int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb) } EXPORT_SYMBOL_GPL(bus_unregister_notifier); +void bus_notify(struct device *dev, enum bus_notifier_event value) +{ + struct bus_type *bus = dev->bus; + + if (bus) + blocking_notifier_call_chain(&bus->p->bus_notifier, value, dev); +} + struct kset *bus_get_kset(struct bus_type *bus) { return &bus->p->subsys; |