aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2012-07-25 15:58:48 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-07-25 15:58:48 -0400
commit8407884dd9164ec18ed2afc00f56b87e36c51fcf (patch)
treeb6ea42c231d7d39f454de28a068d78ce11709770 /drivers/acpi
parentdc7f71f486f4f5fa96f6dcf86833da020cde8a11 (diff)
parentbdc0077af574800d24318b6945cf2344e8dbb050 (diff)
Merge branch 'master' [vanilla Linus master] into libata-dev.git/upstream
Two bits were appended to the end of the bitfield list in struct scsi_device. Resolve that conflict by including both bits. Conflicts: include/scsi/scsi_device.h
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/ac.c17
-rw-r--r--drivers/acpi/acpi_pad.c7
-rw-r--r--drivers/acpi/acpica/hwsleep.c22
-rw-r--r--drivers/acpi/acpica/nspredef.c2
-rw-r--r--drivers/acpi/apei/apei-base.c17
-rw-r--r--drivers/acpi/apei/apei-internal.h9
-rw-r--r--drivers/acpi/apei/ghes.c6
-rw-r--r--drivers/acpi/battery.c15
-rw-r--r--drivers/acpi/button.c9
-rw-r--r--drivers/acpi/fan.c21
-rw-r--r--drivers/acpi/pci_root.c2
-rw-r--r--drivers/acpi/power.c12
-rw-r--r--drivers/acpi/processor_core.c6
-rw-r--r--drivers/acpi/processor_driver.c13
-rw-r--r--drivers/acpi/processor_idle.c21
-rw-r--r--drivers/acpi/sbs.c10
-rw-r--r--drivers/acpi/scan.c22
-rw-r--r--drivers/acpi/sleep.c24
-rw-r--r--drivers/acpi/sysfs.c4
-rw-r--r--drivers/acpi/thermal.c17
-rw-r--r--drivers/acpi/video.c2
21 files changed, 135 insertions, 123 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 6512b20aeccd..ff9f6bd48301 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -61,7 +61,6 @@ static int acpi_ac_open_fs(struct inode *inode, struct file *file);
61 61
62static int acpi_ac_add(struct acpi_device *device); 62static int acpi_ac_add(struct acpi_device *device);
63static int acpi_ac_remove(struct acpi_device *device, int type); 63static int acpi_ac_remove(struct acpi_device *device, int type);
64static int acpi_ac_resume(struct acpi_device *device);
65static void acpi_ac_notify(struct acpi_device *device, u32 event); 64static void acpi_ac_notify(struct acpi_device *device, u32 event);
66 65
67static const struct acpi_device_id ac_device_ids[] = { 66static const struct acpi_device_id ac_device_ids[] = {
@@ -70,6 +69,9 @@ static const struct acpi_device_id ac_device_ids[] = {
70}; 69};
71MODULE_DEVICE_TABLE(acpi, ac_device_ids); 70MODULE_DEVICE_TABLE(acpi, ac_device_ids);
72 71
72static int acpi_ac_resume(struct device *dev);
73static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
74
73static struct acpi_driver acpi_ac_driver = { 75static struct acpi_driver acpi_ac_driver = {
74 .name = "ac", 76 .name = "ac",
75 .class = ACPI_AC_CLASS, 77 .class = ACPI_AC_CLASS,
@@ -78,9 +80,9 @@ static struct acpi_driver acpi_ac_driver = {
78 .ops = { 80 .ops = {
79 .add = acpi_ac_add, 81 .add = acpi_ac_add,
80 .remove = acpi_ac_remove, 82 .remove = acpi_ac_remove,
81 .resume = acpi_ac_resume,
82 .notify = acpi_ac_notify, 83 .notify = acpi_ac_notify,
83 }, 84 },
85 .drv.pm = &acpi_ac_pm,
84}; 86};
85 87
86struct acpi_ac { 88struct acpi_ac {
@@ -309,13 +311,18 @@ static int acpi_ac_add(struct acpi_device *device)
309 return result; 311 return result;
310} 312}
311 313
312static int acpi_ac_resume(struct acpi_device *device) 314static int acpi_ac_resume(struct device *dev)
313{ 315{
314 struct acpi_ac *ac; 316 struct acpi_ac *ac;
315 unsigned old_state; 317 unsigned old_state;
316 if (!device || !acpi_driver_data(device)) 318
319 if (!dev)
317 return -EINVAL; 320 return -EINVAL;
318 ac = acpi_driver_data(device); 321
322 ac = acpi_driver_data(to_acpi_device(dev));
323 if (!ac)
324 return -EINVAL;
325
319 old_state = ac->state; 326 old_state = ac->state;
320 if (acpi_ac_get_state(ac)) 327 if (acpi_ac_get_state(ac))
321 return 0; 328 return 0;
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index a43fa1a57d57..1502c50273b5 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -36,6 +36,7 @@
36#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator" 36#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
37#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80 37#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
38static DEFINE_MUTEX(isolated_cpus_lock); 38static DEFINE_MUTEX(isolated_cpus_lock);
39static DEFINE_MUTEX(round_robin_lock);
39 40
40static unsigned long power_saving_mwait_eax; 41static unsigned long power_saving_mwait_eax;
41 42
@@ -107,7 +108,7 @@ static void round_robin_cpu(unsigned int tsk_index)
107 if (!alloc_cpumask_var(&tmp, GFP_KERNEL)) 108 if (!alloc_cpumask_var(&tmp, GFP_KERNEL))
108 return; 109 return;
109 110
110 mutex_lock(&isolated_cpus_lock); 111 mutex_lock(&round_robin_lock);
111 cpumask_clear(tmp); 112 cpumask_clear(tmp);
112 for_each_cpu(cpu, pad_busy_cpus) 113 for_each_cpu(cpu, pad_busy_cpus)
113 cpumask_or(tmp, tmp, topology_thread_cpumask(cpu)); 114 cpumask_or(tmp, tmp, topology_thread_cpumask(cpu));
@@ -116,7 +117,7 @@ static void round_robin_cpu(unsigned int tsk_index)
116 if (cpumask_empty(tmp)) 117 if (cpumask_empty(tmp))
117 cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus); 118 cpumask_andnot(tmp, cpu_online_mask, pad_busy_cpus);
118 if (cpumask_empty(tmp)) { 119 if (cpumask_empty(tmp)) {
119 mutex_unlock(&isolated_cpus_lock); 120 mutex_unlock(&round_robin_lock);
120 return; 121 return;
121 } 122 }
122 for_each_cpu(cpu, tmp) { 123 for_each_cpu(cpu, tmp) {
@@ -131,7 +132,7 @@ static void round_robin_cpu(unsigned int tsk_index)
131 tsk_in_cpu[tsk_index] = preferred_cpu; 132 tsk_in_cpu[tsk_index] = preferred_cpu;
132 cpumask_set_cpu(preferred_cpu, pad_busy_cpus); 133 cpumask_set_cpu(preferred_cpu, pad_busy_cpus);
133 cpu_weight[preferred_cpu]++; 134 cpu_weight[preferred_cpu]++;
134 mutex_unlock(&isolated_cpus_lock); 135 mutex_unlock(&round_robin_lock);
135 136
136 set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu)); 137 set_cpus_allowed_ptr(current, cpumask_of(preferred_cpu));
137} 138}
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 0ed85cac3231..615996a36bed 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -95,18 +95,6 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state, u8 flags)
95 return_ACPI_STATUS(status); 95 return_ACPI_STATUS(status);
96 } 96 }
97 97
98 if (sleep_state != ACPI_STATE_S5) {
99 /*
100 * Disable BM arbitration. This feature is contained within an
101 * optional register (PM2 Control), so ignore a BAD_ADDRESS
102 * exception.
103 */
104 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 1);
105 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
106 return_ACPI_STATUS(status);
107 }
108 }
109
110 /* 98 /*
111 * 1) Disable/Clear all GPEs 99 * 1) Disable/Clear all GPEs
112 * 2) Enable all wakeup GPEs 100 * 2) Enable all wakeup GPEs
@@ -364,16 +352,6 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state, u8 flags)
364 [ACPI_EVENT_POWER_BUTTON]. 352 [ACPI_EVENT_POWER_BUTTON].
365 status_register_id, ACPI_CLEAR_STATUS); 353 status_register_id, ACPI_CLEAR_STATUS);
366 354
367 /*
368 * Enable BM arbitration. This feature is contained within an
369 * optional register (PM2 Control), so ignore a BAD_ADDRESS
370 * exception.
371 */
372 status = acpi_write_bit_register(ACPI_BITREG_ARB_DISABLE, 0);
373 if (ACPI_FAILURE(status) && (status != AE_BAD_ADDRESS)) {
374 return_ACPI_STATUS(status);
375 }
376
377 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING); 355 acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
378 return_ACPI_STATUS(status); 356 return_ACPI_STATUS(status);
379} 357}
diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c
index 23ce09686418..fe6626035495 100644
--- a/drivers/acpi/acpica/nspredef.c
+++ b/drivers/acpi/acpica/nspredef.c
@@ -638,7 +638,7 @@ acpi_ns_check_package(struct acpi_predefined_data *data,
638 /* Create the new outer package and populate it */ 638 /* Create the new outer package and populate it */
639 639
640 status = 640 status =
641 acpi_ns_wrap_with_package(data, *elements, 641 acpi_ns_wrap_with_package(data, return_object,
642 return_object_ptr); 642 return_object_ptr);
643 if (ACPI_FAILURE(status)) { 643 if (ACPI_FAILURE(status)) {
644 return (status); 644 return (status);
diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c
index 5577762daee1..6686b1eaf13e 100644
--- a/drivers/acpi/apei/apei-base.c
+++ b/drivers/acpi/apei/apei-base.c
@@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx,
243 u8 ins = entry->instruction; 243 u8 ins = entry->instruction;
244 244
245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 245 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
246 return acpi_os_map_generic_address(&entry->register_region); 246 return apei_map_generic_address(&entry->register_region);
247 247
248 return 0; 248 return 0;
249} 249}
@@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx,
276 u8 ins = entry->instruction; 276 u8 ins = entry->instruction;
277 277
278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER) 278 if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
279 acpi_os_unmap_generic_address(&entry->register_region); 279 apei_unmap_generic_address(&entry->register_region);
280 280
281 return 0; 281 return 0;
282} 282}
@@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
606 return 0; 606 return 0;
607} 607}
608 608
609int apei_map_generic_address(struct acpi_generic_address *reg)
610{
611 int rc;
612 u32 access_bit_width;
613 u64 address;
614
615 rc = apei_check_gar(reg, &address, &access_bit_width);
616 if (rc)
617 return rc;
618 return acpi_os_map_generic_address(reg);
619}
620EXPORT_SYMBOL_GPL(apei_map_generic_address);
621
609/* read GAR in interrupt (including NMI) or process context */ 622/* read GAR in interrupt (including NMI) or process context */
610int apei_read(u64 *val, struct acpi_generic_address *reg) 623int apei_read(u64 *val, struct acpi_generic_address *reg)
611{ 624{
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index cca240a33038..f220d642136e 100644
--- a/drivers/acpi/apei/apei-internal.h
+++ b/drivers/acpi/apei/apei-internal.h
@@ -7,6 +7,8 @@
7#define APEI_INTERNAL_H 7#define APEI_INTERNAL_H
8 8
9#include <linux/cper.h> 9#include <linux/cper.h>
10#include <linux/acpi.h>
11#include <linux/acpi_io.h>
10 12
11struct apei_exec_context; 13struct apei_exec_context;
12 14
@@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio
68/* IP has been set in instruction function */ 70/* IP has been set in instruction function */
69#define APEI_EXEC_SET_IP 1 71#define APEI_EXEC_SET_IP 1
70 72
73int apei_map_generic_address(struct acpi_generic_address *reg);
74
75static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
76{
77 acpi_os_unmap_generic_address(reg);
78}
79
71int apei_read(u64 *val, struct acpi_generic_address *reg); 80int apei_read(u64 *val, struct acpi_generic_address *reg);
72int apei_write(u64 val, struct acpi_generic_address *reg); 81int apei_write(u64 val, struct acpi_generic_address *reg);
73 82
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 9b3cac0abecc..1599566ed1fe 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
301 if (!ghes) 301 if (!ghes)
302 return ERR_PTR(-ENOMEM); 302 return ERR_PTR(-ENOMEM);
303 ghes->generic = generic; 303 ghes->generic = generic;
304 rc = acpi_os_map_generic_address(&generic->error_status_address); 304 rc = apei_map_generic_address(&generic->error_status_address);
305 if (rc) 305 if (rc)
306 goto err_free; 306 goto err_free;
307 error_block_length = generic->error_block_length; 307 error_block_length = generic->error_block_length;
@@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
321 return ghes; 321 return ghes;
322 322
323err_unmap: 323err_unmap:
324 acpi_os_unmap_generic_address(&generic->error_status_address); 324 apei_unmap_generic_address(&generic->error_status_address);
325err_free: 325err_free:
326 kfree(ghes); 326 kfree(ghes);
327 return ERR_PTR(rc); 327 return ERR_PTR(rc);
@@ -330,7 +330,7 @@ err_free:
330static void ghes_fini(struct ghes *ghes) 330static void ghes_fini(struct ghes *ghes)
331{ 331{
332 kfree(ghes->estatus); 332 kfree(ghes->estatus);
333 acpi_os_unmap_generic_address(&ghes->generic->error_status_address); 333 apei_unmap_generic_address(&ghes->generic->error_status_address);
334} 334}
335 335
336enum { 336enum {
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 7dd3f9fb9f3f..023f9c8534d0 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1044,17 +1044,24 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
1044} 1044}
1045 1045
1046/* this is needed to learn about changes made in suspended state */ 1046/* this is needed to learn about changes made in suspended state */
1047static int acpi_battery_resume(struct acpi_device *device) 1047static int acpi_battery_resume(struct device *dev)
1048{ 1048{
1049 struct acpi_battery *battery; 1049 struct acpi_battery *battery;
1050 if (!device) 1050
1051 if (!dev)
1051 return -EINVAL; 1052 return -EINVAL;
1052 battery = acpi_driver_data(device); 1053
1054 battery = acpi_driver_data(to_acpi_device(dev));
1055 if (!battery)
1056 return -EINVAL;
1057
1053 battery->update_time = 0; 1058 battery->update_time = 0;
1054 acpi_battery_update(battery); 1059 acpi_battery_update(battery);
1055 return 0; 1060 return 0;
1056} 1061}
1057 1062
1063static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
1064
1058static struct acpi_driver acpi_battery_driver = { 1065static struct acpi_driver acpi_battery_driver = {
1059 .name = "battery", 1066 .name = "battery",
1060 .class = ACPI_BATTERY_CLASS, 1067 .class = ACPI_BATTERY_CLASS,
@@ -1062,10 +1069,10 @@ static struct acpi_driver acpi_battery_driver = {
1062 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 1069 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
1063 .ops = { 1070 .ops = {
1064 .add = acpi_battery_add, 1071 .add = acpi_battery_add,
1065 .resume = acpi_battery_resume,
1066 .remove = acpi_battery_remove, 1072 .remove = acpi_battery_remove,
1067 .notify = acpi_battery_notify, 1073 .notify = acpi_battery_notify,
1068 }, 1074 },
1075 .drv.pm = &acpi_battery_pm,
1069}; 1076};
1070 1077
1071static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) 1078static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index d27d072472f9..79d4c22f7a6d 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -76,19 +76,21 @@ MODULE_DEVICE_TABLE(acpi, button_device_ids);
76 76
77static int acpi_button_add(struct acpi_device *device); 77static int acpi_button_add(struct acpi_device *device);
78static int acpi_button_remove(struct acpi_device *device, int type); 78static int acpi_button_remove(struct acpi_device *device, int type);
79static int acpi_button_resume(struct acpi_device *device);
80static void acpi_button_notify(struct acpi_device *device, u32 event); 79static void acpi_button_notify(struct acpi_device *device, u32 event);
81 80
81static int acpi_button_resume(struct device *dev);
82static SIMPLE_DEV_PM_OPS(acpi_button_pm, NULL, acpi_button_resume);
83
82static struct acpi_driver acpi_button_driver = { 84static struct acpi_driver acpi_button_driver = {
83 .name = "button", 85 .name = "button",
84 .class = ACPI_BUTTON_CLASS, 86 .class = ACPI_BUTTON_CLASS,
85 .ids = button_device_ids, 87 .ids = button_device_ids,
86 .ops = { 88 .ops = {
87 .add = acpi_button_add, 89 .add = acpi_button_add,
88 .resume = acpi_button_resume,
89 .remove = acpi_button_remove, 90 .remove = acpi_button_remove,
90 .notify = acpi_button_notify, 91 .notify = acpi_button_notify,
91 }, 92 },
93 .drv.pm = &acpi_button_pm,
92}; 94};
93 95
94struct acpi_button { 96struct acpi_button {
@@ -308,8 +310,9 @@ static void acpi_button_notify(struct acpi_device *device, u32 event)
308 } 310 }
309} 311}
310 312
311static int acpi_button_resume(struct acpi_device *device) 313static int acpi_button_resume(struct device *dev)
312{ 314{
315 struct acpi_device *device = to_acpi_device(dev);
313 struct acpi_button *button = acpi_driver_data(device); 316 struct acpi_button *button = acpi_driver_data(device);
314 317
315 if (button->type == ACPI_BUTTON_TYPE_LID) 318 if (button->type == ACPI_BUTTON_TYPE_LID)
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c
index 0f0356ca1a9e..669d9ee80d16 100644
--- a/drivers/acpi/fan.c
+++ b/drivers/acpi/fan.c
@@ -46,8 +46,6 @@ MODULE_LICENSE("GPL");
46 46
47static int acpi_fan_add(struct acpi_device *device); 47static int acpi_fan_add(struct acpi_device *device);
48static int acpi_fan_remove(struct acpi_device *device, int type); 48static int acpi_fan_remove(struct acpi_device *device, int type);
49static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state);
50static int acpi_fan_resume(struct acpi_device *device);
51 49
52static const struct acpi_device_id fan_device_ids[] = { 50static const struct acpi_device_id fan_device_ids[] = {
53 {"PNP0C0B", 0}, 51 {"PNP0C0B", 0},
@@ -55,6 +53,10 @@ static const struct acpi_device_id fan_device_ids[] = {
55}; 53};
56MODULE_DEVICE_TABLE(acpi, fan_device_ids); 54MODULE_DEVICE_TABLE(acpi, fan_device_ids);
57 55
56static int acpi_fan_suspend(struct device *dev);
57static int acpi_fan_resume(struct device *dev);
58static SIMPLE_DEV_PM_OPS(acpi_fan_pm, acpi_fan_suspend, acpi_fan_resume);
59
58static struct acpi_driver acpi_fan_driver = { 60static struct acpi_driver acpi_fan_driver = {
59 .name = "fan", 61 .name = "fan",
60 .class = ACPI_FAN_CLASS, 62 .class = ACPI_FAN_CLASS,
@@ -62,9 +64,8 @@ static struct acpi_driver acpi_fan_driver = {
62 .ops = { 64 .ops = {
63 .add = acpi_fan_add, 65 .add = acpi_fan_add,
64 .remove = acpi_fan_remove, 66 .remove = acpi_fan_remove,
65 .suspend = acpi_fan_suspend,
66 .resume = acpi_fan_resume,
67 }, 67 },
68 .drv.pm = &acpi_fan_pm,
68}; 69};
69 70
70/* thermal cooling device callbacks */ 71/* thermal cooling device callbacks */
@@ -183,24 +184,24 @@ static int acpi_fan_remove(struct acpi_device *device, int type)
183 return 0; 184 return 0;
184} 185}
185 186
186static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state) 187static int acpi_fan_suspend(struct device *dev)
187{ 188{
188 if (!device) 189 if (!dev)
189 return -EINVAL; 190 return -EINVAL;
190 191
191 acpi_bus_set_power(device->handle, ACPI_STATE_D0); 192 acpi_bus_set_power(to_acpi_device(dev)->handle, ACPI_STATE_D0);
192 193
193 return AE_OK; 194 return AE_OK;
194} 195}
195 196
196static int acpi_fan_resume(struct acpi_device *device) 197static int acpi_fan_resume(struct device *dev)
197{ 198{
198 int result; 199 int result;
199 200
200 if (!device) 201 if (!dev)
201 return -EINVAL; 202 return -EINVAL;
202 203
203 result = acpi_bus_update_power(device->handle, NULL); 204 result = acpi_bus_update_power(to_acpi_device(dev)->handle, NULL);
204 if (result) 205 if (result)
205 printk(KERN_ERR PREFIX "Error updating fan power state\n"); 206 printk(KERN_ERR PREFIX "Error updating fan power state\n");
206 207
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 7aff6312ce7c..ec54014c321c 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -505,6 +505,8 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
505 strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS); 505 strcpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
506 device->driver_data = root; 506 device->driver_data = root;
507 507
508 root->mcfg_addr = acpi_pci_root_get_mcfg_addr(device->handle);
509
508 /* 510 /*
509 * All supported architectures that use ACPI have support for 511 * All supported architectures that use ACPI have support for
510 * PCI domains, so we indicate this in _OSC support capabilities. 512 * PCI domains, so we indicate this in _OSC support capabilities.
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index eb6408741a8f..215ecd097408 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -60,7 +60,6 @@ ACPI_MODULE_NAME("power");
60 60
61static int acpi_power_add(struct acpi_device *device); 61static int acpi_power_add(struct acpi_device *device);
62static int acpi_power_remove(struct acpi_device *device, int type); 62static int acpi_power_remove(struct acpi_device *device, int type);
63static int acpi_power_resume(struct acpi_device *device);
64 63
65static const struct acpi_device_id power_device_ids[] = { 64static const struct acpi_device_id power_device_ids[] = {
66 {ACPI_POWER_HID, 0}, 65 {ACPI_POWER_HID, 0},
@@ -68,6 +67,9 @@ static const struct acpi_device_id power_device_ids[] = {
68}; 67};
69MODULE_DEVICE_TABLE(acpi, power_device_ids); 68MODULE_DEVICE_TABLE(acpi, power_device_ids);
70 69
70static int acpi_power_resume(struct device *dev);
71static SIMPLE_DEV_PM_OPS(acpi_power_pm, NULL, acpi_power_resume);
72
71static struct acpi_driver acpi_power_driver = { 73static struct acpi_driver acpi_power_driver = {
72 .name = "power", 74 .name = "power",
73 .class = ACPI_POWER_CLASS, 75 .class = ACPI_POWER_CLASS,
@@ -75,8 +77,8 @@ static struct acpi_driver acpi_power_driver = {
75 .ops = { 77 .ops = {
76 .add = acpi_power_add, 78 .add = acpi_power_add,
77 .remove = acpi_power_remove, 79 .remove = acpi_power_remove,
78 .resume = acpi_power_resume,
79 }, 80 },
81 .drv.pm = &acpi_power_pm,
80}; 82};
81 83
82/* 84/*
@@ -773,14 +775,16 @@ static int acpi_power_remove(struct acpi_device *device, int type)
773 return 0; 775 return 0;
774} 776}
775 777
776static int acpi_power_resume(struct acpi_device *device) 778static int acpi_power_resume(struct device *dev)
777{ 779{
778 int result = 0, state; 780 int result = 0, state;
781 struct acpi_device *device;
779 struct acpi_power_resource *resource; 782 struct acpi_power_resource *resource;
780 783
781 if (!device) 784 if (!dev)
782 return -EINVAL; 785 return -EINVAL;
783 786
787 device = to_acpi_device(dev);
784 resource = acpi_driver_data(device); 788 resource = acpi_driver_data(device);
785 if (!resource) 789 if (!resource)
786 return -EINVAL; 790 return -EINVAL;
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index c850de4c9a14..eff722278ff5 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -189,10 +189,12 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
189 * Processor (CPU3, 0x03, 0x00000410, 0x06) {} 189 * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
190 * } 190 * }
191 * 191 *
192 * Ignores apic_id and always return 0 for CPU0's handle. 192 * Ignores apic_id and always returns 0 for the processor
193 * handle with acpi id 0 if nr_cpu_ids is 1.
194 * This should be the case if SMP tables are not found.
193 * Return -1 for other CPU's handle. 195 * Return -1 for other CPU's handle.
194 */ 196 */
195 if (acpi_id == 0) 197 if (nr_cpu_ids <= 1 && acpi_id == 0)
196 return acpi_id; 198 return acpi_id;
197 else 199 else
198 return apic_id; 200 return apic_id;
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
index 0734086537b8..7048b97853e0 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -93,6 +93,9 @@ static const struct acpi_device_id processor_device_ids[] = {
93}; 93};
94MODULE_DEVICE_TABLE(acpi, processor_device_ids); 94MODULE_DEVICE_TABLE(acpi, processor_device_ids);
95 95
96static SIMPLE_DEV_PM_OPS(acpi_processor_pm,
97 acpi_processor_suspend, acpi_processor_resume);
98
96static struct acpi_driver acpi_processor_driver = { 99static struct acpi_driver acpi_processor_driver = {
97 .name = "processor", 100 .name = "processor",
98 .class = ACPI_PROCESSOR_CLASS, 101 .class = ACPI_PROCESSOR_CLASS,
@@ -100,10 +103,9 @@ static struct acpi_driver acpi_processor_driver = {
100 .ops = { 103 .ops = {
101 .add = acpi_processor_add, 104 .add = acpi_processor_add,
102 .remove = acpi_processor_remove, 105 .remove = acpi_processor_remove,
103 .suspend = acpi_processor_suspend,
104 .resume = acpi_processor_resume,
105 .notify = acpi_processor_notify, 106 .notify = acpi_processor_notify,
106 }, 107 },
108 .drv.pm = &acpi_processor_pm,
107}; 109};
108 110
109#define INSTALL_NOTIFY_HANDLER 1 111#define INSTALL_NOTIFY_HANDLER 1
@@ -427,18 +429,11 @@ static int acpi_cpu_soft_notify(struct notifier_block *nfb,
427 * Initialize missing things 429 * Initialize missing things
428 */ 430 */
429 if (pr->flags.need_hotplug_init) { 431 if (pr->flags.need_hotplug_init) {
430 struct cpuidle_driver *idle_driver =
431 cpuidle_get_driver();
432
433 printk(KERN_INFO "Will online and init hotplugged " 432 printk(KERN_INFO "Will online and init hotplugged "
434 "CPU: %d\n", pr->id); 433 "CPU: %d\n", pr->id);
435 WARN(acpi_processor_start(pr), "Failed to start CPU:" 434 WARN(acpi_processor_start(pr), "Failed to start CPU:"
436 " %d\n", pr->id); 435 " %d\n", pr->id);
437 pr->flags.need_hotplug_init = 0; 436 pr->flags.need_hotplug_init = 0;
438 if (idle_driver && !strcmp(idle_driver->name,
439 "intel_idle")) {
440 intel_idle_cpu_init(pr->id);
441 }
442 /* Normal CPU soft online event */ 437 /* Normal CPU soft online event */
443 } else { 438 } else {
444 acpi_processor_ppc_has_changed(pr, 0); 439 acpi_processor_ppc_has_changed(pr, 0);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index f3decb30223f..e589c1985248 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -221,9 +221,6 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,
221 221
222#endif 222#endif
223 223
224/*
225 * Suspend / resume control
226 */
227static u32 saved_bm_rld; 224static u32 saved_bm_rld;
228 225
229static void acpi_idle_bm_rld_save(void) 226static void acpi_idle_bm_rld_save(void)
@@ -240,13 +237,13 @@ static void acpi_idle_bm_rld_restore(void)
240 acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld); 237 acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
241} 238}
242 239
243int acpi_processor_suspend(struct acpi_device * device, pm_message_t state) 240int acpi_processor_suspend(struct device *dev)
244{ 241{
245 acpi_idle_bm_rld_save(); 242 acpi_idle_bm_rld_save();
246 return 0; 243 return 0;
247} 244}
248 245
249int acpi_processor_resume(struct acpi_device * device) 246int acpi_processor_resume(struct device *dev)
250{ 247{
251 acpi_idle_bm_rld_restore(); 248 acpi_idle_bm_rld_restore();
252 return 0; 249 return 0;
@@ -586,7 +583,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
586 */ 583 */
587 cx->valid = 1; 584 cx->valid = 1;
588 585
589 cx->latency_ticks = cx->latency;
590 /* 586 /*
591 * On older chipsets, BM_RLD needs to be set 587 * On older chipsets, BM_RLD needs to be set
592 * in order for Bus Master activity to wake the 588 * in order for Bus Master activity to wake the
@@ -619,7 +615,6 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
619 if (!cx->address) 615 if (!cx->address)
620 break; 616 break;
621 cx->valid = 1; 617 cx->valid = 1;
622 cx->latency_ticks = cx->latency; /* Normalize latency */
623 break; 618 break;
624 619
625 case ACPI_STATE_C3: 620 case ACPI_STATE_C3:
@@ -754,6 +749,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
754 749
755 local_irq_disable(); 750 local_irq_disable();
756 751
752
757 lapic_timer_state_broadcast(pr, cx, 1); 753 lapic_timer_state_broadcast(pr, cx, 1);
758 kt1 = ktime_get_real(); 754 kt1 = ktime_get_real();
759 acpi_idle_do_entry(cx); 755 acpi_idle_do_entry(cx);
@@ -764,7 +760,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
764 dev->last_residency = (int)idle_time; 760 dev->last_residency = (int)idle_time;
765 761
766 local_irq_enable(); 762 local_irq_enable();
767 cx->usage++;
768 lapic_timer_state_broadcast(pr, cx, 0); 763 lapic_timer_state_broadcast(pr, cx, 0);
769 764
770 return index; 765 return index;
@@ -823,6 +818,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
823 818
824 local_irq_disable(); 819 local_irq_disable();
825 820
821
826 if (cx->entry_method != ACPI_CSTATE_FFH) { 822 if (cx->entry_method != ACPI_CSTATE_FFH) {
827 current_thread_info()->status &= ~TS_POLLING; 823 current_thread_info()->status &= ~TS_POLLING;
828 /* 824 /*
@@ -866,10 +862,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
866 if (cx->entry_method != ACPI_CSTATE_FFH) 862 if (cx->entry_method != ACPI_CSTATE_FFH)
867 current_thread_info()->status |= TS_POLLING; 863 current_thread_info()->status |= TS_POLLING;
868 864
869 cx->usage++;
870
871 lapic_timer_state_broadcast(pr, cx, 0); 865 lapic_timer_state_broadcast(pr, cx, 0);
872 cx->time += idle_time;
873 return index; 866 return index;
874} 867}
875 868
@@ -909,12 +902,13 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
909 local_irq_disable(); 902 local_irq_disable();
910 acpi_safe_halt(); 903 acpi_safe_halt();
911 local_irq_enable(); 904 local_irq_enable();
912 return -EINVAL; 905 return -EBUSY;
913 } 906 }
914 } 907 }
915 908
916 local_irq_disable(); 909 local_irq_disable();
917 910
911
918 if (cx->entry_method != ACPI_CSTATE_FFH) { 912 if (cx->entry_method != ACPI_CSTATE_FFH) {
919 current_thread_info()->status &= ~TS_POLLING; 913 current_thread_info()->status &= ~TS_POLLING;
920 /* 914 /*
@@ -986,10 +980,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
986 if (cx->entry_method != ACPI_CSTATE_FFH) 980 if (cx->entry_method != ACPI_CSTATE_FFH)
987 current_thread_info()->status |= TS_POLLING; 981 current_thread_info()->status |= TS_POLLING;
988 982
989 cx->usage++;
990
991 lapic_timer_state_broadcast(pr, cx, 0); 983 lapic_timer_state_broadcast(pr, cx, 0);
992 cx->time += idle_time;
993 return index; 984 return index;
994} 985}
995 986
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index 6e36d0c0057c..c0b9aa5faf4c 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -988,16 +988,18 @@ static void acpi_sbs_rmdirs(void)
988#endif 988#endif
989} 989}
990 990
991static int acpi_sbs_resume(struct acpi_device *device) 991static int acpi_sbs_resume(struct device *dev)
992{ 992{
993 struct acpi_sbs *sbs; 993 struct acpi_sbs *sbs;
994 if (!device) 994 if (!dev)
995 return -EINVAL; 995 return -EINVAL;
996 sbs = device->driver_data; 996 sbs = to_acpi_device(dev)->driver_data;
997 acpi_sbs_callback(sbs); 997 acpi_sbs_callback(sbs);
998 return 0; 998 return 0;
999} 999}
1000 1000
1001static SIMPLE_DEV_PM_OPS(acpi_sbs_pm, NULL, acpi_sbs_resume);
1002
1001static struct acpi_driver acpi_sbs_driver = { 1003static struct acpi_driver acpi_sbs_driver = {
1002 .name = "sbs", 1004 .name = "sbs",
1003 .class = ACPI_SBS_CLASS, 1005 .class = ACPI_SBS_CLASS,
@@ -1005,8 +1007,8 @@ static struct acpi_driver acpi_sbs_driver = {
1005 .ops = { 1007 .ops = {
1006 .add = acpi_sbs_add, 1008 .add = acpi_sbs_add,
1007 .remove = acpi_sbs_remove, 1009 .remove = acpi_sbs_remove,
1008 .resume = acpi_sbs_resume,
1009 }, 1010 },
1011 .drv.pm = &acpi_sbs_pm,
1010}; 1012};
1011 1013
1012static int __init acpi_sbs_init(void) 1014static int __init acpi_sbs_init(void)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c8a1f3b68110..fdda49336560 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -290,26 +290,6 @@ static void acpi_device_release(struct device *dev)
290 kfree(acpi_dev); 290 kfree(acpi_dev);
291} 291}
292 292
293static int acpi_device_suspend(struct device *dev, pm_message_t state)
294{
295 struct acpi_device *acpi_dev = to_acpi_device(dev);
296 struct acpi_driver *acpi_drv = acpi_dev->driver;
297
298 if (acpi_drv && acpi_drv->ops.suspend)
299 return acpi_drv->ops.suspend(acpi_dev, state);
300 return 0;
301}
302
303static int acpi_device_resume(struct device *dev)
304{
305 struct acpi_device *acpi_dev = to_acpi_device(dev);
306 struct acpi_driver *acpi_drv = acpi_dev->driver;
307
308 if (acpi_drv && acpi_drv->ops.resume)
309 return acpi_drv->ops.resume(acpi_dev);
310 return 0;
311}
312
313static int acpi_bus_match(struct device *dev, struct device_driver *drv) 293static int acpi_bus_match(struct device *dev, struct device_driver *drv)
314{ 294{
315 struct acpi_device *acpi_dev = to_acpi_device(dev); 295 struct acpi_device *acpi_dev = to_acpi_device(dev);
@@ -441,8 +421,6 @@ static int acpi_device_remove(struct device * dev)
441 421
442struct bus_type acpi_bus_type = { 422struct bus_type acpi_bus_type = {
443 .name = "acpi", 423 .name = "acpi",
444 .suspend = acpi_device_suspend,
445 .resume = acpi_device_resume,
446 .match = acpi_bus_match, 424 .match = acpi_bus_match,
447 .probe = acpi_device_probe, 425 .probe = acpi_device_probe,
448 .remove = acpi_device_remove, 426 .remove = acpi_device_remove,
diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 1784cb30e7cf..028dd425702c 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -716,8 +716,9 @@ int acpi_suspend(u32 acpi_state)
716 * @dev: device to examine; its driver model wakeup flags control 716 * @dev: device to examine; its driver model wakeup flags control
717 * whether it should be able to wake up the system 717 * whether it should be able to wake up the system
718 * @d_min_p: used to store the upper limit of allowed states range 718 * @d_min_p: used to store the upper limit of allowed states range
719 * Return value: preferred power state of the device on success, -ENODEV on 719 * @d_max_in: specify the lowest allowed states
720 * failure (ie. if there's no 'struct acpi_device' for @dev) 720 * Return value: preferred power state of the device on success, -ENODEV
721 * (ie. if there's no 'struct acpi_device' for @dev) or -EINVAL on failure
721 * 722 *
722 * Find the lowest power (highest number) ACPI device power state that 723 * Find the lowest power (highest number) ACPI device power state that
723 * device @dev can be in while the system is in the sleep state represented 724 * device @dev can be in while the system is in the sleep state represented
@@ -732,13 +733,15 @@ int acpi_suspend(u32 acpi_state)
732 * via @wake. 733 * via @wake.
733 */ 734 */
734 735
735int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p) 736int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in)
736{ 737{
737 acpi_handle handle = DEVICE_ACPI_HANDLE(dev); 738 acpi_handle handle = DEVICE_ACPI_HANDLE(dev);
738 struct acpi_device *adev; 739 struct acpi_device *adev;
739 char acpi_method[] = "_SxD"; 740 char acpi_method[] = "_SxD";
740 unsigned long long d_min, d_max; 741 unsigned long long d_min, d_max;
741 742
743 if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3)
744 return -EINVAL;
742 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { 745 if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) {
743 printk(KERN_DEBUG "ACPI handle has no context!\n"); 746 printk(KERN_DEBUG "ACPI handle has no context!\n");
744 return -ENODEV; 747 return -ENODEV;
@@ -746,8 +749,10 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
746 749
747 acpi_method[2] = '0' + acpi_target_sleep_state; 750 acpi_method[2] = '0' + acpi_target_sleep_state;
748 /* 751 /*
749 * If the sleep state is S0, we will return D3, but if the device has 752 * If the sleep state is S0, the lowest limit from ACPI is D3,
750 * _S0W, we will use the value from _S0W 753 * but if the device has _S0W, we will use the value from _S0W
754 * as the lowest limit from ACPI. Finally, we will constrain
755 * the lowest limit with the specified one.
751 */ 756 */
752 d_min = ACPI_STATE_D0; 757 d_min = ACPI_STATE_D0;
753 d_max = ACPI_STATE_D3; 758 d_max = ACPI_STATE_D3;
@@ -791,8 +796,17 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p)
791 } 796 }
792 } 797 }
793 798
799 if (d_max_in < d_min)
800 return -EINVAL;
794 if (d_min_p) 801 if (d_min_p)
795 *d_min_p = d_min; 802 *d_min_p = d_min;
803 /* constrain d_max with specified lowest limit (max number) */
804 if (d_max > d_max_in) {
805 for (d_max = d_max_in; d_max > d_min; d_max--) {
806 if (adev->power.states[d_max].flags.valid)
807 break;
808 }
809 }
796 return d_max; 810 return d_max;
797} 811}
798EXPORT_SYMBOL(acpi_pm_device_sleep_state); 812EXPORT_SYMBOL(acpi_pm_device_sleep_state);
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 9f66181c814e..240a24400976 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
173{ 173{
174 int result = 0; 174 int result = 0;
175 175
176 if (!strncmp(val, "enable", strlen("enable") - 1)) { 176 if (!strncmp(val, "enable", strlen("enable"))) {
177 result = acpi_debug_trace(trace_method_name, trace_debug_level, 177 result = acpi_debug_trace(trace_method_name, trace_debug_level,
178 trace_debug_layer, 0); 178 trace_debug_layer, 0);
179 if (result) 179 if (result)
@@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp)
181 goto exit; 181 goto exit;
182 } 182 }
183 183
184 if (!strncmp(val, "disable", strlen("disable") - 1)) { 184 if (!strncmp(val, "disable", strlen("disable"))) {
185 int name = 0; 185 int name = 0;
186 result = acpi_debug_trace((char *)&name, trace_debug_level, 186 result = acpi_debug_trace((char *)&name, trace_debug_level,
187 trace_debug_layer, 0); 187 trace_debug_layer, 0);
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 7dbebea1ec31..21dd4c268aef 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -98,7 +98,6 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
98 98
99static int acpi_thermal_add(struct acpi_device *device); 99static int acpi_thermal_add(struct acpi_device *device);
100static int acpi_thermal_remove(struct acpi_device *device, int type); 100static int acpi_thermal_remove(struct acpi_device *device, int type);
101static int acpi_thermal_resume(struct acpi_device *device);
102static void acpi_thermal_notify(struct acpi_device *device, u32 event); 101static void acpi_thermal_notify(struct acpi_device *device, u32 event);
103 102
104static const struct acpi_device_id thermal_device_ids[] = { 103static const struct acpi_device_id thermal_device_ids[] = {
@@ -107,6 +106,9 @@ static const struct acpi_device_id thermal_device_ids[] = {
107}; 106};
108MODULE_DEVICE_TABLE(acpi, thermal_device_ids); 107MODULE_DEVICE_TABLE(acpi, thermal_device_ids);
109 108
109static int acpi_thermal_resume(struct device *dev);
110static SIMPLE_DEV_PM_OPS(acpi_thermal_pm, NULL, acpi_thermal_resume);
111
110static struct acpi_driver acpi_thermal_driver = { 112static struct acpi_driver acpi_thermal_driver = {
111 .name = "thermal", 113 .name = "thermal",
112 .class = ACPI_THERMAL_CLASS, 114 .class = ACPI_THERMAL_CLASS,
@@ -114,9 +116,9 @@ static struct acpi_driver acpi_thermal_driver = {
114 .ops = { 116 .ops = {
115 .add = acpi_thermal_add, 117 .add = acpi_thermal_add,
116 .remove = acpi_thermal_remove, 118 .remove = acpi_thermal_remove,
117 .resume = acpi_thermal_resume,
118 .notify = acpi_thermal_notify, 119 .notify = acpi_thermal_notify,
119 }, 120 },
121 .drv.pm = &acpi_thermal_pm,
120}; 122};
121 123
122struct acpi_thermal_state { 124struct acpi_thermal_state {
@@ -1041,16 +1043,17 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1041 return 0; 1043 return 0;
1042} 1044}
1043 1045
1044static int acpi_thermal_resume(struct acpi_device *device) 1046static int acpi_thermal_resume(struct device *dev)
1045{ 1047{
1046 struct acpi_thermal *tz = NULL; 1048 struct acpi_thermal *tz;
1047 int i, j, power_state, result; 1049 int i, j, power_state, result;
1048 1050
1049 1051 if (!dev)
1050 if (!device || !acpi_driver_data(device))
1051 return -EINVAL; 1052 return -EINVAL;
1052 1053
1053 tz = acpi_driver_data(device); 1054 tz = acpi_driver_data(to_acpi_device(dev));
1055 if (!tz)
1056 return -EINVAL;
1054 1057
1055 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) { 1058 for (i = 0; i < ACPI_THERMAL_MAX_ACTIVE; i++) {
1056 if (!(&tz->trips.active[i])) 1059 if (!(&tz->trips.active[i]))
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index a576575617d7..1e0a9e17c31d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -558,6 +558,8 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
558 union acpi_object arg0 = { ACPI_TYPE_INTEGER }; 558 union acpi_object arg0 = { ACPI_TYPE_INTEGER };
559 struct acpi_object_list args = { 1, &arg0 }; 559 struct acpi_object_list args = { 1, &arg0 };
560 560
561 if (!video->cap._DOS)
562 return 0;
561 563
562 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1) 564 if (bios_flag < 0 || bios_flag > 3 || lcd_flag < 0 || lcd_flag > 1)
563 return -EINVAL; 565 return -EINVAL;