]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPI: NFIT: core: Use devm_acpi_install_notify_handler()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 21 May 2026 14:01:16 +0000 (16:01 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 May 2026 14:43:51 +0000 (16:43 +0200)
Now that devm_acpi_install_notify_handler() is available, use it in
acpi_nfit_probe() instead of a custom devm action removing an ACPI
notify handler installed via acpi_dev_install_notify_handler().

Also drop the explicit ACPI_COMPANION() check against NULL that is
not necessary any more becuase devm_acpi_install_notify_handler()
carries out an equivalent check internally and use ACPI_HANDLE() to
retrieve the platform device's ACPI handle.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3048737.e9J7NaK4W3@rafael.j.wysocki
drivers/acpi/nfit/core.c

index 9304ac996d41adc8f6b3cff2f29a642842fd451e..5cab62f618c8e60e89157d06d63cb4f811f139c6 100644 (file)
@@ -3298,14 +3298,6 @@ static void acpi_nfit_notify(acpi_handle handle, u32 event, void *data)
        device_unlock(dev);
 }
 
-static void acpi_nfit_remove_notify_handler(void *data)
-{
-       struct acpi_device *adev = data;
-
-       acpi_dev_remove_notify_handler(adev, ACPI_DEVICE_NOTIFY,
-                                      acpi_nfit_notify);
-}
-
 void acpi_nfit_shutdown(void *data)
 {
        struct acpi_nfit_desc *acpi_desc = data;
@@ -3342,22 +3334,12 @@ static int acpi_nfit_probe(struct platform_device *pdev)
        struct acpi_nfit_desc *acpi_desc;
        struct device *dev = &pdev->dev;
        struct acpi_table_header *tbl;
-       struct acpi_device *adev;
        acpi_status status = AE_OK;
        acpi_size sz;
        int rc = 0;
 
-       adev = ACPI_COMPANION(&pdev->dev);
-       if (!adev)
-               return -ENODEV;
-
-       rc = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
-                                            acpi_nfit_notify, dev);
-       if (rc)
-               return rc;
-
-       rc = devm_add_action_or_reset(dev, acpi_nfit_remove_notify_handler,
-                                       adev);
+       rc = devm_acpi_install_notify_handler(dev, ACPI_DEVICE_NOTIFY,
+                                             acpi_nfit_notify, dev);
        if (rc)
                return rc;
 
@@ -3388,7 +3370,7 @@ static int acpi_nfit_probe(struct platform_device *pdev)
        acpi_desc->acpi_header = *tbl;
 
        /* Evaluate _FIT and override with that if present */
-       status = acpi_evaluate_object(adev->handle, "_FIT", NULL, &buf);
+       status = acpi_evaluate_object(ACPI_HANDLE(dev), "_FIT", NULL, &buf);
        if (ACPI_SUCCESS(status) && buf.length > 0) {
                union acpi_object *obj = buf.pointer;