* [PATCH v1] ACPI: fan: Use devm_acpi_install_notify_handler()
@ 2026-07-08 18:35 Rafael J. Wysocki
2026-07-08 20:03 ` Armin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-07-08 18:35 UTC (permalink / raw)
To: Linux ACPI; +Cc: LKML, Linux PM, Armin Wolf
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Replace the custom open-coded devres-based management of an ACPI notify
handler with devm_acpi_install_notify_handler().
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/fan_core.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
--- a/drivers/acpi/fan_core.c
+++ b/drivers/acpi/fan_core.c
@@ -489,26 +489,6 @@ static void acpi_fan_notify_handler(acpi
}
}
-static void acpi_fan_notify_remove(void *data)
-{
- struct acpi_fan *fan = data;
-
- acpi_remove_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY, acpi_fan_notify_handler);
-}
-
-static int devm_acpi_fan_notify_init(struct device *dev)
-{
- struct acpi_fan *fan = dev_get_drvdata(dev);
- acpi_status status;
-
- status = acpi_install_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY,
- acpi_fan_notify_handler, dev);
- if (ACPI_FAILURE(status))
- return -EIO;
-
- return devm_add_action_or_reset(dev, acpi_fan_notify_remove, fan);
-}
-
static int acpi_fan_probe(struct platform_device *pdev)
{
int result = 0;
@@ -556,7 +536,10 @@ static int acpi_fan_probe(struct platfor
if (result)
return result;
- result = devm_acpi_fan_notify_init(&pdev->dev);
+ result = devm_acpi_install_notify_handler(&pdev->dev,
+ ACPI_DEVICE_NOTIFY,
+ acpi_fan_notify_handler,
+ &pdev->dev);
if (result)
return result;
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v1] ACPI: fan: Use devm_acpi_install_notify_handler()
2026-07-08 18:35 [PATCH v1] ACPI: fan: Use devm_acpi_install_notify_handler() Rafael J. Wysocki
@ 2026-07-08 20:03 ` Armin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Armin Wolf @ 2026-07-08 20:03 UTC (permalink / raw)
To: Rafael J. Wysocki, Linux ACPI; +Cc: LKML, Linux PM
Am 08.07.26 um 20:35 schrieb Rafael J. Wysocki:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Replace the custom open-coded devres-based management of an ACPI notify
> handler with devm_acpi_install_notify_handler().
>
> No intentional functional impact.
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/fan_core.c | 25 ++++---------------------
> 1 file changed, 4 insertions(+), 21 deletions(-)
>
> --- a/drivers/acpi/fan_core.c
> +++ b/drivers/acpi/fan_core.c
> @@ -489,26 +489,6 @@ static void acpi_fan_notify_handler(acpi
> }
> }
>
> -static void acpi_fan_notify_remove(void *data)
> -{
> - struct acpi_fan *fan = data;
> -
> - acpi_remove_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY, acpi_fan_notify_handler);
> -}
> -
> -static int devm_acpi_fan_notify_init(struct device *dev)
> -{
> - struct acpi_fan *fan = dev_get_drvdata(dev);
> - acpi_status status;
> -
> - status = acpi_install_notify_handler(fan->handle, ACPI_DEVICE_NOTIFY,
> - acpi_fan_notify_handler, dev);
> - if (ACPI_FAILURE(status))
> - return -EIO;
> -
> - return devm_add_action_or_reset(dev, acpi_fan_notify_remove, fan);
> -}
> -
> static int acpi_fan_probe(struct platform_device *pdev)
> {
> int result = 0;
> @@ -556,7 +536,10 @@ static int acpi_fan_probe(struct platfor
> if (result)
> return result;
>
> - result = devm_acpi_fan_notify_init(&pdev->dev);
> + result = devm_acpi_install_notify_handler(&pdev->dev,
> + ACPI_DEVICE_NOTIFY,
> + acpi_fan_notify_handler,
> + &pdev->dev);
> if (result)
> return result;
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-08 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-08 18:35 [PATCH v1] ACPI: fan: Use devm_acpi_install_notify_handler() Rafael J. Wysocki
2026-07-08 20:03 ` Armin Wolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox