aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/resource.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 15:46:48 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 15:46:48 -0500
commit0ab7b12c49b6fbf2d4d0381374b82935f949be5f (patch)
tree7a1b48e644638c6a0a275e65715d8db37d20c88e /drivers/acpi/resource.c
parenta9a16a6d136593c9e6f72e481b2b86ae1d8d1fce (diff)
parentb08d2e61a6f9ebf5210a047868362a5a4ff37144 (diff)
Merge tag 'pci-v4.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas: "PCI changes: - add support for PCI on ARM64 boxes with ACPI. We already had this for theoretical spec-compliant hardware; now we're adding quirks for the actual hardware (Cavium, HiSilicon, Qualcomm, X-Gene) - add runtime PM support for hotplug ports - enable runtime suspend for Intel UHCI that uses platform-specific wakeup signaling - add yet another host bridge registration interface. We hope this is extensible enough to subsume the others - expose device revision in sysfs for DRM - to avoid device conflicts, make sure any VF BAR updates are done before enabling the VF - avoid unnecessary link retrains for ASPM - allow INTx masking on Mellanox devices that support it - allow access to non-standard VPD for Chelsio devices - update Broadcom iProc support for PAXB v2, PAXC v2, inbound DMA, etc - update Rockchip support for max-link-speed - add NVIDIA Tegra210 support - add Layerscape LS1046a support - update R-Car compatibility strings - add Qualcomm MSM8996 support - remove some uninformative bootup messages" * tag 'pci-v4.10-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (115 commits) PCI: Enable access to non-standard VPD for Chelsio devices (cxgb3) PCI: Expand "VPD access disabled" quirk message PCI: pciehp: Remove loading message PCI: hotplug: Remove hotplug core message PCI: Remove service driver load/unload messages PCI/AER: Log AER IRQ when claiming Root Port PCI/AER: Log errors with PCI device, not PCIe service device PCI/AER: Remove unused version macros PCI/PME: Log PME IRQ when claiming Root Port PCI/PME: Drop unused support for PMEs from Root Complex Event Collectors PCI: Move config space size macros to pci_regs.h x86/platform/intel-mid: Constify mid_pci_platform_pm PCI/ASPM: Don't retrain link if ASPM not possible PCI: iproc: Skip check for legacy IRQ on PAXC buses PCI: pciehp: Leave power indicator on when enabling already-enabled slot PCI: pciehp: Prioritize data-link event over presence detect PCI: rcar: Add gen3 fallback compatibility string for pcie-rcar PCI: rcar: Use gen2 fallback compatibility last PCI: rcar-gen2: Use gen2 fallback compatibility last PCI: rockchip: Move the deassert of pm/aclk/pclk after phy_init() ..
Diffstat (limited to 'drivers/acpi/resource.c')
-rw-r--r--drivers/acpi/resource.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
index 56241eb341f4..cb57962ef7c4 100644
--- a/drivers/acpi/resource.c
+++ b/drivers/acpi/resource.c
@@ -664,3 +664,60 @@ int acpi_dev_filter_resource_type(struct acpi_resource *ares,
664 return (type & types) ? 0 : 1; 664 return (type & types) ? 0 : 1;
665} 665}
666EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type); 666EXPORT_SYMBOL_GPL(acpi_dev_filter_resource_type);
667
668static int acpi_dev_consumes_res(struct acpi_device *adev, struct resource *res)
669{
670 struct list_head resource_list;
671 struct resource_entry *rentry;
672 int ret, found = 0;
673
674 INIT_LIST_HEAD(&resource_list);
675 ret = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
676 if (ret < 0)
677 return 0;
678
679 list_for_each_entry(rentry, &resource_list, node) {
680 if (resource_contains(rentry->res, res)) {
681 found = 1;
682 break;
683 }
684
685 }
686
687 acpi_dev_free_resource_list(&resource_list);
688 return found;
689}
690
691static acpi_status acpi_res_consumer_cb(acpi_handle handle, u32 depth,
692 void *context, void **ret)
693{
694 struct resource *res = context;
695 struct acpi_device **consumer = (struct acpi_device **) ret;
696 struct acpi_device *adev;
697
698 if (acpi_bus_get_device(handle, &adev))
699 return AE_OK;
700
701 if (acpi_dev_consumes_res(adev, res)) {
702 *consumer = adev;
703 return AE_CTRL_TERMINATE;
704 }
705
706 return AE_OK;
707}
708
709/**
710 * acpi_resource_consumer - Find the ACPI device that consumes @res.
711 * @res: Resource to search for.
712 *
713 * Search the current resource settings (_CRS) of every ACPI device node
714 * for @res. If we find an ACPI device whose _CRS includes @res, return
715 * it. Otherwise, return NULL.
716 */
717struct acpi_device *acpi_resource_consumer(struct resource *res)
718{
719 struct acpi_device *consumer = NULL;
720
721 acpi_get_devices(NULL, acpi_res_consumer_cb, res, (void **) &consumer);
722 return consumer;
723}