diff options
author | Rafael J. Wysocki | 2021-10-12 15:47:46 +0200 |
---|---|---|
committer | Rafael J. Wysocki | 2021-10-12 15:47:46 +0200 |
commit | 87440d70a4bf2e6196496cba75a757a6367d8b04 (patch) | |
tree | 2b0a3eb2b89260d63faa221d68aa57ea55015211 /drivers/acpi | |
parent | 3fb937f441c64af1eec60bfd3732f64001fcc534 (diff) | |
parent | 2ef5236660b677db15527b6d6235af4ce38ea0e3 (diff) |
Merge back ACPI PCI material for v5.16.
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/glue.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 7a33a6d985f8..17ec6e57c4b7 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -17,6 +17,8 @@ #include <linux/rwsem.h> #include <linux/acpi.h> #include <linux/dma-mapping.h> +#include <linux/pci.h> +#include <linux/pci-acpi.h> #include <linux/platform_device.h> #include "internal.h" @@ -287,12 +289,13 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one); void acpi_device_notify(struct device *dev) { - struct acpi_bus_type *type = acpi_get_bus_type(dev); struct acpi_device *adev; int ret; ret = acpi_bind_one(dev, NULL); if (ret) { + struct acpi_bus_type *type = acpi_get_bus_type(dev); + if (!type) goto err; @@ -304,17 +307,26 @@ void acpi_device_notify(struct device *dev) ret = acpi_bind_one(dev, adev); if (ret) goto err; - } - adev = ACPI_COMPANION(dev); - if (dev_is_platform(dev)) - acpi_configure_pmsi_domain(dev); + if (type->setup) { + type->setup(dev); + goto done; + } + } else { + adev = ACPI_COMPANION(dev); + + if (dev_is_pci(dev)) { + pci_acpi_setup(dev, adev); + goto done; + } else if (dev_is_platform(dev)) { + acpi_configure_pmsi_domain(dev); + } + } - if (type && type->setup) - type->setup(dev); - else if (adev->handler && adev->handler->bind) + if (adev->handler && adev->handler->bind) adev->handler->bind(dev); +done: acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n", dev_name(dev)); @@ -327,14 +339,12 @@ err: void acpi_device_notify_remove(struct device *dev) { struct acpi_device *adev = ACPI_COMPANION(dev); - struct acpi_bus_type *type; if (!adev) return; - type = acpi_get_bus_type(dev); - if (type && type->cleanup) - type->cleanup(dev); + if (dev_is_pci(dev)) + pci_acpi_cleanup(dev, adev); else if (adev->handler && adev->handler->unbind) adev->handler->unbind(dev); |