Skip to contentSkip to conversation

ACPI: fan: Use devm_acpi_install_notify_handler()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jul 8 ACPI

lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 ACPI: fan: Use devm_acpi_install_notify_handler()

From: "Rafael J. Wysocki" <[email protected]>

Replace the custom open-coded devres-based management of an ACPI notify handler with devm_acpi_install_notify_handler().

No intentional functional impact.

---
 drivers/acpi/fan_core.c |   25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
drivers/acpi/fan_core.c +4 -21
@@ -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;
 
Reviewed-by on v1 1/1
#1 lore raw

Am 08.07.26 um 20:35 schrieb Rafael J. Wysocki:

Quoted 6 lines

From: "Rafael J. Wysocki" <[email protected]>

Replace the custom open-coded devres-based management of an ACPI notify handler with devm_acpi_install_notify_handler().

No intentional functional impact.

Quoted 49 lines
---
  drivers/acpi/fan_core.c |   25 ++++---------------------
  1 file changed, 4 insertions(+), 21 deletions(-)
drivers/acpi/fan_core.c +4 -21
@@ -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;