]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: HED: Switch over to devres-based resource management
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 21 May 2026 14:04:03 +0000 (16:04 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 May 2026 14:43:51 +0000 (16:43 +0200)
Use the newly introduced devm_acpi_install_notify_handler() for
installing an ACPI notify handler and since that function checks the
ACPI companion of the owner device against NULL internally, remove the
the explicit ACPI companion check from acpi_hed_probe().

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/7950702.EvYhyI6sBW@rafael.j.wysocki
drivers/acpi/hed.c

index 4b5dc95922ea7b9247c9f7a92a1e5f573bf9ec98..48562f53d3ab3c2c34d5d669528bd6ac627347ed 100644 (file)
@@ -50,19 +50,14 @@ static void acpi_hed_notify(acpi_handle handle, u32 event, void *data)
 
 static int acpi_hed_probe(struct platform_device *pdev)
 {
-       struct acpi_device *device;
        int err;
 
-       device = ACPI_COMPANION(&pdev->dev);
-       if (!device)
-               return -ENODEV;
-
        /* Only one hardware error device */
        if (hed_present)
                return -EINVAL;
 
-       err = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
-                                             acpi_hed_notify, device);
+       err = devm_acpi_install_notify_handler(&pdev->dev, ACPI_DEVICE_NOTIFY,
+                                              acpi_hed_notify, NULL);
        if (err)
                return err;
 
@@ -72,11 +67,7 @@ static int acpi_hed_probe(struct platform_device *pdev)
 
 static void acpi_hed_remove(struct platform_device *pdev)
 {
-       struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
-
        hed_present = false;
-       acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
-                                      acpi_hed_notify);
 }
 
 static struct platform_driver acpi_hed_driver = {