All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/13] notifier: add device-managed registration APIs and convert drivers
@ 2026-07-26 10:17 Eliav Farber
  2026-07-26 10:17 ` [PATCH v4 01/13] notifier: add device-managed registration APIs Eliav Farber
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: Eliav Farber @ 2026-07-26 10:17 UTC (permalink / raw)
  To: rafael, tony.luck, bp, guohanjun, mchehab, xueshuai, lenb,
	laurent.pinchart, linusw, brgl, orsonzhai, baolin.wang,
	zhang.lyra, jic23, dlechner, nuno.sa, andy, dmitry.torokhov,
	hansg, ilpo.jarvinen, W_Armin, ukleinek, fabio.m.de.francesco,
	kaihengf, ankita, leitao, farbere, pedro.pbg, paulmck, frederic,
	kees, linux-acpi, linux-kernel, linux-gpio, linux-pwm, linux-iio,
	linux-input, platform-driver-x86

Many drivers repeat the same boilerplate when registering notifiers with
device lifetime:

  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

This series adds devm_atomic_notifier_chain_register() and
devm_blocking_notifier_chain_register() that automatically unregister
the notifier when the device is unbound, then converts 11 drivers to use
them.

Each conversion eliminates a per-driver unregister callback and the
associated devm_add_action_or_reset() call, reducing code by ~15 lines
per driver.

The implementation follows the established devres pattern used by other
device-managed kernel APIs.

Changes in v4:
- Patch 8: split the removal of unused
  ghes_register_vendor_record_notifier() and
  ghes_unregister_vendor_record_notifier() into a separate preceding
  patch (Andy Shevchenko)

Changes in v3:
- Patch 1: drop devm_raw_notifier_chain_register() since raw notifiers
  require caller-provided locking which is incompatible with the devres
  teardown callback (Sashiko)
- Patch 12: fix commit message to accurately describe the old code as
  using devres_alloc() + register_reboot_notifier() (Sashiko)

Changes in v2:
- Patch 1: drop 'extern' from new function prototypes (Bart Van Assche)
- Patch 1: fix kerneldoc to use 'Return:' format (Bart Van Assche)
- Patch 1: use <linux/device/devres.h> instead of <linux/device.h>
  (Andy Shevchenko)
- Patch 8: also remove unused ghes_register_vendor_record_notifier() and
  ghes_unregister_vendor_record_notifier() along with their exports and
  ghes.h declarations (Jonathan Cameron)

Eliav Farber (13):
  notifier: add device-managed registration APIs
  pwm: iqs620a: use devm_blocking_notifier_chain_register()
  iio: light: iqs621-als: use devm_blocking_notifier_chain_register()
  iio: position: iqs624: use devm_blocking_notifier_chain_register()
  gpio: adp5585: use devm_blocking_notifier_chain_register()
  platform/x86: bitland-mifs-wmi: use
    devm_blocking_notifier_chain_register()
  Input: adp5585: use devm_blocking_notifier_chain_register()
  ACPI: APEI: GHES: remove unused
    ghes_{,un}register_vendor_record_notifier()
  ACPI: APEI: GHES: use devm_blocking_notifier_chain_register()
  platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
  gpio: eic-sprd: use devm_atomic_notifier_chain_register()
  gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register()
  reboot: use devm_blocking_notifier_chain_register()

 drivers/acpi/apei/ghes.c                   |  27 +-----
 drivers/gpio/gpio-adp5585.c                |  20 +---
 drivers/gpio/gpio-eic-sprd.c               |  17 +---
 drivers/gpio/gpiolib-kunit.c               |  14 +--
 drivers/iio/light/iqs621-als.c             |  24 +----
 drivers/iio/position/iqs624-pos.c          |  24 +----
 drivers/input/keyboard/adp5585-keys.c      |  18 +---
 drivers/platform/x86/bitland-mifs-wmi.c    |  17 +---
 drivers/platform/x86/uniwill/uniwill-wmi.c |  17 +---
 drivers/pwm/pwm-iqs620a.c                  |  21 +----
 include/acpi/ghes.h                        |  16 ----
 include/linux/notifier.h                   |   7 ++
 kernel/notifier.c                          | 103 +++++++++++++++++++++
 kernel/reboot.c                            |  24 +----
 14 files changed, 140 insertions(+), 209 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-07-26 14:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26 10:17 [PATCH v4 00/13] notifier: add device-managed registration APIs and convert drivers Eliav Farber
2026-07-26 10:17 ` [PATCH v4 01/13] notifier: add device-managed registration APIs Eliav Farber
2026-07-26 10:17 ` [PATCH v4 02/13] pwm: iqs620a: use devm_blocking_notifier_chain_register() Eliav Farber
2026-07-26 10:17 ` [PATCH v4 03/13] iio: light: iqs621-als: " Eliav Farber
2026-07-26 10:17 ` [PATCH v4 04/13] iio: position: iqs624: " Eliav Farber
2026-07-26 10:17 ` [PATCH v4 05/13] gpio: adp5585: " Eliav Farber
2026-07-26 10:27   ` sashiko-bot
2026-07-26 10:17 ` [PATCH v4 06/13] platform/x86: bitland-mifs-wmi: " Eliav Farber
2026-07-26 10:27   ` sashiko-bot
2026-07-26 10:17 ` [PATCH v4 07/13] Input: adp5585: " Eliav Farber
2026-07-26 10:17 ` [PATCH v4 08/13] ACPI: APEI: GHES: remove unused ghes_{,un}register_vendor_record_notifier() Eliav Farber
2026-07-26 10:17 ` [PATCH v4 09/13] ACPI: APEI: GHES: use devm_blocking_notifier_chain_register() Eliav Farber
2026-07-26 10:17 ` [PATCH v4 10/13] platform/x86: uniwill-wmi: " Eliav Farber
2026-07-26 10:17 ` [PATCH v4 11/13] gpio: eic-sprd: use devm_atomic_notifier_chain_register() Eliav Farber
2026-07-26 10:28   ` sashiko-bot
2026-07-26 10:17 ` [PATCH v4 12/13] gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register() Eliav Farber
2026-07-26 10:17 ` [PATCH v4 13/13] reboot: " Eliav Farber
2026-07-26 14:10 ` [PATCH v4 00/13] notifier: add device-managed registration APIs and convert drivers Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.