aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/Kconfig11
-rw-r--r--drivers/acpi/ac.c15
-rw-r--r--drivers/acpi/acpi_lpss.c9
-rw-r--r--drivers/acpi/acpi_platform.c2
-rw-r--r--drivers/acpi/blacklist.c35
-rw-r--r--drivers/acpi/device_pm.c14
-rw-r--r--drivers/acpi/ec.c3
-rw-r--r--drivers/acpi/glue.c53
-rw-r--r--drivers/acpi/pci_root.c1
-rw-r--r--drivers/acpi/scan.c14
-rw-r--r--drivers/acpi/video.c87
-rw-r--r--drivers/ata/libata-acpi.c4
-rw-r--r--drivers/base/platform.c4
-rw-r--r--drivers/base/power/main.c3
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c3
-rw-r--r--drivers/cpufreq/cpufreq_governor.c4
-rw-r--r--drivers/cpufreq/omap-cpufreq.c1
-rw-r--r--drivers/gpio/gpiolib.c1
-rw-r--r--drivers/gpu/drm/i915/intel_acpi.c2
-rw-r--r--drivers/gpu/drm/i915/intel_opregion.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/subdev/mxm/base.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_acpi.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c2
-rw-r--r--drivers/hid/i2c-hid/i2c-hid.c2
-rw-r--r--drivers/i2c/i2c-core.c25
-rw-r--r--drivers/ide/ide-acpi.c5
-rw-r--r--drivers/idle/intel_idle.c24
-rw-r--r--drivers/mmc/core/sdio_bus.c3
-rw-r--r--drivers/pci/hotplug/acpi_pcihp.c2
-rw-r--r--drivers/pci/hotplug/acpiphp.h1
-rw-r--r--drivers/pci/hotplug/pciehp_acpi.c4
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c8
-rw-r--r--drivers/pci/ioapic.c2
-rw-r--r--drivers/pci/pci-acpi.c6
-rw-r--r--drivers/pci/pci-label.c6
-rw-r--r--drivers/platform/x86/apple-gmux.c2
-rw-r--r--drivers/pnp/pnpacpi/core.c10
-rw-r--r--drivers/spi/spi.c19
-rw-r--r--drivers/usb/core/hub.c2
-rw-r--r--drivers/usb/core/usb-acpi.c4
-rw-r--r--drivers/xen/pci.c6
43 files changed, 183 insertions, 241 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index c95df0b8c880..5d9248526d78 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -235,17 +235,6 @@ config ACPI_INITRD_TABLE_OVERRIDE
235 initrd, therefore it's safe to say Y. 235 initrd, therefore it's safe to say Y.
236 See Documentation/acpi/initrd_table_override.txt for details 236 See Documentation/acpi/initrd_table_override.txt for details
237 237
238config ACPI_BLACKLIST_YEAR
239 int "Disable ACPI for systems before Jan 1st this year" if X86_32
240 default 0
241 help
242 Enter a 4-digit year, e.g., 2001, to disable ACPI by default
243 on platforms with DMI BIOS date before January 1st that year.
244 "acpi=force" can be used to override this mechanism.
245
246 Enter 0 to disable this mechanism and allow ACPI to
247 run by default no matter what the year. (default)
248
249config ACPI_DEBUG 238config ACPI_DEBUG
250 bool "Debug Statements" 239 bool "Debug Statements"
251 default n 240 default n
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index b9f0d5f4bba5..8711e3797165 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -56,7 +56,6 @@ static int ac_sleep_before_get_state_ms;
56 56
57struct acpi_ac { 57struct acpi_ac {
58 struct power_supply charger; 58 struct power_supply charger;
59 struct acpi_device *adev;
60 struct platform_device *pdev; 59 struct platform_device *pdev;
61 unsigned long long state; 60 unsigned long long state;
62}; 61};
@@ -70,8 +69,9 @@ struct acpi_ac {
70static int acpi_ac_get_state(struct acpi_ac *ac) 69static int acpi_ac_get_state(struct acpi_ac *ac)
71{ 70{
72 acpi_status status; 71 acpi_status status;
72 acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
73 73
74 status = acpi_evaluate_integer(ac->adev->handle, "_PSR", NULL, 74 status = acpi_evaluate_integer(handle, "_PSR", NULL,
75 &ac->state); 75 &ac->state);
76 if (ACPI_FAILURE(status)) { 76 if (ACPI_FAILURE(status)) {
77 ACPI_EXCEPTION((AE_INFO, status, 77 ACPI_EXCEPTION((AE_INFO, status,
@@ -119,6 +119,7 @@ static enum power_supply_property ac_props[] = {
119static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) 119static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
120{ 120{
121 struct acpi_ac *ac = data; 121 struct acpi_ac *ac = data;
122 struct acpi_device *adev;
122 123
123 if (!ac) 124 if (!ac)
124 return; 125 return;
@@ -141,10 +142,11 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
141 msleep(ac_sleep_before_get_state_ms); 142 msleep(ac_sleep_before_get_state_ms);
142 143
143 acpi_ac_get_state(ac); 144 acpi_ac_get_state(ac);
144 acpi_bus_generate_netlink_event(ac->adev->pnp.device_class, 145 adev = ACPI_COMPANION(&ac->pdev->dev);
146 acpi_bus_generate_netlink_event(adev->pnp.device_class,
145 dev_name(&ac->pdev->dev), 147 dev_name(&ac->pdev->dev),
146 event, (u32) ac->state); 148 event, (u32) ac->state);
147 acpi_notifier_call_chain(ac->adev, event, (u32) ac->state); 149 acpi_notifier_call_chain(adev, event, (u32) ac->state);
148 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 150 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
149 } 151 }
150 152
@@ -178,8 +180,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
178 if (!pdev) 180 if (!pdev)
179 return -EINVAL; 181 return -EINVAL;
180 182
181 result = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); 183 adev = ACPI_COMPANION(&pdev->dev);
182 if (result) 184 if (!adev)
183 return -ENODEV; 185 return -ENODEV;
184 186
185 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); 187 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
@@ -188,7 +190,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
188 190
189 strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); 191 strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
190 strcpy(acpi_device_class(adev), ACPI_AC_CLASS); 192 strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
191 ac->adev = adev;
192 ac->pdev = pdev; 193 ac->pdev = pdev;
193 platform_set_drvdata(pdev, ac); 194 platform_set_drvdata(pdev, ac);
194 195
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index d3961014aad7..6745fe137b9e 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -163,6 +163,15 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {
163 { "80860F41", (unsigned long)&byt_i2c_dev_desc }, 163 { "80860F41", (unsigned long)&byt_i2c_dev_desc },
164 { "INT33B2", }, 164 { "INT33B2", },
165 165
166 { "INT3430", (unsigned long)&lpt_dev_desc },
167 { "INT3431", (unsigned long)&lpt_dev_desc },
168 { "INT3432", (unsigned long)&lpt_dev_desc },
169 { "INT3433", (unsigned long)&lpt_dev_desc },
170 { "INT3434", (unsigned long)&lpt_uart_dev_desc },
171 { "INT3435", (unsigned long)&lpt_uart_dev_desc },
172 { "INT3436", (unsigned long)&lpt_sdio_dev_desc },
173 { "INT3437", },
174
166 { } 175 { }
167}; 176};
168 177
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/blacklist.c b/drivers/acpi/blacklist.c
index fb848378d582..078c4f7fe2dd 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -75,39 +75,6 @@ static struct acpi_blacklist_item acpi_blacklist[] __initdata = {
75 {""} 75 {""}
76}; 76};
77 77
78#if CONFIG_ACPI_BLACKLIST_YEAR
79
80static int __init blacklist_by_year(void)
81{
82 int year;
83
84 /* Doesn't exist? Likely an old system */
85 if (!dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL)) {
86 printk(KERN_ERR PREFIX "no DMI BIOS year, "
87 "acpi=force is required to enable ACPI\n" );
88 return 1;
89 }
90 /* 0? Likely a buggy new BIOS */
91 if (year == 0) {
92 printk(KERN_ERR PREFIX "DMI BIOS year==0, "
93 "assuming ACPI-capable machine\n" );
94 return 0;
95 }
96 if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
97 printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
98 "acpi=force is required to enable ACPI\n",
99 year, CONFIG_ACPI_BLACKLIST_YEAR);
100 return 1;
101 }
102 return 0;
103}
104#else
105static inline int blacklist_by_year(void)
106{
107 return 0;
108}
109#endif
110
111int __init acpi_blacklisted(void) 78int __init acpi_blacklisted(void)
112{ 79{
113 int i = 0; 80 int i = 0;
@@ -166,8 +133,6 @@ int __init acpi_blacklisted(void)
166 } 133 }
167 } 134 }
168 135
169 blacklisted += blacklist_by_year();
170
171 dmi_check_system(acpi_osi_dmi_table); 136 dmi_check_system(acpi_osi_dmi_table);
172 137
173 return blacklisted; 138 return blacklisted;
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index d42b2fb5a7e9..b3480cf7db1a 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
@@ -548,7 +544,7 @@ static int acpi_dev_pm_get_state(struct device *dev, struct acpi_device *adev,
548 */ 544 */
549int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) 545int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
550{ 546{
551 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 547 acpi_handle handle = ACPI_HANDLE(dev);
552 struct acpi_device *adev; 548 struct acpi_device *adev;
553 int ret, d_min, d_max; 549 int ret, d_min, d_max;
554 550
@@ -656,7 +652,7 @@ int acpi_pm_device_run_wake(struct device *phys_dev, bool enable)
656 if (!device_run_wake(phys_dev)) 652 if (!device_run_wake(phys_dev))
657 return -EINVAL; 653 return -EINVAL;
658 654
659 handle = DEVICE_ACPI_HANDLE(phys_dev); 655 handle = ACPI_HANDLE(phys_dev);
660 if (!handle || acpi_bus_get_device(handle, &adev)) { 656 if (!handle || acpi_bus_get_device(handle, &adev)) {
661 dev_dbg(phys_dev, "ACPI handle without context in %s!\n", 657 dev_dbg(phys_dev, "ACPI handle without context in %s!\n",
662 __func__); 658 __func__);
@@ -700,7 +696,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
700 if (!device_can_wakeup(dev)) 696 if (!device_can_wakeup(dev))
701 return -EINVAL; 697 return -EINVAL;
702 698
703 handle = DEVICE_ACPI_HANDLE(dev); 699 handle = ACPI_HANDLE(dev);
704 if (!handle || acpi_bus_get_device(handle, &adev)) { 700 if (!handle || acpi_bus_get_device(handle, &adev)) {
705 dev_dbg(dev, "ACPI handle without context in %s!\n", __func__); 701 dev_dbg(dev, "ACPI handle without context in %s!\n", __func__);
706 return -ENODEV; 702 return -ENODEV;
@@ -722,7 +718,7 @@ int acpi_pm_device_sleep_wake(struct device *dev, bool enable)
722 */ 718 */
723struct acpi_device *acpi_dev_pm_get_node(struct device *dev) 719struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
724{ 720{
725 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 721 acpi_handle handle = ACPI_HANDLE(dev);
726 struct acpi_device *adev; 722 struct acpi_device *adev;
727 723
728 return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL; 724 return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index d5309fd49458..ba5b56db9d27 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -173,9 +173,10 @@ static void start_transaction(struct acpi_ec *ec)
173static void advance_transaction(struct acpi_ec *ec, u8 status) 173static void advance_transaction(struct acpi_ec *ec, u8 status)
174{ 174{
175 unsigned long flags; 175 unsigned long flags;
176 struct transaction *t = ec->curr; 176 struct transaction *t;
177 177
178 spin_lock_irqsave(&ec->lock, flags); 178 spin_lock_irqsave(&ec->lock, flags);
179 t = ec->curr;
179 if (!t) 180 if (!t)
180 goto unlock; 181 goto unlock;
181 if (t->wlen > t->wi) { 182 if (t->wlen > t->wi) {
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 10f0f40587bb..a22a295edb69 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -197,30 +197,28 @@ 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
220 get_device(&acpi_dev->dev);
219 get_device(dev); 221 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); 222 physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL);
225 if (!physical_node) { 223 if (!physical_node) {
226 retval = -ENOMEM; 224 retval = -ENOMEM;
@@ -242,10 +240,11 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
242 240
243 dev_warn(dev, "Already associated with ACPI node\n"); 241 dev_warn(dev, "Already associated with ACPI node\n");
244 kfree(physical_node); 242 kfree(physical_node);
245 if (ACPI_HANDLE(dev) != handle) 243 if (ACPI_COMPANION(dev) != acpi_dev)
246 goto err; 244 goto err;
247 245
248 put_device(dev); 246 put_device(dev);
247 put_device(&acpi_dev->dev);
249 return 0; 248 return 0;
250 } 249 }
251 if (pn->node_id == node_id) { 250 if (pn->node_id == node_id) {
@@ -259,8 +258,8 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
259 list_add(&physical_node->node, physnode_list); 258 list_add(&physical_node->node, physnode_list);
260 acpi_dev->physical_node_count++; 259 acpi_dev->physical_node_count++;
261 260
262 if (!ACPI_HANDLE(dev)) 261 if (!ACPI_COMPANION(dev))
263 ACPI_HANDLE_SET(dev, acpi_dev->handle); 262 ACPI_COMPANION_SET(dev, acpi_dev);
264 263
265 acpi_physnode_link_name(physical_node_name, node_id); 264 acpi_physnode_link_name(physical_node_name, node_id);
266 retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, 265 retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj,
@@ -283,27 +282,21 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
283 return 0; 282 return 0;
284 283
285 err: 284 err:
286 ACPI_HANDLE_SET(dev, NULL); 285 ACPI_COMPANION_SET(dev, NULL);
287 put_device(dev); 286 put_device(dev);
287 put_device(&acpi_dev->dev);
288 return retval; 288 return retval;
289} 289}
290EXPORT_SYMBOL_GPL(acpi_bind_one); 290EXPORT_SYMBOL_GPL(acpi_bind_one);
291 291
292int acpi_unbind_one(struct device *dev) 292int acpi_unbind_one(struct device *dev)
293{ 293{
294 struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
294 struct acpi_device_physical_node *entry; 295 struct acpi_device_physical_node *entry;
295 struct acpi_device *acpi_dev;
296 acpi_status status;
297 296
298 if (!ACPI_HANDLE(dev)) 297 if (!acpi_dev)
299 return 0; 298 return 0;
300 299
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); 300 mutex_lock(&acpi_dev->physical_node_lock);
308 301
309 list_for_each_entry(entry, &acpi_dev->physical_node_list, node) 302 list_for_each_entry(entry, &acpi_dev->physical_node_list, node)
@@ -316,9 +309,10 @@ int acpi_unbind_one(struct device *dev)
316 acpi_physnode_link_name(physnode_name, entry->node_id); 309 acpi_physnode_link_name(physnode_name, entry->node_id);
317 sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name); 310 sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name);
318 sysfs_remove_link(&dev->kobj, "firmware_node"); 311 sysfs_remove_link(&dev->kobj, "firmware_node");
319 ACPI_HANDLE_SET(dev, NULL); 312 ACPI_COMPANION_SET(dev, NULL);
320 /* acpi_bind_one() increase refcnt by one. */ 313 /* Drop references taken by acpi_bind_one(). */
321 put_device(dev); 314 put_device(dev);
315 put_device(&acpi_dev->dev);
322 kfree(entry); 316 kfree(entry);
323 break; 317 break;
324 } 318 }
@@ -328,6 +322,15 @@ int acpi_unbind_one(struct device *dev)
328} 322}
329EXPORT_SYMBOL_GPL(acpi_unbind_one); 323EXPORT_SYMBOL_GPL(acpi_unbind_one);
330 324
325void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr)
326{
327 struct acpi_device *adev;
328
329 if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev))
330 ACPI_COMPANION_SET(dev, adev);
331}
332EXPORT_SYMBOL_GPL(acpi_preset_companion);
333
331static int acpi_platform_notify(struct device *dev) 334static int acpi_platform_notify(struct device *dev)
332{ 335{
333 struct acpi_bus_type *type = acpi_get_bus_type(dev); 336 struct acpi_bus_type *type = acpi_get_bus_type(dev);
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 56f05869b08d..0703bff5e60e 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -575,6 +575,7 @@ static int acpi_pci_root_add(struct acpi_device *device,
575 dev_err(&device->dev, 575 dev_err(&device->dev,
576 "Bus %04x:%02x not present in PCI namespace\n", 576 "Bus %04x:%02x not present in PCI namespace\n",
577 root->segment, (unsigned int)root->secondary.start); 577 root->segment, (unsigned int)root->secondary.start);
578 device->driver_data = NULL;
578 result = -ENODEV; 579 result = -ENODEV;
579 goto end; 580 goto end;
580 } 581 }
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 55f9dedbbf9f..15daa21fcd05 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -289,24 +289,17 @@ void acpi_bus_device_eject(void *data, u32 ost_src)
289{ 289{
290 struct acpi_device *device = data; 290 struct acpi_device *device = data;
291 acpi_handle handle = device->handle; 291 acpi_handle handle = device->handle;
292 struct acpi_scan_handler *handler;
293 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; 292 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
294 int error; 293 int error;
295 294
296 lock_device_hotplug(); 295 lock_device_hotplug();
297 mutex_lock(&acpi_scan_lock); 296 mutex_lock(&acpi_scan_lock);
298 297
299 handler = device->handler;
300 if (!handler || !handler->hotplug.enabled) {
301 put_device(&device->dev);
302 goto err_support;
303 }
304
305 if (ost_src == ACPI_NOTIFY_EJECT_REQUEST) 298 if (ost_src == ACPI_NOTIFY_EJECT_REQUEST)
306 acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST, 299 acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
307 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL); 300 ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
308 301
309 if (handler->hotplug.mode == AHM_CONTAINER) 302 if (device->handler && device->handler->hotplug.mode == AHM_CONTAINER)
310 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); 303 kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
311 304
312 error = acpi_scan_hot_remove(device); 305 error = acpi_scan_hot_remove(device);
@@ -411,8 +404,7 @@ static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
411 break; 404 break;
412 case ACPI_NOTIFY_EJECT_REQUEST: 405 case ACPI_NOTIFY_EJECT_REQUEST:
413 acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n"); 406 acpi_handle_debug(handle, "ACPI_NOTIFY_EJECT_REQUEST event\n");
414 status = acpi_bus_get_device(handle, &adev); 407 if (acpi_bus_get_device(handle, &adev))
415 if (ACPI_FAILURE(status))
416 goto err_out; 408 goto err_out;
417 409
418 get_device(&adev->dev); 410 get_device(&adev->dev);
@@ -1997,6 +1989,7 @@ static int acpi_bus_scan_fixed(void)
1997 if (result) 1989 if (result)
1998 return result; 1990 return result;
1999 1991
1992 device->flags.match_driver = true;
2000 result = device_attach(&device->dev); 1993 result = device_attach(&device->dev);
2001 if (result < 0) 1994 if (result < 0)
2002 return result; 1995 return result;
@@ -2013,6 +2006,7 @@ static int acpi_bus_scan_fixed(void)
2013 if (result) 2006 if (result)
2014 return result; 2007 return result;
2015 2008
2009 device->flags.match_driver = true;
2016 result = device_attach(&device->dev); 2010 result = device_attach(&device->dev);
2017 } 2011 }
2018 2012
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 18dbdff4656e..995e91bcb97b 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -82,13 +82,6 @@ static bool allow_duplicates;
82module_param(allow_duplicates, bool, 0644); 82module_param(allow_duplicates, bool, 0644);
83 83
84/* 84/*
85 * Some BIOSes claim they use minimum backlight at boot,
86 * and this may bring dimming screen after boot
87 */
88static bool use_bios_initial_backlight = 1;
89module_param(use_bios_initial_backlight, bool, 0644);
90
91/*
92 * For Windows 8 systems: if set ture and the GPU driver has 85 * For Windows 8 systems: if set ture and the GPU driver has
93 * registered a backlight interface, skip registering ACPI video's. 86 * registered a backlight interface, skip registering ACPI video's.
94 */ 87 */
@@ -406,12 +399,6 @@ static int __init video_set_bqc_offset(const struct dmi_system_id *d)
406 return 0; 399 return 0;
407} 400}
408 401
409static int video_ignore_initial_backlight(const struct dmi_system_id *d)
410{
411 use_bios_initial_backlight = 0;
412 return 0;
413}
414
415static struct dmi_system_id video_dmi_table[] __initdata = { 402static struct dmi_system_id video_dmi_table[] __initdata = {
416 /* 403 /*
417 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121 404 * Broken _BQC workaround http://bugzilla.kernel.org/show_bug.cgi?id=13121
@@ -456,54 +443,6 @@ static struct dmi_system_id video_dmi_table[] __initdata = {
456 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"), 443 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 7720"),
457 }, 444 },
458 }, 445 },
459 {
460 .callback = video_ignore_initial_backlight,
461 .ident = "HP Folio 13-2000",
462 .matches = {
463 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
464 DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13 - 2000 Notebook PC"),
465 },
466 },
467 {
468 .callback = video_ignore_initial_backlight,
469 .ident = "Fujitsu E753",
470 .matches = {
471 DMI_MATCH(DMI_BOARD_VENDOR, "FUJITSU"),
472 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E753"),
473 },
474 },
475 {
476 .callback = video_ignore_initial_backlight,
477 .ident = "HP Pavilion dm4",
478 .matches = {
479 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
480 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dm4 Notebook PC"),
481 },
482 },
483 {
484 .callback = video_ignore_initial_backlight,
485 .ident = "HP Pavilion g6 Notebook PC",
486 .matches = {
487 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
488 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion g6 Notebook PC"),
489 },
490 },
491 {
492 .callback = video_ignore_initial_backlight,
493 .ident = "HP 1000 Notebook PC",
494 .matches = {
495 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
496 DMI_MATCH(DMI_PRODUCT_NAME, "HP 1000 Notebook PC"),
497 },
498 },
499 {
500 .callback = video_ignore_initial_backlight,
501 .ident = "HP Pavilion m4",
502 .matches = {
503 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
504 DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion m4 Notebook PC"),
505 },
506 },
507 {} 446 {}
508}; 447};
509 448
@@ -839,20 +778,18 @@ acpi_video_init_brightness(struct acpi_video_device *device)
839 if (!device->cap._BQC) 778 if (!device->cap._BQC)
840 goto set_level; 779 goto set_level;
841 780
842 if (use_bios_initial_backlight) { 781 level = acpi_video_bqc_value_to_level(device, level_old);
843 level = acpi_video_bqc_value_to_level(device, level_old); 782 /*
844 /* 783 * On some buggy laptops, _BQC returns an uninitialized
845 * On some buggy laptops, _BQC returns an uninitialized 784 * value when invoked for the first time, i.e.
846 * value when invoked for the first time, i.e. 785 * level_old is invalid (no matter whether it's a level
847 * level_old is invalid (no matter whether it's a level 786 * or an index). Set the backlight to max_level in this case.
848 * or an index). Set the backlight to max_level in this case. 787 */
849 */ 788 for (i = 2; i < br->count; i++)
850 for (i = 2; i < br->count; i++) 789 if (level == br->levels[i])
851 if (level == br->levels[i]) 790 break;
852 break; 791 if (i == br->count || !level)
853 if (i == br->count || !level) 792 level = max_level;
854 level = max_level;
855 }
856 793
857set_level: 794set_level:
858 result = acpi_video_device_lcd_set_level(device, level); 795 result = acpi_video_device_lcd_set_level(device, level);
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/base/power/main.c b/drivers/base/power/main.c
index c12e9b9556be..1b41fca3d65a 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1350,6 +1350,9 @@ static int device_prepare(struct device *dev, pm_message_t state)
1350 1350
1351 device_unlock(dev); 1351 device_unlock(dev);
1352 1352
1353 if (error)
1354 pm_runtime_put(dev);
1355
1353 return error; 1356 return error;
1354} 1357}
1355 1358
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 218460fcd2e4..25a70d06c5bf 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -68,6 +68,9 @@ static void cs_check_cpu(int cpu, unsigned int load)
68 68
69 dbs_info->requested_freq += get_freq_target(cs_tuners, policy); 69 dbs_info->requested_freq += get_freq_target(cs_tuners, policy);
70 70
71 if (dbs_info->requested_freq > policy->max)
72 dbs_info->requested_freq = policy->max;
73
71 __cpufreq_driver_target(policy, dbs_info->requested_freq, 74 __cpufreq_driver_target(policy, dbs_info->requested_freq,
72 CPUFREQ_RELATION_H); 75 CPUFREQ_RELATION_H);
73 return; 76 return;
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 0806c31e5764..e6be63561fa6 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -328,10 +328,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
328 dbs_data->cdata->gov_dbs_timer); 328 dbs_data->cdata->gov_dbs_timer);
329 } 329 }
330 330
331 /*
332 * conservative does not implement micro like ondemand
333 * governor, thus we are bound to jiffes/HZ
334 */
335 if (dbs_data->cdata->governor == GOV_CONSERVATIVE) { 331 if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
336 cs_dbs_info->down_skip = 0; 332 cs_dbs_info->down_skip = 0;
337 cs_dbs_info->enable = 1; 333 cs_dbs_info->enable = 1;
diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index be6d14307aa8..a0acd0bfba40 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -53,6 +53,7 @@ static unsigned int omap_getspeed(unsigned int cpu)
53 53
54static int omap_target(struct cpufreq_policy *policy, unsigned int index) 54static int omap_target(struct cpufreq_policy *policy, unsigned int index)
55{ 55{
56 int r, ret;
56 struct dev_pm_opp *opp; 57 struct dev_pm_opp *opp;
57 unsigned long freq, volt = 0, volt_old = 0, tol = 0; 58 unsigned long freq, volt = 0, volt_old = 0, tol = 0;
58 unsigned int old_freq, new_freq; 59 unsigned int old_freq, new_freq;
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/i915/intel_acpi.c b/drivers/gpu/drm/i915/intel_acpi.c
index 43959edd4291..dfff0907f70e 100644
--- a/drivers/gpu/drm/i915/intel_acpi.c
+++ b/drivers/gpu/drm/i915/intel_acpi.c
@@ -196,7 +196,7 @@ static bool intel_dsm_pci_probe(struct pci_dev *pdev)
196 acpi_handle dhandle; 196 acpi_handle dhandle;
197 int ret; 197 int ret;
198 198
199 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 199 dhandle = ACPI_HANDLE(&pdev->dev);
200 if (!dhandle) 200 if (!dhandle)
201 return false; 201 return false;
202 202
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 1b2f41c3f191..6d69a9bad865 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -638,7 +638,7 @@ static void intel_didl_outputs(struct drm_device *dev)
638 u32 temp; 638 u32 temp;
639 int i = 0; 639 int i = 0;
640 640
641 handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); 641 handle = ACPI_HANDLE(&dev->pdev->dev);
642 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) 642 if (!handle || acpi_bus_get_device(handle, &acpi_dev))
643 return; 643 return;
644 644
diff --git a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
index e286e132c7e7..129120473f6c 100644
--- a/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
+++ b/drivers/gpu/drm/nouveau/core/subdev/mxm/base.c
@@ -116,7 +116,7 @@ mxm_shadow_dsm(struct nouveau_mxm *mxm, u8 version)
116 acpi_handle handle; 116 acpi_handle handle;
117 int ret; 117 int ret;
118 118
119 handle = DEVICE_ACPI_HANDLE(&device->pdev->dev); 119 handle = ACPI_HANDLE(&device->pdev->dev);
120 if (!handle) 120 if (!handle)
121 return false; 121 return false;
122 122
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 07273a2ae62f..95c740454049 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -256,7 +256,7 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
256 acpi_handle dhandle; 256 acpi_handle dhandle;
257 int retval = 0; 257 int retval = 0;
258 258
259 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 259 dhandle = ACPI_HANDLE(&pdev->dev);
260 if (!dhandle) 260 if (!dhandle)
261 return false; 261 return false;
262 262
@@ -414,7 +414,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev)
414 if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected) 414 if (!nouveau_dsm_priv.dsm_detected && !nouveau_dsm_priv.optimus_detected)
415 return false; 415 return false;
416 416
417 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 417 dhandle = ACPI_HANDLE(&pdev->dev);
418 if (!dhandle) 418 if (!dhandle)
419 return false; 419 return false;
420 420
@@ -448,7 +448,7 @@ nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector)
448 return NULL; 448 return NULL;
449 } 449 }
450 450
451 handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev); 451 handle = ACPI_HANDLE(&dev->pdev->dev);
452 if (!handle) 452 if (!handle)
453 return NULL; 453 return NULL;
454 454
diff --git a/drivers/gpu/drm/radeon/radeon_acpi.c b/drivers/gpu/drm/radeon/radeon_acpi.c
index 10f98c7742d8..98a9074b306b 100644
--- a/drivers/gpu/drm/radeon/radeon_acpi.c
+++ b/drivers/gpu/drm/radeon/radeon_acpi.c
@@ -369,7 +369,7 @@ int radeon_atif_handler(struct radeon_device *rdev,
369 return NOTIFY_DONE; 369 return NOTIFY_DONE;
370 370
371 /* Check pending SBIOS requests */ 371 /* Check pending SBIOS requests */
372 handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); 372 handle = ACPI_HANDLE(&rdev->pdev->dev);
373 count = radeon_atif_get_sbios_requests(handle, &req); 373 count = radeon_atif_get_sbios_requests(handle, &req);
374 374
375 if (count <= 0) 375 if (count <= 0)
@@ -556,7 +556,7 @@ int radeon_acpi_pcie_notify_device_ready(struct radeon_device *rdev)
556 struct radeon_atcs *atcs = &rdev->atcs; 556 struct radeon_atcs *atcs = &rdev->atcs;
557 557
558 /* Get the device handle */ 558 /* Get the device handle */
559 handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); 559 handle = ACPI_HANDLE(&rdev->pdev->dev);
560 if (!handle) 560 if (!handle)
561 return -EINVAL; 561 return -EINVAL;
562 562
@@ -596,7 +596,7 @@ int radeon_acpi_pcie_performance_request(struct radeon_device *rdev,
596 u32 retry = 3; 596 u32 retry = 3;
597 597
598 /* Get the device handle */ 598 /* Get the device handle */
599 handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); 599 handle = ACPI_HANDLE(&rdev->pdev->dev);
600 if (!handle) 600 if (!handle)
601 return -EINVAL; 601 return -EINVAL;
602 602
@@ -699,7 +699,7 @@ int radeon_acpi_init(struct radeon_device *rdev)
699 int ret; 699 int ret;
700 700
701 /* Get the device handle */ 701 /* Get the device handle */
702 handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev); 702 handle = ACPI_HANDLE(&rdev->pdev->dev);
703 703
704 /* No need to proceed if we're sure that ATIF is not supported */ 704 /* No need to proceed if we're sure that ATIF is not supported */
705 if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle) 705 if (!ASIC_IS_AVIVO(rdev) || !rdev->bios || !handle)
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index 6153ec18943a..9d302eaeea15 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"
@@ -447,7 +446,7 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
447 acpi_handle dhandle, atpx_handle; 446 acpi_handle dhandle, atpx_handle;
448 acpi_status status; 447 acpi_status status;
449 448
450 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 449 dhandle = ACPI_HANDLE(&pdev->dev);
451 if (!dhandle) 450 if (!dhandle)
452 return false; 451 return false;
453 452
@@ -493,7 +492,7 @@ static int radeon_atpx_init(void)
493 */ 492 */
494static int radeon_atpx_get_client_id(struct pci_dev *pdev) 493static int radeon_atpx_get_client_id(struct pci_dev *pdev)
495{ 494{
496 if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev)) 495 if (radeon_atpx_priv.dhandle == ACPI_HANDLE(&pdev->dev))
497 return VGA_SWITCHEROO_IGD; 496 return VGA_SWITCHEROO_IGD;
498 else 497 else
499 return VGA_SWITCHEROO_DIS; 498 return VGA_SWITCHEROO_DIS;
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index c155d6f3fa68..b3633d9a5317 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -185,7 +185,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
185 return false; 185 return false;
186 186
187 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) { 187 while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {
188 dhandle = DEVICE_ACPI_HANDLE(&pdev->dev); 188 dhandle = ACPI_HANDLE(&pdev->dev);
189 if (!dhandle) 189 if (!dhandle)
190 continue; 190 continue;
191 191
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index ae48d18ee315..5f7e55f4b7f0 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -1008,7 +1008,7 @@ static int i2c_hid_probe(struct i2c_client *client,
1008 hid->hid_get_raw_report = i2c_hid_get_raw_report; 1008 hid->hid_get_raw_report = i2c_hid_get_raw_report;
1009 hid->hid_output_raw_report = i2c_hid_output_raw_report; 1009 hid->hid_output_raw_report = i2c_hid_output_raw_report;
1010 hid->dev.parent = &client->dev; 1010 hid->dev.parent = &client->dev;
1011 ACPI_HANDLE_SET(&hid->dev, ACPI_HANDLE(&client->dev)); 1011 ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev));
1012 hid->bus = BUS_I2C; 1012 hid->bus = BUS_I2C;
1013 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion); 1013 hid->version = le16_to_cpu(ihid->hdesc.bcdVersion);
1014 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID); 1014 hid->vendor = le16_to_cpu(ihid->hdesc.wVendorID);
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 5923cfa390c8..d74c0b34248e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -615,6 +615,22 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
615} 615}
616EXPORT_SYMBOL_GPL(i2c_unlock_adapter); 616EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
617 617
618static void i2c_dev_set_name(struct i2c_adapter *adap,
619 struct i2c_client *client)
620{
621 struct acpi_device *adev = ACPI_COMPANION(&client->dev);
622
623 if (adev) {
624 dev_set_name(&client->dev, "i2c-%s", acpi_dev_name(adev));
625 return;
626 }
627
628 /* For 10-bit clients, add an arbitrary offset to avoid collisions */
629 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
630 client->addr | ((client->flags & I2C_CLIENT_TEN)
631 ? 0xa000 : 0));
632}
633
618/** 634/**
619 * i2c_new_device - instantiate an i2c device 635 * i2c_new_device - instantiate an i2c device
620 * @adap: the adapter managing the device 636 * @adap: the adapter managing the device
@@ -671,12 +687,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
671 client->dev.bus = &i2c_bus_type; 687 client->dev.bus = &i2c_bus_type;
672 client->dev.type = &i2c_client_type; 688 client->dev.type = &i2c_client_type;
673 client->dev.of_node = info->of_node; 689 client->dev.of_node = info->of_node;
674 ACPI_HANDLE_SET(&client->dev, info->acpi_node.handle); 690 ACPI_COMPANION_SET(&client->dev, info->acpi_node.companion);
675 691
676 /* For 10-bit clients, add an arbitrary offset to avoid collisions */ 692 i2c_dev_set_name(adap, client);
677 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
678 client->addr | ((client->flags & I2C_CLIENT_TEN)
679 ? 0xa000 : 0));
680 status = device_register(&client->dev); 693 status = device_register(&client->dev);
681 if (status) 694 if (status)
682 goto out_err; 695 goto out_err;
@@ -1100,7 +1113,7 @@ static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
1100 return AE_OK; 1113 return AE_OK;
1101 1114
1102 memset(&info, 0, sizeof(info)); 1115 memset(&info, 0, sizeof(info));
1103 info.acpi_node.handle = handle; 1116 info.acpi_node.companion = adev;
1104 info.irq = -1; 1117 info.irq = -1;
1105 1118
1106 INIT_LIST_HEAD(&resource_list); 1119 INIT_LIST_HEAD(&resource_list);
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 140c8ef50529..d9e1f7ccfe6f 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 {
@@ -128,7 +127,7 @@ static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,
128 127
129 DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func); 128 DEBPRINT("ENTER: pci %02x:%02x.%01x\n", bus, devnum, func);
130 129
131 dev_handle = DEVICE_ACPI_HANDLE(dev); 130 dev_handle = ACPI_HANDLE(dev);
132 if (!dev_handle) { 131 if (!dev_handle) {
133 DEBPRINT("no acpi handle for device\n"); 132 DEBPRINT("no acpi handle for device\n");
134 goto err; 133 goto err;
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index 3226ce98fb18..cbd4e9abc47e 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * intel_idle.c - native hardware idle loop for modern Intel processors 2 * intel_idle.c - native hardware idle loop for modern Intel processors
3 * 3 *
4 * Copyright (c) 2010, Intel Corporation. 4 * Copyright (c) 2013, Intel Corporation.
5 * Len Brown <len.brown@intel.com> 5 * Len Brown <len.brown@intel.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify it 7 * This program is free software; you can redistribute it and/or modify it
@@ -329,6 +329,22 @@ static struct cpuidle_state atom_cstates[] __initdata = {
329 { 329 {
330 .enter = NULL } 330 .enter = NULL }
331}; 331};
332static struct cpuidle_state avn_cstates[CPUIDLE_STATE_MAX] = {
333 {
334 .name = "C1-AVN",
335 .desc = "MWAIT 0x00",
336 .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TIME_VALID,
337 .exit_latency = 2,
338 .target_residency = 2,
339 .enter = &intel_idle },
340 {
341 .name = "C6-AVN",
342 .desc = "MWAIT 0x51",
343 .flags = MWAIT2flg(0x58) | CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_TLB_FLUSHED,
344 .exit_latency = 15,
345 .target_residency = 45,
346 .enter = &intel_idle },
347};
332 348
333/** 349/**
334 * intel_idle 350 * intel_idle
@@ -462,6 +478,11 @@ static const struct idle_cpu idle_cpu_hsw = {
462 .disable_promotion_to_c1e = true, 478 .disable_promotion_to_c1e = true,
463}; 479};
464 480
481static const struct idle_cpu idle_cpu_avn = {
482 .state_table = avn_cstates,
483 .disable_promotion_to_c1e = true,
484};
485
465#define ICPU(model, cpu) \ 486#define ICPU(model, cpu) \
466 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu } 487 { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (unsigned long)&cpu }
467 488
@@ -483,6 +504,7 @@ static const struct x86_cpu_id intel_idle_ids[] = {
483 ICPU(0x3f, idle_cpu_hsw), 504 ICPU(0x3f, idle_cpu_hsw),
484 ICPU(0x45, idle_cpu_hsw), 505 ICPU(0x45, idle_cpu_hsw),
485 ICPU(0x46, idle_cpu_hsw), 506 ICPU(0x46, idle_cpu_hsw),
507 ICPU(0x4D, idle_cpu_avn),
486 {} 508 {}
487}; 509};
488MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids); 510MODULE_DEVICE_TABLE(x86cpu, intel_idle_ids);
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/acpi_pcihp.c b/drivers/pci/hotplug/acpi_pcihp.c
index 1ce8ee054f1a..a94d850ae228 100644
--- a/drivers/pci/hotplug/acpi_pcihp.c
+++ b/drivers/pci/hotplug/acpi_pcihp.c
@@ -367,7 +367,7 @@ int acpi_get_hp_hw_control_from_firmware(struct pci_dev *pdev, u32 flags)
367 string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL }; 367 string = (struct acpi_buffer){ ACPI_ALLOCATE_BUFFER, NULL };
368 } 368 }
369 369
370 handle = DEVICE_ACPI_HANDLE(&pdev->dev); 370 handle = ACPI_HANDLE(&pdev->dev);
371 if (!handle) { 371 if (!handle) {
372 /* 372 /*
373 * This hotplug controller was not listed in the ACPI name 373 * This hotplug controller was not listed in the ACPI name
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h
index 26100f510b10..1592dbe4f904 100644
--- a/drivers/pci/hotplug/acpiphp.h
+++ b/drivers/pci/hotplug/acpiphp.h
@@ -176,7 +176,6 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot);
176u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot); 176u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot);
177 177
178/* variables */ 178/* variables */
179extern bool acpiphp_debug;
180extern bool acpiphp_disabled; 179extern bool acpiphp_disabled;
181 180
182#endif /* _ACPIPHP_H */ 181#endif /* _ACPIPHP_H */
diff --git a/drivers/pci/hotplug/pciehp_acpi.c b/drivers/pci/hotplug/pciehp_acpi.c
index ead7c534095e..cff7cadfc2e4 100644
--- a/drivers/pci/hotplug/pciehp_acpi.c
+++ b/drivers/pci/hotplug/pciehp_acpi.c
@@ -54,7 +54,7 @@ int pciehp_acpi_slot_detection_check(struct pci_dev *dev)
54{ 54{
55 if (slot_detection_mode != PCIEHP_DETECT_ACPI) 55 if (slot_detection_mode != PCIEHP_DETECT_ACPI)
56 return 0; 56 return 0;
57 if (acpi_pci_detect_ejectable(DEVICE_ACPI_HANDLE(&dev->dev))) 57 if (acpi_pci_detect_ejectable(ACPI_HANDLE(&dev->dev)))
58 return 0; 58 return 0;
59 return -ENODEV; 59 return -ENODEV;
60} 60}
@@ -96,7 +96,7 @@ static int __init dummy_probe(struct pcie_device *dev)
96 dup_slot_id++; 96 dup_slot_id++;
97 } 97 }
98 list_add_tail(&slot->list, &dummy_slots); 98 list_add_tail(&slot->list, &dummy_slots);
99 handle = DEVICE_ACPI_HANDLE(&pdev->dev); 99 handle = ACPI_HANDLE(&pdev->dev);
100 if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle)) 100 if (!acpi_slot_detected && acpi_pci_detect_ejectable(handle))
101 acpi_slot_detected = 1; 101 acpi_slot_detected = 1;
102 return -ENODEV; /* dummy driver always returns error */ 102 return -ENODEV; /* dummy driver always returns error */
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/pci/ioapic.c b/drivers/pci/ioapic.c
index 1b90579b233a..50ce68098298 100644
--- a/drivers/pci/ioapic.c
+++ b/drivers/pci/ioapic.c
@@ -37,7 +37,7 @@ static int ioapic_probe(struct pci_dev *dev, const struct pci_device_id *ent)
37 char *type; 37 char *type;
38 struct resource *res; 38 struct resource *res;
39 39
40 handle = DEVICE_ACPI_HANDLE(&dev->dev); 40 handle = ACPI_HANDLE(&dev->dev);
41 if (!handle) 41 if (!handle)
42 return -EINVAL; 42 return -EINVAL;
43 43
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index dfd1f59de729..f166126e28d1 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -173,14 +173,14 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev)
173 173
174static bool acpi_pci_power_manageable(struct pci_dev *dev) 174static bool acpi_pci_power_manageable(struct pci_dev *dev)
175{ 175{
176 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 176 acpi_handle handle = ACPI_HANDLE(&dev->dev);
177 177
178 return handle ? acpi_bus_power_manageable(handle) : false; 178 return handle ? acpi_bus_power_manageable(handle) : false;
179} 179}
180 180
181static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) 181static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
182{ 182{
183 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 183 acpi_handle handle = ACPI_HANDLE(&dev->dev);
184 static const u8 state_conv[] = { 184 static const u8 state_conv[] = {
185 [PCI_D0] = ACPI_STATE_D0, 185 [PCI_D0] = ACPI_STATE_D0,
186 [PCI_D1] = ACPI_STATE_D1, 186 [PCI_D1] = ACPI_STATE_D1,
@@ -217,7 +217,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
217 217
218static bool acpi_pci_can_wakeup(struct pci_dev *dev) 218static bool acpi_pci_can_wakeup(struct pci_dev *dev)
219{ 219{
220 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 220 acpi_handle handle = ACPI_HANDLE(&dev->dev);
221 221
222 return handle ? acpi_bus_can_wakeup(handle) : false; 222 return handle ? acpi_bus_can_wakeup(handle) : false;
223} 223}
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index edaed6f4da6c..d51f45aa669e 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -263,7 +263,7 @@ device_has_dsm(struct device *dev)
263 acpi_handle handle; 263 acpi_handle handle;
264 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL}; 264 struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
265 265
266 handle = DEVICE_ACPI_HANDLE(dev); 266 handle = ACPI_HANDLE(dev);
267 267
268 if (!handle) 268 if (!handle)
269 return FALSE; 269 return FALSE;
@@ -295,7 +295,7 @@ acpilabel_show(struct device *dev, struct device_attribute *attr, char *buf)
295 acpi_handle handle; 295 acpi_handle handle;
296 int length; 296 int length;
297 297
298 handle = DEVICE_ACPI_HANDLE(dev); 298 handle = ACPI_HANDLE(dev);
299 299
300 if (!handle) 300 if (!handle)
301 return -1; 301 return -1;
@@ -316,7 +316,7 @@ acpiindex_show(struct device *dev, struct device_attribute *attr, char *buf)
316 acpi_handle handle; 316 acpi_handle handle;
317 int length; 317 int length;
318 318
319 handle = DEVICE_ACPI_HANDLE(dev); 319 handle = ACPI_HANDLE(dev);
320 320
321 if (!handle) 321 if (!handle)
322 return -1; 322 return -1;
diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple-gmux.c
index 605a9be55129..b9429fbf1cd8 100644
--- a/drivers/platform/x86/apple-gmux.c
+++ b/drivers/platform/x86/apple-gmux.c
@@ -519,7 +519,7 @@ static int gmux_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
519 519
520 gmux_data->power_state = VGA_SWITCHEROO_ON; 520 gmux_data->power_state = VGA_SWITCHEROO_ON;
521 521
522 gmux_data->dhandle = DEVICE_ACPI_HANDLE(&pnp->dev); 522 gmux_data->dhandle = ACPI_HANDLE(&pnp->dev);
523 if (!gmux_data->dhandle) { 523 if (!gmux_data->dhandle) {
524 pr_err("Cannot find acpi handle for pnp device %s\n", 524 pr_err("Cannot find acpi handle for pnp device %s\n",
525 dev_name(&pnp->dev)); 525 dev_name(&pnp->dev));
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 747826d99059..14655a0f0431 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -89,7 +89,7 @@ static int pnpacpi_set_resources(struct pnp_dev *dev)
89 89
90 pnp_dbg(&dev->dev, "set resources\n"); 90 pnp_dbg(&dev->dev, "set resources\n");
91 91
92 handle = DEVICE_ACPI_HANDLE(&dev->dev); 92 handle = ACPI_HANDLE(&dev->dev);
93 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { 93 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
94 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); 94 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
95 return -ENODEV; 95 return -ENODEV;
@@ -122,7 +122,7 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
122 122
123 dev_dbg(&dev->dev, "disable resources\n"); 123 dev_dbg(&dev->dev, "disable resources\n");
124 124
125 handle = DEVICE_ACPI_HANDLE(&dev->dev); 125 handle = ACPI_HANDLE(&dev->dev);
126 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { 126 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
127 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); 127 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
128 return 0; 128 return 0;
@@ -144,7 +144,7 @@ static bool pnpacpi_can_wakeup(struct pnp_dev *dev)
144 struct acpi_device *acpi_dev; 144 struct acpi_device *acpi_dev;
145 acpi_handle handle; 145 acpi_handle handle;
146 146
147 handle = DEVICE_ACPI_HANDLE(&dev->dev); 147 handle = ACPI_HANDLE(&dev->dev);
148 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { 148 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
149 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); 149 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
150 return false; 150 return false;
@@ -159,7 +159,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
159 acpi_handle handle; 159 acpi_handle handle;
160 int error = 0; 160 int error = 0;
161 161
162 handle = DEVICE_ACPI_HANDLE(&dev->dev); 162 handle = ACPI_HANDLE(&dev->dev);
163 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { 163 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
164 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__); 164 dev_dbg(&dev->dev, "ACPI device not found in %s!\n", __func__);
165 return 0; 165 return 0;
@@ -194,7 +194,7 @@ static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
194static int pnpacpi_resume(struct pnp_dev *dev) 194static int pnpacpi_resume(struct pnp_dev *dev)
195{ 195{
196 struct acpi_device *acpi_dev; 196 struct acpi_device *acpi_dev;
197 acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); 197 acpi_handle handle = ACPI_HANDLE(&dev->dev);
198 int error = 0; 198 int error = 0;
199 199
200 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) { 200 if (!handle || acpi_bus_get_device(handle, &acpi_dev)) {
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 8d85ddc46011..18cc625d887f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -357,6 +357,19 @@ struct spi_device *spi_alloc_device(struct spi_master *master)
357} 357}
358EXPORT_SYMBOL_GPL(spi_alloc_device); 358EXPORT_SYMBOL_GPL(spi_alloc_device);
359 359
360static void spi_dev_set_name(struct spi_device *spi)
361{
362 struct acpi_device *adev = ACPI_COMPANION(&spi->dev);
363
364 if (adev) {
365 dev_set_name(&spi->dev, "spi-%s", acpi_dev_name(adev));
366 return;
367 }
368
369 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev),
370 spi->chip_select);
371}
372
360/** 373/**
361 * spi_add_device - Add spi_device allocated with spi_alloc_device 374 * spi_add_device - Add spi_device allocated with spi_alloc_device
362 * @spi: spi_device to register 375 * @spi: spi_device to register
@@ -383,9 +396,7 @@ int spi_add_device(struct spi_device *spi)
383 } 396 }
384 397
385 /* Set the bus ID string */ 398 /* Set the bus ID string */
386 dev_set_name(&spi->dev, "%s.%u", dev_name(&spi->master->dev), 399 spi_dev_set_name(spi);
387 spi->chip_select);
388
389 400
390 /* We need to make sure there's no other device with this 401 /* We need to make sure there's no other device with this
391 * chipselect **BEFORE** we call setup(), else we'll trash 402 * chipselect **BEFORE** we call setup(), else we'll trash
@@ -1144,7 +1155,7 @@ static acpi_status acpi_spi_add_device(acpi_handle handle, u32 level,
1144 return AE_NO_MEMORY; 1155 return AE_NO_MEMORY;
1145 } 1156 }
1146 1157
1147 ACPI_HANDLE_SET(&spi->dev, handle); 1158 ACPI_COMPANION_SET(&spi->dev, adev);
1148 spi->irq = -1; 1159 spi->irq = -1;
1149 1160
1150 INIT_LIST_HEAD(&resource_list); 1161 INIT_LIST_HEAD(&resource_list);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 06cec635e703..a7c04e24ca48 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5501,6 +5501,6 @@ acpi_handle usb_get_hub_port_acpi_handle(struct usb_device *hdev,
5501 if (!hub) 5501 if (!hub)
5502 return NULL; 5502 return NULL;
5503 5503
5504 return DEVICE_ACPI_HANDLE(&hub->ports[port1 - 1]->dev); 5504 return ACPI_HANDLE(&hub->ports[port1 - 1]->dev);
5505} 5505}
5506#endif 5506#endif
diff --git a/drivers/usb/core/usb-acpi.c b/drivers/usb/core/usb-acpi.c
index 255c14464bf2..4e243c37f17f 100644
--- a/drivers/usb/core/usb-acpi.c
+++ b/drivers/usb/core/usb-acpi.c
@@ -173,7 +173,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
173 } 173 }
174 174
175 /* root hub's parent is the usb hcd. */ 175 /* root hub's parent is the usb hcd. */
176 parent_handle = DEVICE_ACPI_HANDLE(dev->parent); 176 parent_handle = ACPI_HANDLE(dev->parent);
177 *handle = acpi_get_child(parent_handle, udev->portnum); 177 *handle = acpi_get_child(parent_handle, udev->portnum);
178 if (!*handle) 178 if (!*handle)
179 return -ENODEV; 179 return -ENODEV;
@@ -194,7 +194,7 @@ static int usb_acpi_find_device(struct device *dev, acpi_handle *handle)
194 194
195 raw_port_num = usb_hcd_find_raw_port_number(hcd, 195 raw_port_num = usb_hcd_find_raw_port_number(hcd,
196 port_num); 196 port_num);
197 *handle = acpi_get_child(DEVICE_ACPI_HANDLE(&udev->dev), 197 *handle = acpi_get_child(ACPI_HANDLE(&udev->dev),
198 raw_port_num); 198 raw_port_num);
199 if (!*handle) 199 if (!*handle)
200 return -ENODEV; 200 return -ENODEV;
diff --git a/drivers/xen/pci.c b/drivers/xen/pci.c
index d15f6e80479f..188825122aae 100644
--- a/drivers/xen/pci.c
+++ b/drivers/xen/pci.c
@@ -59,12 +59,12 @@ static int xen_add_device(struct device *dev)
59 add.flags = XEN_PCI_DEV_EXTFN; 59 add.flags = XEN_PCI_DEV_EXTFN;
60 60
61#ifdef CONFIG_ACPI 61#ifdef CONFIG_ACPI
62 handle = DEVICE_ACPI_HANDLE(&pci_dev->dev); 62 handle = ACPI_HANDLE(&pci_dev->dev);
63 if (!handle && pci_dev->bus->bridge) 63 if (!handle && pci_dev->bus->bridge)
64 handle = DEVICE_ACPI_HANDLE(pci_dev->bus->bridge); 64 handle = ACPI_HANDLE(pci_dev->bus->bridge);
65#ifdef CONFIG_PCI_IOV 65#ifdef CONFIG_PCI_IOV
66 if (!handle && pci_dev->is_virtfn) 66 if (!handle && pci_dev->is_virtfn)
67 handle = DEVICE_ACPI_HANDLE(physfn->bus->bridge); 67 handle = ACPI_HANDLE(physfn->bus->bridge);
68#endif 68#endif
69 if (handle) { 69 if (handle) {
70 acpi_status status; 70 acpi_status status;