Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: PCI: PM: Rework root bus notification setup

Since pci_acpi_add_bus_pm_notifier() is only suitable for adding ACPI
PM notifiers to root buses, rename it to pci_acpi_add_root_pm_notifier()
and modify it to take an additional "root" argument, which is then used
for passing a PCI root bridge device pointer to acpi_add_pm_notifier().

That function uses it to populate the "dev" field in the context
structure attached to the ACPI device object that will receive the
ACPI "wake" notifications on behalf of the given PCI root bus. The
context structure in question is passed to pci_acpi_wake_bus(), so
the latter can be simplified quite a bit now because the target PCI
host bridge structure address can be derived from "dev".

No intentional functional impact.

This change will also facilitate a subsequent update related to the
registration of wakeup sources.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
[ rjw: Kerneldoc comment fixup ]
Link: https://patch.msgid.link/2395263.ElGaqSPkdT@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

+9 -11
+1 -1
drivers/acpi/pci_root.c
··· 738 738 if (no_aspm) 739 739 pcie_no_aspm(); 740 740 741 - pci_acpi_add_bus_pm_notifier(device); 741 + pci_acpi_add_root_pm_notifier(device, root); 742 742 device_set_wakeup_capable(root->bus->bridge, device->wakeup.flags.valid); 743 743 744 744 if (hotadd) {
+6 -9
drivers/pci/pci-acpi.c
··· 847 847 */ 848 848 static void pci_acpi_wake_bus(struct acpi_device_wakeup_context *context) 849 849 { 850 - struct acpi_device *adev; 851 - struct acpi_pci_root *root; 852 - 853 - adev = container_of(context, struct acpi_device, wakeup.context); 854 - root = acpi_driver_data(adev); 855 - pci_pme_wakeup_bus(root->bus); 850 + pci_pme_wakeup_bus(to_pci_host_bridge(context->dev)->bus); 856 851 } 857 852 858 853 /** ··· 880 885 } 881 886 882 887 /** 883 - * pci_acpi_add_bus_pm_notifier - Register PM notifier for root PCI bus. 888 + * pci_acpi_add_root_pm_notifier - Register PM notifier for root PCI bus. 884 889 * @dev: PCI root bridge ACPI device. 890 + * @root: PCI root corresponding to @dev. 885 891 */ 886 - acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev) 892 + acpi_status pci_acpi_add_root_pm_notifier(struct acpi_device *dev, 893 + struct acpi_pci_root *root) 887 894 { 888 - return acpi_add_pm_notifier(dev, NULL, pci_acpi_wake_bus); 895 + return acpi_add_pm_notifier(dev, root->bus->bridge, pci_acpi_wake_bus); 889 896 } 890 897 891 898 /**
+2 -1
include/linux/pci-acpi.h
··· 12 12 #include <linux/acpi.h> 13 13 14 14 #ifdef CONFIG_ACPI 15 - extern acpi_status pci_acpi_add_bus_pm_notifier(struct acpi_device *dev); 15 + extern acpi_status pci_acpi_add_root_pm_notifier(struct acpi_device *dev, 16 + struct acpi_pci_root *pci_root); 16 17 static inline acpi_status pci_acpi_remove_bus_pm_notifier(struct acpi_device *dev) 17 18 { 18 19 return acpi_remove_pm_notifier(dev);