aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--arch/x86/include/asm/pci.h2
-rw-r--r--arch/x86/pci/acpi.c4
-rw-r--r--drivers/acpi/acpi_platform.c2
-rw-r--r--drivers/acpi/device_pm.c6
-rw-r--r--drivers/acpi/glue.c47
-rw-r--r--drivers/ata/libata-acpi.c4
-rw-r--r--drivers/base/platform.c4
-rw-r--r--drivers/gpio/gpiolib.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c3
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c2
-rw-r--r--drivers/i2c/i2c-core.c4
-rw-r--r--drivers/ide/ide-acpi.c3
-rw-r--r--drivers/mmc/core/sdio_bus.c3
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c8
-rw-r--r--drivers/spi/spi.c2
-rw-r--r--include/acpi/acpi_bus.h2
-rw-r--r--include/linux/acpi.h15
-rw-r--r--include/linux/device.h12
22 files changed, 70 insertions, 68 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)) {
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 7d7443283a9d..947b5c417e83 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -15,7 +15,7 @@ struct pci_sysdata {
15 int domain; /* PCI domain */ 15 int domain; /* PCI domain */
16 int node; /* NUMA node */ 16 int node; /* NUMA node */
17#ifdef CONFIG_ACPI 17#ifdef CONFIG_ACPI
18 void *acpi; /* ACPI-specific data */ 18 struct acpi_device *companion; /* ACPI companion device */
19#endif 19#endif
20#ifdef CONFIG_X86_64 20#ifdef CONFIG_X86_64
21 void *iommu; /* IOMMU private data */ 21 void *iommu; /* IOMMU private data */
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 7fb24e53d4c8..4f25ec077552 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -518,7 +518,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
518 sd = &info->sd; 518 sd = &info->sd;
519 sd->domain = domain; 519 sd->domain = domain;
520 sd->node = node; 520 sd->node = node;
521 sd->acpi = device->handle; 521 sd->companion = device;
522 /* 522 /*
523 * Maybe the desired pci bus has been already scanned. In such case 523 * Maybe the desired pci bus has been already scanned. In such case
524 * it is unnecessary to scan the pci bus with the given domain,busnum. 524 * it is unnecessary to scan the pci bus with the given domain,busnum.
@@ -589,7 +589,7 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
589{ 589{
590 struct pci_sysdata *sd = bridge->bus->sysdata; 590 struct pci_sysdata *sd = bridge->bus->sysdata;
591 591
592 ACPI_HANDLE_SET(&bridge->dev, sd->acpi); 592 ACPI_COMPANION_SET(&bridge->dev, sd->companion);
593 return 0; 593 return 0;
594} 594}
595 595
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 8a4cfc7e71f0..dbfe49e5fd63 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -111,7 +111,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
111 pdevinfo.id = -1; 111 pdevinfo.id = -1;
112 pdevinfo.res = resources; 112 pdevinfo.res = resources;
113 pdevinfo.num_res = count; 113 pdevinfo.num_res = count;
114 pdevinfo.acpi_node.handle = adev->handle; 114 pdevinfo.acpi_node.companion = adev;
115 pdev = platform_device_register_full(&pdevinfo); 115 pdev = platform_device_register_full(&pdevinfo);
116 if (IS_ERR(pdev)) { 116 if (IS_ERR(pdev)) {
117 dev_err(&adev->dev, "platform device creation failed: %ld\n", 117 dev_err(&adev->dev, "platform device creation failed: %ld\n",
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index d42b2fb5a7e9..119afda0968c 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -22,16 +22,12 @@
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 */ 23 */
24 24
25#include <linux/device.h> 25#include <linux/acpi.h>
26#include <linux/export.h> 26#include <linux/export.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/pm_qos.h> 28#include <linux/pm_qos.h>
29#include <linux/pm_runtime.h> 29#include <linux/pm_runtime.h>
30 30
31#include <acpi/acpi.h>
32#include <acpi/acpi_bus.h>
33#include <acpi/acpi_drivers.h>
34
35#include "internal.h" 31#include "internal.h"
36 32
37#define _COMPONENT ACPI_POWER_COMPONENT 33#define _COMPONENT ACPI_POWER_COMPONENT
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 10f0f40587bb..782071fd3df3 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -197,30 +197,27 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id)
197 197
198int acpi_bind_one(struct device *dev, acpi_handle handle) 198int acpi_bind_one(struct device *dev, acpi_handle handle)
199{ 199{
200 struct acpi_device *acpi_dev; 200 struct acpi_device *acpi_dev = NULL;
201 acpi_status status;
202 struct acpi_device_physical_node *physical_node, *pn; 201 struct acpi_device_physical_node *physical_node, *pn;
203 char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; 202 char physical_node_name[PHYSICAL_NODE_NAME_SIZE];
204 struct list_head *physnode_list; 203 struct list_head *physnode_list;
205 unsigned int node_id; 204 unsigned int node_id;
206 int retval = -EINVAL; 205 int retval = -EINVAL;
207 206
208 if (ACPI_HANDLE(dev)) { 207 if (ACPI_COMPANION(dev)) {
209 if (handle) { 208 if (handle) {
210 dev_warn(dev, "ACPI handle is already set\n"); 209 dev_warn(dev, "ACPI companion already set\n");
211 return -EINVAL; 210 return -EINVAL;
212 } else { 211 } else {
213 handle = ACPI_HANDLE(dev); 212 acpi_dev = ACPI_COMPANION(dev);
214 } 213 }
214 } else {
215 acpi_bus_get_device(handle, &acpi_dev);
215 } 216 }
216 if (!handle) 217 if (!acpi_dev)
217 return -EINVAL; 218 return -EINVAL;
218 219
219 get_device(dev); 220 get_device(dev);
220 status = acpi_bus_get_device(handle, &acpi_dev);
221 if (ACPI_FAILURE(status))
222 goto err;
223
224 physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL); 221 physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
225 if (!physical_node) { 222 if (!physical_node) {
226 retval = -ENOMEM; 223 retval = -ENOMEM;
@@ -242,7 +239,7 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
242 239
243 dev_warn(dev, "Already associated with ACPI node\n"); 240 dev_warn(dev, "Already associated with ACPI node\n");
244 kfree(physical_node); 241 kfree(physical_node);
245 if (ACPI_HANDLE(dev) != handle) 242 if (ACPI_COMPANION(dev) != acpi_dev)
246 goto err; 243 goto err;
247 244
248 put_device(dev); 245 put_device(dev);
@@ -259,8 +256,8 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
259 list_add(&physical_node->node, physnode_list); 256 list_add(&physical_node->node, physnode_list);
260 acpi_dev->physical_node_count++; 257 acpi_dev->physical_node_count++;
261 258
262 if (!ACPI_HANDLE(dev)) 259 if (!ACPI_COMPANION(dev))
263 ACPI_HANDLE_SET(dev, acpi_dev->handle); 260 ACPI_COMPANION_SET(dev, acpi_dev);
264 261
265 acpi_physnode_link_name(physical_node_name, node_id); 262 acpi_physnode_link_name(physical_node_name, node_id);
266 retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, 263 retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
@@ -283,7 +280,7 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
283 return 0; 280 return 0;
284 281
285 err: 282 err:
286 ACPI_HANDLE_SET(dev, NULL); 283 ACPI_COMPANION_SET(dev, NULL);
287 put_device(dev); 284 put_device(dev);
288 return retval; 285 return retval;
289} 286}
@@ -291,19 +288,12 @@ EXPORT_SYMBOL_GPL(acpi_bind_one);
291 288
292int acpi_unbind_one(struct device *dev) 289int acpi_unbind_one(struct device *dev)
293{ 290{
291 struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
294 struct acpi_device_physical_node *entry; 292 struct acpi_device_physical_node *entry;
295 struct acpi_device *acpi_dev;
296 acpi_status status;
297 293
298 if (!ACPI_HANDLE(dev)) 294 if (!acpi_dev)
299 return 0; 295 return 0;
300 296
301 status = acpi_bus_get_device(ACPI_HANDLE(dev), &acpi_dev);
302 if (ACPI_FAILURE(status)) {
303 dev_err(dev, "Oops, ACPI handle corrupt in %s()\n", __func__);
304 return -EINVAL;
305 }
306
307 mutex_lock(&acpi_dev->physical_node_lock); 297 mutex_lock(&acpi_dev->physical_node_lock);
308 298
309 list_for_each_entry(entry, &acpi_dev->physical_node_list, node) 299 list_for_each_entry(entry, &acpi_dev->physical_node_list, node)
@@ -316,7 +306,7 @@ int acpi_unbind_one(struct device *dev)
316 acpi_physnode_link_name(physnode_name, entry->node_id); 306 acpi_physnode_link_name(physnode_name, entry->node_id);
317 sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name); 307 sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name);
318 sysfs_remove_link(&dev->kobj, "firmware_node"); 308 sysfs_remove_link(&dev->kobj, "firmware_node");
319 ACPI_HANDLE_SET(dev, NULL); 309 ACPI_COMPANION_SET(dev, NULL);
320 /* acpi_bind_one() increase refcnt by one. */ 310 /* acpi_bind_one() increase refcnt by one. */
321 put_device(dev); 311 put_device(dev);
322 kfree(entry); 312 kfree(entry);
@@ -328,6 +318,15 @@ int acpi_unbind_one(struct device *dev)
328} 318}
329EXPORT_SYMBOL_GPL(acpi_unbind_one); 319EXPORT_SYMBOL_GPL(acpi_unbind_one);
330 320
321void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr)
322{
323 struct acpi_device *adev;
324
325 if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev))
326 ACPI_COMPANION_SET(dev, adev);
327}
328EXPORT_SYMBOL_GPL(acpi_preset_companion);
329
331static int acpi_platform_notify(struct device *dev) 330static int acpi_platform_notify(struct device *dev)
332{ 331{
333 struct acpi_bus_type *type = acpi_get_bus_type(dev); 332 struct acpi_bus_type *type = acpi_get_bus_type(dev);
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c
index ab714d2ad978..4372cfa883c9 100644
--- a/drivers/ata/libata-acpi.c
+++ b/drivers/ata/libata-acpi.c
@@ -185,7 +185,7 @@ void ata_acpi_bind_port(struct ata_port *ap)
185 if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle) 185 if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle)
186 return; 186 return;
187 187
188 ACPI_HANDLE_SET(&ap->tdev, acpi_get_child(host_handle, ap->port_no)); 188 acpi_preset_companion(&ap->tdev, host_handle, ap->port_no);
189 189
190 if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) 190 if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0)
191 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; 191 ap->pflags |= ATA_PFLAG_INIT_GTM_VALID;
@@ -222,7 +222,7 @@ void ata_acpi_bind_dev(struct ata_device *dev)
222 parent_handle = port_handle; 222 parent_handle = port_handle;
223 } 223 }
224 224
225 ACPI_HANDLE_SET(&dev->tdev, acpi_get_child(parent_handle, adr)); 225 acpi_preset_companion(&dev->tdev, parent_handle, adr);
226 226
227 register_hotplug_dock_device(ata_dev_acpi_handle(dev), 227 register_hotplug_dock_device(ata_dev_acpi_handle(dev),
228 &ata_acpi_dev_dock_ops, dev, NULL, NULL); 228 &ata_acpi_dev_dock_ops, dev, NULL, NULL);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 47051cd25113..3a94b799f166 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -432,7 +432,7 @@ struct platform_device *platform_device_register_full(
432 goto err_alloc; 432 goto err_alloc;
433 433
434 pdev->dev.parent = pdevinfo->parent; 434 pdev->dev.parent = pdevinfo->parent;
435 ACPI_HANDLE_SET(&pdev->dev, pdevinfo->acpi_node.handle); 435 ACPI_COMPANION_SET(&pdev->dev, pdevinfo->acpi_node.companion);
436 436
437 if (pdevinfo->dma_mask) { 437 if (pdevinfo->dma_mask) {
438 /* 438 /*
@@ -463,7 +463,7 @@ struct platform_device *platform_device_register_full(
463 ret = platform_device_add(pdev); 463 ret = platform_device_add(pdev);
464 if (ret) { 464 if (ret) {
465err: 465err:
466 ACPI_HANDLE_SET(&pdev->dev, NULL); 466 ACPI_COMPANION_SET(&pdev->dev, NULL);
467 kfree(pdev->dev.dma_mask); 467 kfree(pdev->dev.dma_mask);
468 468
469err_alloc: 469err_alloc:
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7dd446150294..4e10b10d3ddd 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -13,6 +13,7 @@
13#include <linux/acpi_gpio.h> 13#include <linux/acpi_gpio.h>
14#include <linux/idr.h> 14#include <linux/idr.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/acpi.h>
16 17
17#define CREATE_TRACE_POINTS 18#define CREATE_TRACE_POINTS
18#include <trace/events/gpio.h> 19#include <trace/events/gpio.h>
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index d96070bf8388..27a6e9dbd0c4 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -8,8 +8,7 @@
8 */ 8 */
9#include <linux/vga_switcheroo.h> 9#include <linux/vga_switcheroo.h>
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <acpi/acpi.h> 11#include <linux/acpi.h>
12#include <acpi/acpi_bus.h>
13#include <linux/pci.h> 12#include <linux/pci.h>
14 13
15#include "radeon_acpi.h" 14#include "radeon_acpi.h"
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index fd7ce374f812..b7ecc3623a43 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -1012,7 +1012,7 @@ static int i2c_hid_probe(struct i2c_client *client,
1012 hid->hid_get_raw_report = i2c_hid_get_raw_report; 1012 hid->hid_get_raw_report = i2c_hid_get_raw_report;
1013 hid->hid_output_raw_report = i2c_hid_output_raw_report; 1013 hid->hid_output_raw_report = i2c_hid_output_raw_report;
1014 hid->dev.parent = &client->dev; 1014 hid->dev.parent = &client->dev;
1015 ACPI_HANDLE_SET(&hid->dev, ACPI_HANDLE(&client->dev)); 1015 ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev));
1016 hid->bus = BUS_I2C; 1016 hid->bus = BUS_I2C;
1017 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); 1017 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
1018 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); 1018 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 75ba8608383e..f74af33f5ddc 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -674,7 +674,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
674 client->dev.bus = &i2c_bus_type; 674 client->dev.bus = &i2c_bus_type;
675 client->dev.type = &i2c_client_type; 675 client->dev.type = &i2c_client_type;
676 client->dev.of_node = info->of_node; 676 client->dev.of_node = info->of_node;
677 ACPI_HANDLE_SET(&client->dev, info->acpi_node.handle); 677 ACPI_COMPANION_SET(&client->dev, info->acpi_node.companion);
678 678
679 /* For 10-bit clients, add an arbitrary offset to avoid collisions */ 679 /* For 10-bit clients, add an arbitrary offset to avoid collisions */
680 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), 680 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
@@ -1103,7 +1103,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
1103 return AE_OK; 1103 return AE_OK;
1104 1104
1105 memset(&info, 0, sizeof(info)); 1105 memset(&info, 0, sizeof(info));
1106 info.acpi_node.handle = handle; 1106 info.acpi_node.companion = adev;
1107 info.irq = -1; 1107 info.irq = -1;
1108 1108
1109 INIT_LIST_HEAD(&resource_list); 1109 INIT_LIST_HEAD(&resource_list);
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 140c8ef50529..3662c4c536d6 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -7,6 +7,7 @@
7 * Copyright (C) 2006 Hannes Reinecke 7 * Copyright (C) 2006 Hannes Reinecke
8 */ 8 */
9 9
10#include <linux/acpi.h>
10#include <linux/ata.h> 11#include <linux/ata.h>
11#include <linux/delay.h> 12#include <linux/delay.h>
12#include <linux/device.h> 13#include <linux/device.h>
@@ -19,8 +20,6 @@
19#include <linux/dmi.h> 20#include <linux/dmi.h>
20#include <linux/module.h> 21#include <linux/module.h>
21 22
22#include <acpi/acpi_bus.h>
23
24#define REGS_PER_GTF 7 23#define REGS_PER_GTF 7
25 24
26struct GTM_buffer { 25struct GTM_buffer {
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index ef8956568c3a..157b570ba343 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -308,8 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func)
308 struct mmc_host *host = func->card->host; 308 struct mmc_host *host = func->card->host;
309 u64 addr = (host->slotno << 16) | func->num; 309 u64 addr = (host->slotno << 16) | func->num;
310 310
311 ACPI_HANDLE_SET(&func->dev, 311 acpi_preset_companion(&func->dev, ACPI_HANDLE(host->parent), addr);
312 acpi_get_child(ACPI_HANDLE(host->parent), addr));
313} 312}
314#else 313#else
315static inline void sdio_acpi_set_handle(struct sdio_func *func) {} 314static inline void sdio_acpi_set_handle(struct sdio_func *func) {}
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index b2781dfe60e9..5b05a68cca6c 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -9,6 +9,7 @@
9 * Work to add BIOS PROM support was completed by Mike Habeck. 9 * Work to add BIOS PROM support was completed by Mike Habeck.
10 */ 10 */
11 11
12#include <linux/acpi.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/module.h> 15#include <linux/module.h>
@@ -29,7 +30,6 @@
29#include <asm/sn/sn_feature_sets.h> 30#include <asm/sn/sn_feature_sets.h>
30#include <asm/sn/sn_sal.h> 31#include <asm/sn/sn_sal.h>
31#include <asm/sn/types.h> 32#include <asm/sn/types.h>
32#include <linux/acpi.h>
33#include <asm/sn/acpi.h> 33#include <asm/sn/acpi.h>
34 34
35#include "../pci.h" 35#include "../pci.h"
@@ -414,7 +414,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
414 acpi_handle rethandle; 414 acpi_handle rethandle;
415 acpi_status ret; 415 acpi_status ret;
416 416
417 phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; 417 phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
418 418
419 if (acpi_bus_get_device(phandle, &pdevice)) { 419 if (acpi_bus_get_device(phandle, &pdevice)) {
420 dev_dbg(&slot->pci_bus->self->dev, 420 dev_dbg(&slot->pci_bus->self->dev,
@@ -495,7 +495,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
495 495
496 /* free the ACPI resources for the slot */ 496 /* free the ACPI resources for the slot */
497 if (SN_ACPI_BASE_SUPPORT() && 497 if (SN_ACPI_BASE_SUPPORT() &&
498 PCI_CONTROLLER(slot->pci_bus)->acpi_handle) { 498 PCI_CONTROLLER(slot->pci_bus)->companion) {
499 unsigned long long adr; 499 unsigned long long adr;
500 struct acpi_device *device; 500 struct acpi_device *device;
501 acpi_handle phandle; 501 acpi_handle phandle;
@@ -504,7 +504,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
504 acpi_status ret; 504 acpi_status ret;
505 505
506 /* Get the rootbus node pointer */ 506 /* Get the rootbus node pointer */
507 phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle; 507 phandle = acpi_device_handle(PCI_CONTROLLER(slot->pci_bus)->companion);
508 508
509 acpi_scan_lock_acquire(); 509 acpi_scan_lock_acquire();
510 /* 510 /*
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 927998aa5e71..a968d8549ee5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1144,7 +1144,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level,
1144 return AE_NO_MEMORY; 1144 return AE_NO_MEMORY;
1145 } 1145 }
1146 1146
1147 ACPI_HANDLE_SET(&spi->dev, handle); 1147 ACPI_COMPANION_SET(&spi->dev, adev);
1148 spi->irq = -1; 1148 spi->irq = -1;
1149 1149
1150 INIT_LIST_HEAD(&resource_list); 1150 INIT_LIST_HEAD(&resource_list);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 89c60b0f6408..7b2de026a4f3 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -431,9 +431,9 @@ static inline acpi_handle acpi_get_child(acpi_handle handle, u64 addr)
431{ 431{
432 return acpi_find_child(handle, addr, false); 432 return acpi_find_child(handle, addr, false);
433} 433}
434void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr);
434int acpi_is_root_bridge(acpi_handle); 435int acpi_is_root_bridge(acpi_handle);
435struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); 436struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle);
436#define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)ACPI_HANDLE(dev))
437 437
438int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); 438int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
439int acpi_disable_wakeup_device_power(struct acpi_device *dev); 439int acpi_disable_wakeup_device_power(struct acpi_device *dev);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index b0972c4ce81c..47369aadb1d1 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -44,6 +44,15 @@
44#include <acpi/acpi_numa.h> 44#include <acpi/acpi_numa.h>
45#include <asm/acpi.h> 45#include <asm/acpi.h>
46 46
47static inline acpi_handle acpi_device_handle(struct acpi_device *adev)
48{
49 return adev ? adev->handle : NULL;
50}
51
52#define ACPI_COMPANION(dev) ((dev)->acpi_node.companion)
53#define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev)
54#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
55
47enum acpi_irq_model_id { 56enum acpi_irq_model_id {
48 ACPI_IRQ_MODEL_PIC = 0, 57 ACPI_IRQ_MODEL_PIC = 0,
49 ACPI_IRQ_MODEL_IOAPIC, 58 ACPI_IRQ_MODEL_IOAPIC,
@@ -401,6 +410,10 @@ static inline bool acpi_driver_match_device(struct device *dev,
401 410
402#define acpi_disabled 1 411#define acpi_disabled 1
403 412
413#define ACPI_COMPANION(dev) (NULL)
414#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
415#define ACPI_HANDLE(dev) (NULL)
416
404static inline void acpi_early_init(void) { } 417static inline void acpi_early_init(void) { }
405 418
406static inline int early_acpi_boot_init(void) 419static inline int early_acpi_boot_init(void)
@@ -469,6 +482,8 @@ static inline bool acpi_driver_match_device(struct device *dev,
469 482
470#endif /* !CONFIG_ACPI */ 483#endif /* !CONFIG_ACPI */
471 484
485#define DEVICE_ACPI_HANDLE(dev) ACPI_HANDLE(dev)
486
472#ifdef CONFIG_ACPI 487#ifdef CONFIG_ACPI
473void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, 488void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
474 u32 pm1a_ctrl, u32 pm1b_ctrl)); 489 u32 pm1a_ctrl, u32 pm1b_ctrl));
diff --git a/include/linux/device.h b/include/linux/device.h
index b025925df7f7..952b01033c32 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -644,9 +644,11 @@ struct device_dma_parameters {
644 unsigned long segment_boundary_mask; 644 unsigned long segment_boundary_mask;
645}; 645};
646 646
647struct acpi_device;
648
647struct acpi_dev_node { 649struct acpi_dev_node {
648#ifdef CONFIG_ACPI 650#ifdef CONFIG_ACPI
649 void *handle; 651 struct acpi_device *companion;
650#endif 652#endif
651}; 653};
652 654
@@ -790,14 +792,6 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
790 return container_of(kobj, struct device, kobj); 792 return container_of(kobj, struct device, kobj);
791} 793}
792 794
793#ifdef CONFIG_ACPI
794#define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
795#define ACPI_HANDLE_SET(dev, _handle_) (dev)->acpi_node.handle = (_handle_)
796#else
797#define ACPI_HANDLE(dev) (NULL)
798#define ACPI_HANDLE_SET(dev, _handle_) do { } while (0)
799#endif
800
801/* Get the wakeup routines, which depend on struct device */ 795/* Get the wakeup routines, which depend on struct device */
802#include <linux/pm_wakeup.h> 796#include <linux/pm_wakeup.h>
803 797