Skip to contentSkip to conversation

gpio: adp5585: use devm_blocking_notifier_chain_register()

PATCH Superseded Eliav Farber 4 participants 9 messages Jul 23 – Jul 26

Subsystems (10)
ACPI HID GPIO IIO +6 more subsystems

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 5/12 gpio: adp5585: use devm_blocking_notifier_chain_register()

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.

---
 drivers/gpio/gpio-adp5585.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)
drivers/gpio/gpio-adp5585.c +3 -17
index 6f10fc646008..7c04a7e86c8f 100644
@@ -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;
 	}
Signature · 1 line
2.47.3
#1 lore raw

PATCH 6/12 platform/x86: bitland-mifs-wmi: use devm_blocking_notifier_chain_register()

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.

---
 drivers/platform/x86/bitland-mifs-wmi.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/platform/x86/bitland-mifs-wmi.c +3 -14
index 3a373184519d..2bcd4f692a74 100644
@@ -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,
Signature · 1 line
2.47.3
#2 lore raw

PATCH 7/12 Input: adp5585: use devm_blocking_notifier_chain_register()

In reply to Eliav Farber

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.

---
 drivers/input/keyboard/adp5585-keys.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/input/keyboard/adp5585-keys.c +3 -15
index 017c95029180..0be4cc234c21 100644
@@ -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;
 
Signature · 1 line
2.47.3
maintainer Acked-by on v1 7/12
#3 lore raw

Re: [PATCH 07/12] Input: adp5585: use devm_blocking_notifier_chain_register()

Quoted 6 lines · Eliav Farber

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.

Feel free to merge with the rest of the series.

Thanks.

Signature · 1 line
Dmitry
#4 lore raw

PATCH 8/12 ACPI: APEI: GHES: use devm_blocking_notifier_chain_register()

In reply to Eliav Farber

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.

---
 drivers/acpi/apei/ghes.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/acpi/apei/ghes.c +3 -12
index 3236a3ce79d6..3aa29dcd70da 100644
@@ -689,21 +689,12 @@ void ghes_unregister_vendor_record_notifier(struct notifier_block *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);
 
Signature · 1 line
2.47.3
maintainer
#5 lore raw

Re: [PATCH 08/12] ACPI: APEI: GHES: use devm_blocking_notifier_chain_register()

Quoted 26 lines · On Thu, 23 Jul 2026 17:55:09 +0000 Eliav Farber <[email protected]> wrote:

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.

---
 drivers/acpi/apei/ghes.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/acpi/apei/ghes.c +0 -5
index 3236a3ce79d6..3aa29dcd70da 100644
@@ -689,21 +689,12 @@ void ghes_unregister_vendor_record_noti	fier(struct notifier_block *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)
 {

drivers/acpi/apei/ghes.c void ghes_unregister_vendor_record_noti fier(struct notifier_block *nb) · line 697

Quoted 10 lines
drivers/acpi/apei/ghes.c +3 -7
-	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);

Whilst correct, I'm less keen on this one because it looses the obvious connection to the non devm form. I suppose with the code being so near
to the non devm we can go with this.

For that matter why do we have the non devm variants? There are no users in tree. Can we just rip that and the unregister given this is removing the only users?

Thanks,

Jonathan

Quoted 3 lines
drivers/acpi/apei/ghes.c +0 -0
 }
 EXPORT_SYMBOL_GPL(devm_ghes_register_vendor_record_notifier);
 
#6 lore raw

RE: [PATCH 08/12] ACPI: APEI: GHES: use devm_blocking_notifier_chain_register()

Quoted 44 lines
Quoted 26 lines · On Thu, 23 Jul 2026 17:55:09 +0000 Eliav Farber <[email protected]> wrote:

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.

---
 drivers/acpi/apei/ghes.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/acpi/apei/ghes.c +0 -5
index 3236a3ce79d6..3aa29dcd70da 100644
@@ -689,21 +689,12 @@ void ghes_unregister_vendor_record_noti fier(struct notifier_block *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)
 {

drivers/acpi/apei/ghes.c void ghes_unregister_vendor_record_noti fier(struct notifier_block *nb) · line 697

Quoted 10 lines
drivers/acpi/apei/ghes.c +3 -7
-     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);

Whilst correct, I'm less keen on this one because it looses the obvious connection to the non devm form. I suppose with the code being so near
to the non devm we can go with this.

Quoted 2 lines

For that matter why do we have the non devm variants? There are no users in tree. Can we just rip that and the unregister given this is removing the only users?

You're right - there are no in-tree users of the non-devm ghes_register_vendor_record_notifier() and ghes_unregister_vendor_record_notifier(). The only callers (pcie-hisi-error.c and ghes-nvidia.c) both use the devm variant.

I'll update this patch in v2 to also remove the non-devm functions and their EXPORT_SYMBOL_GPL()s, along with the declarations and kerneldoc in include/acpi/ghes.h.

#7 lore raw

PATCH 9/12 platform/x86: uniwill-wmi: use devm_blocking_notifier_chain_register()

In reply to Eliav Farber

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.

---
 drivers/platform/x86/uniwill/uniwill-wmi.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
drivers/platform/x86/uniwill/uniwill-wmi.c +3 -14
index afcbfa4f7552..2ffa29a829ee 100644
@@ -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)
Signature · 1 line
2.47.3