diff options
| author | Eliav Farber <farbere@amazon.com> | 2026-08-16 06:06:00 +0000 |
|---|---|---|
| committer | Uwe Kleine-König <ukleinek@kernel.org> | 2026-08-21 12:42:27 +0200 |
| commit | e38b9eda475fd5ef8d256ae3ced566452c1c5d58 (patch) | |
| tree | c84c3ff431d8acd3c64f8e9486a3fa6f245ad235 /scripts/Makefile.thinlto | |
| parent | 8d3ae59288f1e7d58d76558a6ee96d533bc5019f (diff) | |
| download | linux-next-e38b9eda475fd5ef8d256ae3ced566452c1c5d58.tar.gz linux-next-e38b9eda475fd5ef8d256ae3ced566452c1c5d58.zip | |
notifier: add device-managed registration APIs
Add devm_atomic_notifier_chain_register() and
devm_blocking_notifier_chain_register() that automatically unregister
the notifier when the device is unbound.
Many drivers repeat the same boilerplate pattern:
1. Register the notifier with *_notifier_chain_register()
2. Check for error
3. Register a devm action to unregister on teardown
4. Implement a per-driver static unregister callback
With the new devm_*_notifier_chain_register() APIs, this reduces to a
single call with one error path, eliminating per-driver unregister
callbacks entirely.
The implementation follows the established devres pattern used by other
device-managed kernel APIs.
A devm variant for raw notifier chains is intentionally not included
because raw notifiers require the caller to provide all locking. The
devres teardown callback has no way to acquire the caller's lock, and
devres_alloc() with GFP_KERNEL cannot be used if the caller's lock is a
spinlock.
Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Linus Walleij <linusw@kernel.org>
Tested-by: Bradley Morgan <include@grrlz.net>
Acked-by: Bradley Morgan <include@grrlz.net> # kernel/
Link: https://patch.msgid.link/20260816060648.4030-2-farbere@amazon.com
[ukleinek: Add note to kdoc about devm_atomic_notifier_chain_register()
not being callable in atomic context.]
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
