aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-11 16:41:56 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-14 17:14:43 -0500
commit7b1998116bbb2f3e5dd6cb9a8ee6db479b0b50a9 (patch)
tree7c84d3fe84a28e8e4368570c72e5c13ffef21f1a /arch/ia64
parent2f466d33f5f60542d3d82c0477de5863b22c94b9 (diff)
ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node
Modify struct acpi_dev_node to contain a pointer to struct acpi_device associated with the given device object (that is, its ACPI companion device) instead of an ACPI handle corresponding to it. Introduce two new macros for manipulating that pointer in a CONFIG_ACPI-safe way, ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the ACPI_HANDLE() macro to take the above changes into account. Drop the ACPI_HANDLE_SET() macro entirely and rework its users to use ACPI_COMPANION_SET() instead. For some of them who used to pass the result of acpi_get_child() directly to ACPI_HANDLE_SET() introduce a helper routine acpi_preset_companion() doing an equivalent thing. The main motivation for doing this is that there are things represented by struct acpi_device objects that don't have valid ACPI handles (so called fixed ACPI hardware features, such as power and sleep buttons) and we would like to create platform device objects for them and "glue" them to their ACPI companions in the usual way (which currently is impossible due to the lack of valid ACPI handles). However, there are more reasons why it may be useful. First, struct acpi_device pointers allow of much better type checking than void pointers which are ACPI handles, so it should be more difficult to write buggy code using modified struct acpi_dev_node and the new macros. Second, the change should help to reduce (over time) the number of places in which the result of ACPI_HANDLE() is passed to acpi_bus_get_device() in order to obtain a pointer to the struct acpi_device associated with the given "physical" device, because now that pointer is returned by ACPI_COMPANION() directly. Finally, the change should make it easier to write generic code that will build both for CONFIG_ACPI set and unset without adding explicit compiler directives to it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> # on Haswell Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Aaron Lu <aaron.lu@intel.com> # for ATA and SDIO part
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/hp/common/sba_iommu.c2
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/pci/pci.c6
-rw-r--r--arch/ia64/sn/kernel/io_acpi_init.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index d43daf192b21..4c530a82fc46 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -1992,7 +1992,7 @@ sba_connect_bus(struct pci_bus *bus)
1992 if (PCI_CONTROLLER(bus)->iommu) 1992 if (PCI_CONTROLLER(bus)->iommu)
1993 return; 1993 return;
1994 1994
1995 handle = PCI_CONTROLLER(bus)->acpi_handle; 1995 handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion);
1996 if (!handle) 1996 if (!handle)
1997 return; 1997 return;
1998 1998
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 80775f55f03f..71fbaaa495cc 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -95,7 +95,7 @@ struct iospace_resource {
95}; 95};
96 96
97struct pci_controller { 97struct pci_controller {
98 void *acpi_handle; 98 struct acpi_device *companion;
99 void *iommu; 99 void *iommu;
100 int segment; 100 int segment;
101 int node; /* nearest node with memory or -1 for global allocation */ 101 int node; /* nearest node with memory or -1 for global allocation */
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 2326790b7d8b..9e4938d8ca4d 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -436,9 +436,9 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
436 if (!controller) 436 if (!controller)
437 return NULL; 437 return NULL;
438 438
439 controller->acpi_handle = device->handle; 439 controller->companion = device;
440 440
441 pxm = acpi_get_pxm(controller->acpi_handle); 441 pxm = acpi_get_pxm(device->handle);
442#ifdef CONFIG_NUMA 442#ifdef CONFIG_NUMA
443 if (pxm >= 0) 443 if (pxm >= 0)
444 controller->node = pxm_to_node(pxm); 444 controller->node = pxm_to_node(pxm);
@@ -489,7 +489,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
489{ 489{
490 struct pci_controller *controller = bridge->bus->sysdata; 490 struct pci_controller *controller = bridge->bus->sysdata;
491 491
492 ACPI_HANDLE_SET(&bridge->dev, controller->acpi_handle); 492 ACPI_COMPANION_SET(&bridge->dev, controller->companion);
493 return 0; 493 return 0;
494} 494}
495 495
diff --git a/arch/ia64/sn/kernel/io_acpi_init.c b/arch/ia64/sn/kernel/io_acpi_init.c
index b1725398b5af..0640739cc20c 100644
--- a/arch/ia64/sn/kernel/io_acpi_init.c
+++ b/arch/ia64/sn/kernel/io_acpi_init.c
@@ -132,7 +132,7 @@ sn_get_bussoft_ptr(struct pci_bus *bus)
132 struct acpi_resource_vendor_typed *vendor; 132 struct acpi_resource_vendor_typed *vendor;
133 133
134 134
135 handle = PCI_CONTROLLER(bus)->acpi_handle; 135 handle = acpi_device_handle(PCI_CONTROLLER(bus)->companion);
136 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS, 136 status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
137 &sn_uuid, &buffer); 137 &sn_uuid, &buffer);
138 if (ACPI_FAILURE(status)) { 138 if (ACPI_FAILURE(status)) {
@@ -360,7 +360,7 @@ sn_acpi_get_pcidev_info(struct pci_dev *dev, struct pcidev_info **pcidev_info,
360 acpi_status status; 360 acpi_status status;
361 struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 361 struct acpi_buffer name_buffer = { ACPI_ALLOCATE_BUFFER, NULL };
362 362
363 rootbus_handle = PCI_CONTROLLER(dev)->acpi_handle; 363 rootbus_handle = acpi_device_handle(PCI_CONTROLLER(dev)->companion);
364 status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL, 364 status = acpi_evaluate_integer(rootbus_handle, METHOD_NAME__SEG, NULL,
365 &segment); 365 &segment);
366 if (ACPI_SUCCESS(status)) { 366 if (ACPI_SUCCESS(status)) {