]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
PCI/ACPI: Replace acpi_bus_get_device() with acpi_fetch_acpi_dev()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 26 Jan 2022 23:40:13 +0000 (00:40 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 4 Feb 2022 23:10:44 +0000 (17:10 -0600)
Replace acpi_bus_get_device() that is going to be dropped with
acpi_fetch_acpi_dev().

No intentional functional impact.

Link: https://lore.kernel.org/r/11930209.O9o76ZdvQC@kreacher
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pci/hotplug/acpiphp_glue.c
drivers/pci/hotplug/acpiphp_ibm.c
drivers/pci/pci-acpi.c

index 12f4b351be67015edaebc7196f57d4d44c863de8..6efa3d8db9a561907b4a7bfc7d1bc334a7fc7044 100644 (file)
@@ -226,9 +226,9 @@ static void acpiphp_post_dock_fixup(struct acpi_device *adev)
 static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
                                       void **rv)
 {
+       struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
        struct acpiphp_bridge *bridge = data;
        struct acpiphp_context *context;
-       struct acpi_device *adev;
        struct acpiphp_slot *slot;
        struct acpiphp_func *newfunc;
        acpi_status status = AE_OK;
@@ -238,6 +238,9 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
        struct pci_dev *pdev = bridge->pci_dev;
        u32 val;
 
+       if (!adev)
+               return AE_OK;
+
        status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
        if (ACPI_FAILURE(status)) {
                if (status != AE_NOT_FOUND)
@@ -245,8 +248,6 @@ static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
                                "can't evaluate _ADR (%#x)\n", status);
                return AE_OK;
        }
-       if (acpi_bus_get_device(handle, &adev))
-               return AE_OK;
 
        device = (adr >> 16) & 0xffff;
        function = adr & 0xffff;
index df48b3b03ab48d0ecb0b69092e908f8be4c1bc62..8f3a0a33f362bc60ba012419b865b8821c075531 100644 (file)
@@ -433,8 +433,9 @@ static int __init ibm_acpiphp_init(void)
                goto init_return;
        }
        pr_debug("%s: found IBM aPCI device\n", __func__);
-       if (acpi_bus_get_device(ibm_acpi_handle, &device)) {
-               pr_err("%s: acpi_bus_get_device failed\n", __func__);
+       device = acpi_fetch_acpi_dev(ibm_acpi_handle);
+       if (!device) {
+               pr_err("%s: acpi_fetch_acpi_dev failed\n", __func__);
                retval = -ENODEV;
                goto init_return;
        }
index a42dbf448860459ba8e105507ba3bb5cd956f612..1f15ab7eabf81dca8365f26144afbd5ff3ffa40c 100644 (file)
@@ -89,9 +89,9 @@ int acpi_get_rc_resources(struct device *dev, const char *hid, u16 segment,
                return -ENODEV;
        }
 
-       ret = acpi_bus_get_device(handle, &adev);
-       if (ret)
-               return ret;
+       adev = acpi_fetch_acpi_dev(handle);
+       if (!adev)
+               return -ENODEV;
 
        ret = acpi_get_rc_addr(adev, res);
        if (ret) {