aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-29 10:27:34 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-12-06 19:05:50 -0500
commite3f02c5228c4b600abf6ca243301176f25553bd5 (patch)
treea3b5372f137fb8396ffe036e4c0c3cabea06b838 /drivers/pci
parent9c5ad36d987a1b06f6b0b9dc7bc61a45d277455d (diff)
ACPI / bind: Rework struct acpi_bus_type
Replace the .find_device function pointer in struct acpi_bus_type with a new one, .find_companion, that is supposed to point to a function returning struct acpi_device pointer (instead of an int) and takes one argument (instead of two). This way the role of this callback is more clear and the implementation of it can be more straightforward. Update all of the users of struct acpi_bus_type (PCI, PNP/ACPI and USB) to reflect the structure change. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Lan Tianyu <tianyu.lan@intel.com> # for USB/ACPI
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci-acpi.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index adbf34003995..ce31eb0cdca7 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -303,10 +303,9 @@ void acpi_pci_remove_bus(struct pci_bus *bus)
303} 303}
304 304
305/* ACPI bus type */ 305/* ACPI bus type */
306static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) 306static struct acpi_device *acpi_pci_find_companion(struct device *dev)
307{ 307{
308 struct pci_dev *pci_dev = to_pci_dev(dev); 308 struct pci_dev *pci_dev = to_pci_dev(dev);
309 struct acpi_device *adev;
310 bool check_children; 309 bool check_children;
311 u64 addr; 310 u64 addr;
312 311
@@ -319,13 +318,8 @@ static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
319 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS; 318 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
320 /* Please ref to ACPI spec for the syntax of _ADR */ 319 /* Please ref to ACPI spec for the syntax of _ADR */
321 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 320 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
322 adev = acpi_find_child_device(ACPI_COMPANION(dev->parent), addr, 321 return acpi_find_child_device(ACPI_COMPANION(dev->parent), addr,
323 check_children); 322 check_children);
324 if (adev) {
325 *handle = adev->handle;
326 return 0;
327 }
328 return -ENODEV;
329} 323}
330 324
331static void pci_acpi_setup(struct device *dev) 325static void pci_acpi_setup(struct device *dev)
@@ -365,7 +359,7 @@ static bool pci_acpi_bus_match(struct device *dev)
365static struct acpi_bus_type acpi_pci_bus = { 359static struct acpi_bus_type acpi_pci_bus = {
366 .name = "PCI", 360 .name = "PCI",
367 .match = pci_acpi_bus_match, 361 .match = pci_acpi_bus_match,
368 .find_device = acpi_pci_find_device, 362 .find_companion = acpi_pci_find_companion,
369 .setup = pci_acpi_setup, 363 .setup = pci_acpi_setup,
370 .cleanup = pci_acpi_cleanup, 364 .cleanup = pci_acpi_cleanup,
371}; 365};