Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers
@ 2026-07-26  4:56 Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 01/12] notifier: add device-managed registration APIs Eliav Farber
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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(),
devm_blocking_notifier_chain_register(), and
devm_raw_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 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 (12):
  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: 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                   |  10 ++
 kernel/notifier.c                          | 154 +++++++++++++++++++++
 kernel/reboot.c                            |  24 +---
 14 files changed, 194 insertions(+), 209 deletions(-)

-- 
2.47.3


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

* [PATCH v2 01/12] notifier: add device-managed registration APIs
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
@ 2026-07-26  4:56 ` Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 02/12] pwm: iqs620a: use devm_blocking_notifier_chain_register() Eliav Farber
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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

Add devm_atomic_notifier_chain_register(),
devm_blocking_notifier_chain_register(), and
devm_raw_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.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
Changes in v2:
- Drop 'extern' from new function prototypes (Bart Van Assche)
- Fix kerneldoc to use 'Return:' format (Bart Van Assche)
- Use <linux/device/devres.h> instead of <linux/device.h> (Andy Shevchenko)

 include/linux/notifier.h |  10 +++
 kernel/notifier.c        | 154 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 164 insertions(+)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 01b6c9d9956f..ccac9382478c 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -46,6 +46,7 @@
  * often but notifier_blocks will seldom be removed.
  */
 
+struct device;
 struct notifier_block;
 
 typedef	int (*notifier_fn_t)(struct notifier_block *nb,
@@ -145,10 +146,19 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
 
 extern int atomic_notifier_chain_register(struct atomic_notifier_head *nh,
 		struct notifier_block *nb);
+int devm_atomic_notifier_chain_register(struct device *dev,
+		struct atomic_notifier_head *nh,
+		struct notifier_block *nb);
 extern int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
 		struct notifier_block *nb);
+int devm_blocking_notifier_chain_register(struct device *dev,
+		struct blocking_notifier_head *nh,
+		struct notifier_block *nb);
 extern int raw_notifier_chain_register(struct raw_notifier_head *nh,
 		struct notifier_block *nb);
+int devm_raw_notifier_chain_register(struct device *dev,
+		struct raw_notifier_head *nh,
+		struct notifier_block *nb);
 extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
 		struct notifier_block *nb);
 
diff --git a/kernel/notifier.c b/kernel/notifier.c
index 2f9fe7c30287..d8c82b237586 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -1,4 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-only
+#include <linux/device/devres.h>
 #include <linux/kdebug.h>
 #include <linux/kprobes.h>
 #include <linux/export.h>
@@ -197,6 +198,56 @@ int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
 }
 EXPORT_SYMBOL_GPL(atomic_notifier_chain_unregister);
 
+struct atomic_notifier_chain_devres {
+	struct atomic_notifier_head *nh;
+	struct notifier_block *nb;
+};
+
+static void devm_atomic_notifier_chain_unregister(struct device *dev, void *res)
+{
+	struct atomic_notifier_chain_devres *dr = res;
+
+	atomic_notifier_chain_unregister(dr->nh, dr->nb);
+}
+
+/**
+ *	devm_atomic_notifier_chain_register - Device-managed atomic notifier registration
+ *	@dev: Device to tie the notifier lifetime to
+ *	@nh: Pointer to head of the atomic notifier chain
+ *	@n: New entry in notifier chain
+ *
+ *	Adds a notifier to an atomic notifier chain and registers a cleanup
+ *	action to automatically unregister it when @dev is unbound.
+ *
+ *	Return:
+ *	0 on success, negative errno on error.
+ */
+int devm_atomic_notifier_chain_register(struct device *dev,
+					struct atomic_notifier_head *nh,
+					struct notifier_block *n)
+{
+	struct atomic_notifier_chain_devres *dr;
+	int ret;
+
+	dr = devres_alloc(devm_atomic_notifier_chain_unregister,
+			  sizeof(*dr), GFP_KERNEL);
+	if (!dr)
+		return -ENOMEM;
+
+	ret = atomic_notifier_chain_register(nh, n);
+	if (ret) {
+		devres_free(dr);
+		return ret;
+	}
+
+	dr->nh = nh;
+	dr->nb = n;
+	devres_add(dev, dr);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(devm_atomic_notifier_chain_register);
+
 /**
  *	atomic_notifier_call_chain - Call functions in an atomic notifier chain
  *	@nh: Pointer to head of the atomic notifier chain
@@ -349,6 +400,58 @@ int blocking_notifier_call_chain_robust(struct blocking_notifier_head *nh,
 }
 EXPORT_SYMBOL_GPL(blocking_notifier_call_chain_robust);
 
+struct blocking_notifier_chain_devres {
+	struct blocking_notifier_head *nh;
+	struct notifier_block *nb;
+};
+
+static void devm_blocking_notifier_chain_unregister(struct device *dev,
+						    void *res)
+{
+	struct blocking_notifier_chain_devres *dr = res;
+
+	blocking_notifier_chain_unregister(dr->nh, dr->nb);
+}
+
+/**
+ *	devm_blocking_notifier_chain_register - Device-managed blocking notifier registration
+ *	@dev: Device to tie the notifier lifetime to
+ *	@nh: Pointer to head of the blocking notifier chain
+ *	@n: New entry in notifier chain
+ *
+ *	Adds a notifier to a blocking notifier chain and registers a cleanup
+ *	action to automatically unregister it when @dev is unbound.
+ *	Must be called in process context.
+ *
+ *	Return:
+ *	0 on success, negative errno on error.
+ */
+int devm_blocking_notifier_chain_register(struct device *dev,
+					  struct blocking_notifier_head *nh,
+					  struct notifier_block *n)
+{
+	struct blocking_notifier_chain_devres *dr;
+	int ret;
+
+	dr = devres_alloc(devm_blocking_notifier_chain_unregister,
+			  sizeof(*dr), GFP_KERNEL);
+	if (!dr)
+		return -ENOMEM;
+
+	ret = blocking_notifier_chain_register(nh, n);
+	if (ret) {
+		devres_free(dr);
+		return ret;
+	}
+
+	dr->nh = nh;
+	dr->nb = n;
+	devres_add(dev, dr);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(devm_blocking_notifier_chain_register);
+
 /**
  *	blocking_notifier_call_chain - Call functions in a blocking notifier chain
  *	@nh: Pointer to head of the blocking notifier chain
@@ -430,6 +533,57 @@ int raw_notifier_call_chain_robust(struct raw_notifier_head *nh,
 }
 EXPORT_SYMBOL_GPL(raw_notifier_call_chain_robust);
 
+struct raw_notifier_chain_devres {
+	struct raw_notifier_head *nh;
+	struct notifier_block *nb;
+};
+
+static void devm_raw_notifier_chain_unregister(struct device *dev, void *res)
+{
+	struct raw_notifier_chain_devres *dr = res;
+
+	raw_notifier_chain_unregister(dr->nh, dr->nb);
+}
+
+/**
+ *	devm_raw_notifier_chain_register - Device-managed raw notifier registration
+ *	@dev: Device to tie the notifier lifetime to
+ *	@nh: Pointer to head of the raw notifier chain
+ *	@n: New entry in notifier chain
+ *
+ *	Adds a notifier to a raw notifier chain and registers a cleanup
+ *	action to automatically unregister it when @dev is unbound.
+ *	All locking must be provided by the caller.
+ *
+ *	Return:
+ *	0 on success, negative errno on error.
+ */
+int devm_raw_notifier_chain_register(struct device *dev,
+				     struct raw_notifier_head *nh,
+				     struct notifier_block *n)
+{
+	struct raw_notifier_chain_devres *dr;
+	int ret;
+
+	dr = devres_alloc(devm_raw_notifier_chain_unregister,
+			  sizeof(*dr), GFP_KERNEL);
+	if (!dr)
+		return -ENOMEM;
+
+	ret = raw_notifier_chain_register(nh, n);
+	if (ret) {
+		devres_free(dr);
+		return ret;
+	}
+
+	dr->nh = nh;
+	dr->nb = n;
+	devres_add(dev, dr);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(devm_raw_notifier_chain_register);
+
 /**
  *	raw_notifier_call_chain - Call functions in a raw notifier chain
  *	@nh: Pointer to head of the raw notifier chain
-- 
2.47.3


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

* [PATCH v2 02/12] pwm: iqs620a: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 01/12] notifier: add device-managed registration APIs Eliav Farber
@ 2026-07-26  4:56 ` Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 03/12] iio: light: iqs621-als: " Eliav Farber
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
iqs620_pwm_notifier_unregister() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/pwm/pwm-iqs620a.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/pwm/pwm-iqs620a.c b/drivers/pwm/pwm-iqs620a.c
index 13e5e138c8e9..12f7b1415ed4 100644
--- a/drivers/pwm/pwm-iqs620a.c
+++ b/drivers/pwm/pwm-iqs620a.c
@@ -173,17 +173,7 @@ static const struct pwm_ops iqs620_pwm_ops = {
 	.get_state = iqs620_pwm_get_state,
 };
 
-static void iqs620_pwm_notifier_unregister(void *context)
-{
-	struct iqs620_pwm_private *iqs620_pwm = context;
-	int ret;
 
-	ret = blocking_notifier_chain_unregister(&iqs620_pwm->iqs62x->nh,
-						 &iqs620_pwm->notifier);
-	if (ret)
-		dev_err(iqs620_pwm->dev,
-			"Failed to unregister notifier: %d\n", ret);
-}
 
 static int iqs620_pwm_probe(struct platform_device *pdev)
 {
@@ -218,19 +208,14 @@ static int iqs620_pwm_probe(struct platform_device *pdev)
 	mutex_init(&iqs620_pwm->lock);
 
 	iqs620_pwm->notifier.notifier_call = iqs620_pwm_notifier;
-	ret = blocking_notifier_chain_register(&iqs620_pwm->iqs62x->nh,
-					       &iqs620_pwm->notifier);
+	ret = devm_blocking_notifier_chain_register(&pdev->dev,
+						    &iqs620_pwm->iqs62x->nh,
+						    &iqs620_pwm->notifier);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register notifier: %d\n", ret);
 		return ret;
 	}
 
-	ret = devm_add_action_or_reset(&pdev->dev,
-				       iqs620_pwm_notifier_unregister,
-				       iqs620_pwm);
-	if (ret)
-		return ret;
-
 	ret = devm_pwmchip_add(&pdev->dev, chip);
 	if (ret)
 		dev_err(&pdev->dev, "Failed to add device: %d\n", ret);
-- 
2.47.3


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

* [PATCH v2 03/12] iio: light: iqs621-als: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 01/12] notifier: add device-managed registration APIs Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 02/12] pwm: iqs620a: use devm_blocking_notifier_chain_register() Eliav Farber
@ 2026-07-26  4:56 ` Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 04/12] iio: position: iqs624: " Eliav Farber
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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
  Cc: Jonathan Cameron

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
iqs621_als_notifier_unregister() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/light/iqs621-als.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/light/iqs621-als.c b/drivers/iio/light/iqs621-als.c
index cd5843e3e2c3..f9d215ef1970 100644
--- a/drivers/iio/light/iqs621-als.c
+++ b/drivers/iio/light/iqs621-als.c
@@ -179,19 +179,6 @@ static int iqs621_als_notifier(struct notifier_block *notifier,
 	return NOTIFY_OK;
 }
 
-static void iqs621_als_notifier_unregister(void *context)
-{
-	struct iqs621_als_private *iqs621_als = context;
-	struct iio_dev *indio_dev = iqs621_als->indio_dev;
-	int ret;
-
-	ret = blocking_notifier_chain_unregister(&iqs621_als->iqs62x->nh,
-						 &iqs621_als->notifier);
-	if (ret)
-		dev_err(indio_dev->dev.parent,
-			"Failed to unregister notifier: %d\n", ret);
-}
-
 static int iqs621_als_read_raw(struct iio_dev *indio_dev,
 			       struct iio_chan_spec const *chan,
 			       int *val, int *val2, long mask)
@@ -563,19 +550,14 @@ static int iqs621_als_probe(struct platform_device *pdev)
 	mutex_init(&iqs621_als->lock);
 
 	iqs621_als->notifier.notifier_call = iqs621_als_notifier;
-	ret = blocking_notifier_chain_register(&iqs621_als->iqs62x->nh,
-					       &iqs621_als->notifier);
+	ret = devm_blocking_notifier_chain_register(&pdev->dev,
+						    &iqs621_als->iqs62x->nh,
+						    &iqs621_als->notifier);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register notifier: %d\n", ret);
 		return ret;
 	}
 
-	ret = devm_add_action_or_reset(&pdev->dev,
-				       iqs621_als_notifier_unregister,
-				       iqs621_als);
-	if (ret)
-		return ret;
-
 	return devm_iio_device_register(&pdev->dev, indio_dev);
 }
 
-- 
2.47.3


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

* [PATCH v2 04/12] iio: position: iqs624: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (2 preceding siblings ...)
  2026-07-26  4:56 ` [PATCH v2 03/12] iio: light: iqs621-als: " Eliav Farber
@ 2026-07-26  4:56 ` Eliav Farber
  2026-07-26  4:56 ` [PATCH v2 05/12] gpio: adp5585: " Eliav Farber
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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
  Cc: Jonathan Cameron

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
iqs624_pos_notifier_unregister() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
---
 drivers/iio/position/iqs624-pos.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/drivers/iio/position/iqs624-pos.c b/drivers/iio/position/iqs624-pos.c
index 8239239c6ee2..d2aa2df71457 100644
--- a/drivers/iio/position/iqs624-pos.c
+++ b/drivers/iio/position/iqs624-pos.c
@@ -96,19 +96,6 @@ static int iqs624_pos_notifier(struct notifier_block *notifier,
 	return ret;
 }
 
-static void iqs624_pos_notifier_unregister(void *context)
-{
-	struct iqs624_pos_private *iqs624_pos = context;
-	struct iio_dev *indio_dev = iqs624_pos->indio_dev;
-	int ret;
-
-	ret = blocking_notifier_chain_unregister(&iqs624_pos->iqs62x->nh,
-						 &iqs624_pos->notifier);
-	if (ret)
-		dev_err(indio_dev->dev.parent,
-			"Failed to unregister notifier: %d\n", ret);
-}
-
 static int iqs624_pos_angle_get(struct iqs62x_core *iqs62x, unsigned int *val)
 {
 	int ret;
@@ -255,19 +242,14 @@ static int iqs624_pos_probe(struct platform_device *pdev)
 	mutex_init(&iqs624_pos->lock);
 
 	iqs624_pos->notifier.notifier_call = iqs624_pos_notifier;
-	ret = blocking_notifier_chain_register(&iqs624_pos->iqs62x->nh,
-					       &iqs624_pos->notifier);
+	ret = devm_blocking_notifier_chain_register(&pdev->dev,
+						    &iqs624_pos->iqs62x->nh,
+						    &iqs624_pos->notifier);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to register notifier: %d\n", ret);
 		return ret;
 	}
 
-	ret = devm_add_action_or_reset(&pdev->dev,
-				       iqs624_pos_notifier_unregister,
-				       iqs624_pos);
-	if (ret)
-		return ret;
-
 	return devm_iio_device_register(&pdev->dev, indio_dev);
 }
 
-- 
2.47.3


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

* [PATCH v2 05/12] gpio: adp5585: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (3 preceding siblings ...)
  2026-07-26  4:56 ` [PATCH v2 04/12] iio: position: iqs624: " Eliav Farber
@ 2026-07-26  4:56 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 06/12] platform/x86: bitland-mifs-wmi: " Eliav Farber
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:56 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
  Cc: Bartosz Golaszewski

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
adp5585_gpio_unreg_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/gpio/gpio-adp5585.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/gpio-adp5585.c b/drivers/gpio/gpio-adp5585.c
index 6f10fc646008..7c04a7e86c8f 100644
--- a/drivers/gpio/gpio-adp5585.c
+++ b/drivers/gpio/gpio-adp5585.c
@@ -390,16 +390,6 @@ static const struct irq_chip adp5585_irq_chip = {
 	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
-static void adp5585_gpio_unreg_notifier(void *data)
-{
-	struct adp5585_gpio_dev *adp5585_gpio = data;
-	struct device *dev = adp5585_gpio->gpio_chip.parent;
-	struct adp5585_dev *adp5585 = dev_get_drvdata(dev->parent);
-
-	blocking_notifier_chain_unregister(&adp5585->event_notifier,
-					   &adp5585_gpio->nb);
-}
-
 static int adp5585_gpio_probe(struct platform_device *pdev)
 {
 	struct adp5585_dev *adp5585 = dev_get_drvdata(pdev->dev.parent);
@@ -450,13 +440,9 @@ static int adp5585_gpio_probe(struct platform_device *pdev)
 		girq->threaded = true;
 
 		adp5585_gpio->nb.notifier_call = adp5585_gpio_key_event;
-		ret = blocking_notifier_chain_register(&adp5585->event_notifier,
-						       &adp5585_gpio->nb);
-		if (ret)
-			return ret;
-
-		ret = devm_add_action_or_reset(dev, adp5585_gpio_unreg_notifier,
-					       adp5585_gpio);
+		ret = devm_blocking_notifier_chain_register(dev,
+							    &adp5585->event_notifier,
+							    &adp5585_gpio->nb);
 		if (ret)
 			return ret;
 	}
-- 
2.47.3


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

* [PATCH v2 06/12] platform/x86: bitland-mifs-wmi: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (4 preceding siblings ...)
  2026-07-26  4:56 ` [PATCH v2 05/12] gpio: adp5585: " Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 07/12] Input: adp5585: " Eliav Farber
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
bitland_notifier_unregister() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/platform/x86/bitland-mifs-wmi.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 3a373184519d..2bcd4f692a74 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -623,13 +623,6 @@ static const struct key_entry bitland_mifs_wmi_keymap[] = {
 	{ KE_END, 0 }
 };
 
-static void bitland_notifier_unregister(void *data)
-{
-	struct notifier_block *nb = data;
-
-	blocking_notifier_chain_unregister(&bitland_notifier_list, nb);
-}
-
 static int bitland_notifier_callback(struct notifier_block *nb,
 				     unsigned long action, void *data)
 {
@@ -729,13 +722,9 @@ static int bitland_mifs_wmi_probe(struct wmi_device *wdev, const void *context)
 		return ret;
 
 	drv_data->notifier.notifier_call = bitland_notifier_callback;
-	ret = blocking_notifier_chain_register(&bitland_notifier_list, &drv_data->notifier);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(&wdev->dev,
-				       bitland_notifier_unregister,
-				       &drv_data->notifier);
+	return devm_blocking_notifier_chain_register(&wdev->dev,
+						     &bitland_notifier_list,
+						     &drv_data->notifier);
 }
 
 static void bitland_mifs_wmi_notify(struct wmi_device *wdev,
-- 
2.47.3


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

* [PATCH v2 07/12] Input: adp5585: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (5 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 06/12] platform/x86: bitland-mifs-wmi: " Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 08/12] ACPI: APEI: GHES: " Eliav Farber
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
adp5585_keys_unreg_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/adp5585-keys.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/drivers/input/keyboard/adp5585-keys.c b/drivers/input/keyboard/adp5585-keys.c
index 017c95029180..0be4cc234c21 100644
--- a/drivers/input/keyboard/adp5585-keys.c
+++ b/drivers/input/keyboard/adp5585-keys.c
@@ -254,15 +254,6 @@ static int adp5585_keys_ev_handle(struct notifier_block *nb, unsigned long key,
 	return NOTIFY_STOP;
 }
 
-static void adp5585_keys_unreg_notifier(void *data)
-{
-	struct adp5585_kpad *kpad = data;
-	struct adp5585_dev *adp5585 = dev_get_drvdata(kpad->dev->parent);
-
-	blocking_notifier_chain_unregister(&adp5585->event_notifier,
-					   &kpad->nb);
-}
-
 static int adp5585_keys_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *id = platform_get_device_id(pdev);
@@ -318,12 +309,9 @@ static int adp5585_keys_probe(struct platform_device *pdev)
 		return error;
 
 	kpad->nb.notifier_call = adp5585_keys_ev_handle;
-	error = blocking_notifier_chain_register(&adp5585->event_notifier,
-						 &kpad->nb);
-	if (error)
-		return error;
-
-	error = devm_add_action_or_reset(dev, adp5585_keys_unreg_notifier, kpad);
+	error = devm_blocking_notifier_chain_register(dev,
+						      &adp5585->event_notifier,
+						      &kpad->nb);
 	if (error)
 		return error;
 
-- 
2.47.3


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

* [PATCH v2 08/12] ACPI: APEI: GHES: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (6 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 07/12] Input: adp5585: " Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 09/12] platform/x86: uniwill-wmi: " Eliav Farber
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
ghes_vendor_record_notifier_destroy() callback.

Since ghes_register_vendor_record_notifier() and
ghes_unregister_vendor_record_notifier() have no remaining in-tree
users, remove them along with their EXPORT_SYMBOL_GPL()s and
declarations in ghes.h.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
Changes in v2:
- Also remove unused ghes_register_vendor_record_notifier() and
  ghes_unregister_vendor_record_notifier() along with their
  EXPORT_SYMBOL_GPL()s and ghes.h declarations, since there are no
  in-tree callers (Jonathan Cameron)

 drivers/acpi/apei/ghes.c | 27 +++------------------------
 include/acpi/ghes.h      | 16 ----------------
 2 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 3236a3ce79d6..4419d430b7fd 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -677,33 +677,12 @@ static void ghes_handle_aer(struct acpi_hest_generic_data *gdata)
 
 static BLOCKING_NOTIFIER_HEAD(vendor_record_notify_list);
 
-int ghes_register_vendor_record_notifier(struct notifier_block *nb)
-{
-	return blocking_notifier_chain_register(&vendor_record_notify_list, nb);
-}
-EXPORT_SYMBOL_GPL(ghes_register_vendor_record_notifier);
-
-void ghes_unregister_vendor_record_notifier(struct notifier_block *nb)
-{
-	blocking_notifier_chain_unregister(&vendor_record_notify_list, nb);
-}
-EXPORT_SYMBOL_GPL(ghes_unregister_vendor_record_notifier);
-
-static void ghes_vendor_record_notifier_destroy(void *nb)
-{
-	ghes_unregister_vendor_record_notifier(nb);
-}
-
 int devm_ghes_register_vendor_record_notifier(struct device *dev,
 					      struct notifier_block *nb)
 {
-	int ret;
-
-	ret = ghes_register_vendor_record_notifier(nb);
-	if (ret)
-		return ret;
-
-	return devm_add_action_or_reset(dev, ghes_vendor_record_notifier_destroy, nb);
+	return devm_blocking_notifier_chain_register(dev,
+						     &vendor_record_notify_list,
+						     nb);
 }
 EXPORT_SYMBOL_GPL(devm_ghes_register_vendor_record_notifier);
 
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
index 8d7e5caef3f1..3cd13171c14f 100644
--- a/include/acpi/ghes.h
+++ b/include/acpi/ghes.h
@@ -55,22 +55,6 @@ enum {
 };
 
 #ifdef CONFIG_ACPI_APEI_GHES
-/**
- * ghes_register_vendor_record_notifier - register a notifier for vendor
- * records that the kernel would otherwise ignore.
- * @nb: pointer to the notifier_block structure of the event handler.
- *
- * return 0 : SUCCESS, non-zero : FAIL
- */
-int ghes_register_vendor_record_notifier(struct notifier_block *nb);
-
-/**
- * ghes_unregister_vendor_record_notifier - unregister the previously
- * registered vendor record notifier.
- * @nb: pointer to the notifier_block structure of the vendor record handler.
- */
-void ghes_unregister_vendor_record_notifier(struct notifier_block *nb);
-
 /**
  * devm_ghes_register_vendor_record_notifier - device-managed vendor
  * record notifier registration.
-- 
2.47.3


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

* [PATCH v2 09/12] platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (7 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 08/12] ACPI: APEI: GHES: " Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 10/12] gpio: eic-sprd: use devm_atomic_notifier_chain_register() Eliav Farber
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
devm_uniwill_wmi_unregister_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/platform/x86/uniwill/uniwill-wmi.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/platform/x86/uniwill/uniwill-wmi.c b/drivers/platform/x86/uniwill/uniwill-wmi.c
index afcbfa4f7552..2ffa29a829ee 100644
--- a/drivers/platform/x86/uniwill/uniwill-wmi.c
+++ b/drivers/platform/x86/uniwill/uniwill-wmi.c
@@ -26,22 +26,11 @@
 
 static BLOCKING_NOTIFIER_HEAD(uniwill_wmi_chain_head);
 
-static void devm_uniwill_wmi_unregister_notifier(void *data)
-{
-	struct notifier_block *nb = data;
-
-	blocking_notifier_chain_unregister(&uniwill_wmi_chain_head, nb);
-}
-
 int devm_uniwill_wmi_register_notifier(struct device *dev, struct notifier_block *nb)
 {
-	int ret;
-
-	ret = blocking_notifier_chain_register(&uniwill_wmi_chain_head, nb);
-	if (ret < 0)
-		return ret;
-
-	return devm_add_action_or_reset(dev, devm_uniwill_wmi_unregister_notifier, nb);
+	return devm_blocking_notifier_chain_register(dev,
+						     &uniwill_wmi_chain_head,
+						     nb);
 }
 
 static void uniwill_wmi_notify(struct wmi_device *wdev, union acpi_object *obj)
-- 
2.47.3


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

* [PATCH v2 10/12] gpio: eic-sprd: use devm_atomic_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (8 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 09/12] platform/x86: uniwill-wmi: " Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 11/12] gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register() Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 12/12] reboot: " Eliav Farber
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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
  Cc: Bartosz Golaszewski

Replace the atomic_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_atomic_notifier_chain_register(), removing the
sprd_eic_unregister_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/gpio/gpio-eic-sprd.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index 3b7ebcf12fe7..86eb9624d38a 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -601,13 +601,6 @@ static const struct irq_chip sprd_eic_irq = {
 	GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
-static void sprd_eic_unregister_notifier(void *data)
-{
-	struct notifier_block *nb = data;
-
-	atomic_notifier_chain_unregister(&sprd_eic_irq_notifier, nb);
-}
-
 static int sprd_eic_probe(struct platform_device *pdev)
 {
 	const struct sprd_eic_variant_data *pdata;
@@ -690,14 +683,8 @@ static int sprd_eic_probe(struct platform_device *pdev)
 	}
 
 	sprd_eic->irq_nb.notifier_call = sprd_eic_irq_notify;
-	ret = atomic_notifier_chain_register(&sprd_eic_irq_notifier,
-					     &sprd_eic->irq_nb);
-	if (ret)
-		return dev_err_probe(dev, ret,
-				     "Failed to register with the interrupt notifier");
-
-	return devm_add_action_or_reset(dev, sprd_eic_unregister_notifier,
-					&sprd_eic->irq_nb);
+	return devm_atomic_notifier_chain_register(dev, &sprd_eic_irq_notifier,
+						   &sprd_eic->irq_nb);
 }
 
 static const struct of_device_id sprd_eic_of_match[] = {
-- 
2.47.3


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

* [PATCH v2 11/12] gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (9 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 10/12] gpio: eic-sprd: use devm_atomic_notifier_chain_register() Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  2026-07-26  4:57 ` [PATCH v2 12/12] reboot: " Eliav Farber
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
gpio_unbind_unregister_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 drivers/gpio/gpiolib-kunit.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/gpio/gpiolib-kunit.c b/drivers/gpio/gpiolib-kunit.c
index 380b68f879e5..8ce9acc89e29 100644
--- a/drivers/gpio/gpiolib-kunit.c
+++ b/drivers/gpio/gpiolib-kunit.c
@@ -237,13 +237,6 @@ static int gpio_unbind_notify(struct notifier_block *nb, unsigned long action,
 	return NOTIFY_OK;
 }
 
-static void gpio_unbind_unregister_notifier(void *data)
-{
-	struct notifier_block *nb = data;
-
-	blocking_notifier_chain_unregister(&gpio_unbind_notifier, nb);
-}
-
 static int gpio_unbind_consumer_probe(struct platform_device *pdev)
 {
 	struct gpio_unbind_consumer_drvdata *data;
@@ -261,11 +254,8 @@ static int gpio_unbind_consumer_probe(struct platform_device *pdev)
 		return PTR_ERR(data->desc);
 
 	data->nb.notifier_call = gpio_unbind_notify;
-	ret = blocking_notifier_chain_register(&gpio_unbind_notifier, &data->nb);
-	if (ret)
-		return ret;
-
-	ret = devm_add_action_or_reset(dev, gpio_unbind_unregister_notifier, &data->nb);
+	ret = devm_blocking_notifier_chain_register(dev, &gpio_unbind_notifier,
+						    &data->nb);
 	if (ret)
 		return ret;
 
-- 
2.47.3


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

* [PATCH v2 12/12] reboot: use devm_blocking_notifier_chain_register()
  2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
                   ` (10 preceding siblings ...)
  2026-07-26  4:57 ` [PATCH v2 11/12] gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register() Eliav Farber
@ 2026-07-26  4:57 ` Eliav Farber
  11 siblings, 0 replies; 13+ messages in thread
From: Eliav Farber @ 2026-07-26  4:57 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

Replace the blocking_notifier_chain_register() +
devm_add_action_or_reset() pattern with a single call to
devm_blocking_notifier_chain_register(), removing the
devm_unregister_reboot_notifier() callback.

Signed-off-by: Eliav Farber <farbere@amazon.com>
---
 kernel/reboot.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/kernel/reboot.c b/kernel/reboot.c
index 695c33e75efd..557609419989 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -136,30 +136,10 @@ int unregister_reboot_notifier(struct notifier_block *nb)
 }
 EXPORT_SYMBOL(unregister_reboot_notifier);
 
-static void devm_unregister_reboot_notifier(struct device *dev, void *res)
-{
-	WARN_ON(unregister_reboot_notifier(*(struct notifier_block **)res));
-}
-
 int devm_register_reboot_notifier(struct device *dev, struct notifier_block *nb)
 {
-	struct notifier_block **rcnb;
-	int ret;
-
-	rcnb = devres_alloc(devm_unregister_reboot_notifier,
-			    sizeof(*rcnb), GFP_KERNEL);
-	if (!rcnb)
-		return -ENOMEM;
-
-	ret = register_reboot_notifier(nb);
-	if (!ret) {
-		*rcnb = nb;
-		devres_add(dev, rcnb);
-	} else {
-		devres_free(rcnb);
-	}
-
-	return ret;
+	return devm_blocking_notifier_chain_register(dev,
+						     &reboot_notifier_list, nb);
 }
 EXPORT_SYMBOL(devm_register_reboot_notifier);
 
-- 
2.47.3


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

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

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-26  4:56 [PATCH v2 00/12] notifier: add device-managed registration APIs and convert drivers Eliav Farber
2026-07-26  4:56 ` [PATCH v2 01/12] notifier: add device-managed registration APIs Eliav Farber
2026-07-26  4:56 ` [PATCH v2 02/12] pwm: iqs620a: use devm_blocking_notifier_chain_register() Eliav Farber
2026-07-26  4:56 ` [PATCH v2 03/12] iio: light: iqs621-als: " Eliav Farber
2026-07-26  4:56 ` [PATCH v2 04/12] iio: position: iqs624: " Eliav Farber
2026-07-26  4:56 ` [PATCH v2 05/12] gpio: adp5585: " Eliav Farber
2026-07-26  4:57 ` [PATCH v2 06/12] platform/x86: bitland-mifs-wmi: " Eliav Farber
2026-07-26  4:57 ` [PATCH v2 07/12] Input: adp5585: " Eliav Farber
2026-07-26  4:57 ` [PATCH v2 08/12] ACPI: APEI: GHES: " Eliav Farber
2026-07-26  4:57 ` [PATCH v2 09/12] platform/x86: uniwill-wmi: " Eliav Farber
2026-07-26  4:57 ` [PATCH v2 10/12] gpio: eic-sprd: use devm_atomic_notifier_chain_register() Eliav Farber
2026-07-26  4:57 ` [PATCH v2 11/12] gpio: gpiolib-kunit: use devm_blocking_notifier_chain_register() Eliav Farber
2026-07-26  4:57 ` [PATCH v2 12/12] reboot: " Eliav Farber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox