aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/bus.c6
-rw-r--r--drivers/acpi/button.c6
-rw-r--r--drivers/acpi/osl.c2
-rw-r--r--drivers/acpi/processor_idle.c14
-rw-r--r--drivers/acpi/scan.c16
-rw-r--r--drivers/acpi/sleep/main.c39
-rw-r--r--drivers/acpi/thermal.c8
-rw-r--r--drivers/acpi/toshiba_acpi.c2
-rw-r--r--drivers/acpi/video.c4
9 files changed, 53 insertions, 44 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index a54234d3aac1..fb2cff9a2d24 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -194,7 +194,7 @@ int acpi_bus_set_power(acpi_handle handle, int state)
194 194
195 if (!device->flags.power_manageable) { 195 if (!device->flags.power_manageable) {
196 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable\n", 196 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device `[%s]' is not power manageable\n",
197 device->dev.kobj.name)); 197 kobject_name(&device->dev.kobj)));
198 return -ENODEV; 198 return -ENODEV;
199 } 199 }
200 /* 200 /*
@@ -262,10 +262,12 @@ int acpi_bus_set_power(acpi_handle handle, int state)
262 printk(KERN_WARNING PREFIX 262 printk(KERN_WARNING PREFIX
263 "Transitioning device [%s] to D%d\n", 263 "Transitioning device [%s] to D%d\n",
264 device->pnp.bus_id, state); 264 device->pnp.bus_id, state);
265 else 265 else {
266 device->power.state = state;
266 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 267 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
267 "Device [%s] transitioned to D%d\n", 268 "Device [%s] transitioned to D%d\n",
268 device->pnp.bus_id, state)); 269 device->pnp.bus_id, state));
270 }
269 271
270 return result; 272 return result;
271} 273}
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
index 2e79a3395ecf..301e832e6961 100644
--- a/drivers/acpi/button.c
+++ b/drivers/acpi/button.c
@@ -434,18 +434,18 @@ static int acpi_button_add(struct acpi_device *device)
434 switch (button->type) { 434 switch (button->type) {
435 case ACPI_BUTTON_TYPE_POWER: 435 case ACPI_BUTTON_TYPE_POWER:
436 case ACPI_BUTTON_TYPE_POWERF: 436 case ACPI_BUTTON_TYPE_POWERF:
437 input->evbit[0] = BIT(EV_KEY); 437 input->evbit[0] = BIT_MASK(EV_KEY);
438 set_bit(KEY_POWER, input->keybit); 438 set_bit(KEY_POWER, input->keybit);
439 break; 439 break;
440 440
441 case ACPI_BUTTON_TYPE_SLEEP: 441 case ACPI_BUTTON_TYPE_SLEEP:
442 case ACPI_BUTTON_TYPE_SLEEPF: 442 case ACPI_BUTTON_TYPE_SLEEPF:
443 input->evbit[0] = BIT(EV_KEY); 443 input->evbit[0] = BIT_MASK(EV_KEY);
444 set_bit(KEY_SLEEP, input->keybit); 444 set_bit(KEY_SLEEP, input->keybit);
445 break; 445 break;
446 446
447 case ACPI_BUTTON_TYPE_LID: 447 case ACPI_BUTTON_TYPE_LID:
448 input->evbit[0] = BIT(EV_SW); 448 input->evbit[0] = BIT_MASK(EV_SW);
449 set_bit(SW_LID, input->swbit); 449 set_bit(SW_LID, input->swbit);
450 break; 450 break;
451 } 451 }
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 5d14d4f10b12..aabc6ca4a81c 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1206,7 +1206,7 @@ acpi_os_validate_address (
1206} 1206}
1207 1207
1208#ifdef CONFIG_DMI 1208#ifdef CONFIG_DMI
1209static int dmi_osi_linux(struct dmi_system_id *d) 1209static int dmi_osi_linux(const struct dmi_system_id *d)
1210{ 1210{
1211 printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident); 1211 printk(KERN_NOTICE "%s detected: enabling _OSI(Linux)\n", d->ident);
1212 enable_osi_linux(1); 1212 enable_osi_linux(1);
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 0cad56ca342b..f996d0e37689 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -102,7 +102,7 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr);
102 * 102 *
103 * To skip this limit, boot/load with a large max_cstate limit. 103 * To skip this limit, boot/load with a large max_cstate limit.
104 */ 104 */
105static int set_max_cstate(struct dmi_system_id *id) 105static int set_max_cstate(const struct dmi_system_id *id)
106{ 106{
107 if (max_cstate > ACPI_PROCESSOR_MAX_POWER) 107 if (max_cstate > ACPI_PROCESSOR_MAX_POWER)
108 return 0; 108 return 0;
@@ -299,21 +299,12 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
299 299
300static void acpi_propagate_timer_broadcast(struct acpi_processor *pr) 300static void acpi_propagate_timer_broadcast(struct acpi_processor *pr)
301{ 301{
302#ifdef CONFIG_GENERIC_CLOCKEVENTS
303 unsigned long reason; 302 unsigned long reason;
304 303
305 reason = pr->power.timer_broadcast_on_state < INT_MAX ? 304 reason = pr->power.timer_broadcast_on_state < INT_MAX ?
306 CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF; 305 CLOCK_EVT_NOTIFY_BROADCAST_ON : CLOCK_EVT_NOTIFY_BROADCAST_OFF;
307 306
308 clockevents_notify(reason, &pr->id); 307 clockevents_notify(reason, &pr->id);
309#else
310 cpumask_t mask = cpumask_of_cpu(pr->id);
311
312 if (pr->power.timer_broadcast_on_state < INT_MAX)
313 on_each_cpu(switch_APIC_timer_to_ipi, &mask, 1, 1);
314 else
315 on_each_cpu(switch_ipi_to_APIC_timer, &mask, 1, 1);
316#endif
317} 308}
318 309
319/* Power(C) State timer broadcast control */ 310/* Power(C) State timer broadcast control */
@@ -321,8 +312,6 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
321 struct acpi_processor_cx *cx, 312 struct acpi_processor_cx *cx,
322 int broadcast) 313 int broadcast)
323{ 314{
324#ifdef CONFIG_GENERIC_CLOCKEVENTS
325
326 int state = cx - pr->power.states; 315 int state = cx - pr->power.states;
327 316
328 if (state >= pr->power.timer_broadcast_on_state) { 317 if (state >= pr->power.timer_broadcast_on_state) {
@@ -332,7 +321,6 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
332 CLOCK_EVT_NOTIFY_BROADCAST_EXIT; 321 CLOCK_EVT_NOTIFY_BROADCAST_EXIT;
333 clockevents_notify(reason, &pr->id); 322 clockevents_notify(reason, &pr->id);
334 } 323 }
335#endif
336} 324}
337 325
338#else 326#else
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 64620d668742..5b4d462117cf 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -319,16 +319,18 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv)
319 return !acpi_match_device_ids(acpi_dev, acpi_drv->ids); 319 return !acpi_match_device_ids(acpi_dev, acpi_drv->ids);
320} 320}
321 321
322static int acpi_device_uevent(struct device *dev, char **envp, int num_envp, 322static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env)
323 char *buffer, int buffer_size)
324{ 323{
325 struct acpi_device *acpi_dev = to_acpi_device(dev); 324 struct acpi_device *acpi_dev = to_acpi_device(dev);
325 int len;
326 326
327 strcpy(buffer, "MODALIAS="); 327 if (add_uevent_var(env, "MODALIAS="))
328 if (create_modalias(acpi_dev, buffer + 9, buffer_size - 9) > 0) { 328 return -ENOMEM;
329 envp[0] = buffer; 329 len = create_modalias(acpi_dev, &env->buf[env->buflen - 1],
330 envp[1] = NULL; 330 sizeof(env->buf) - env->buflen);
331 } 331 if (len >= (sizeof(env->buf) - env->buflen))
332 return -ENOMEM;
333 env->buflen += len;
332 return 0; 334 return 0;
333} 335}
334 336
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c
index be616317fe53..f3d3867303ec 100644
--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -49,7 +49,7 @@ int acpi_sleep_prepare(u32 acpi_state)
49} 49}
50 50
51#ifdef CONFIG_SUSPEND 51#ifdef CONFIG_SUSPEND
52static struct pm_ops acpi_pm_ops; 52static struct platform_suspend_ops acpi_pm_ops;
53 53
54extern void do_suspend_lowlevel(void); 54extern void do_suspend_lowlevel(void);
55 55
@@ -84,13 +84,12 @@ static int acpi_pm_set_target(suspend_state_t pm_state)
84 84
85/** 85/**
86 * acpi_pm_prepare - Do preliminary suspend work. 86 * acpi_pm_prepare - Do preliminary suspend work.
87 * @pm_state: ignored
88 * 87 *
89 * If necessary, set the firmware waking vector and do arch-specific 88 * If necessary, set the firmware waking vector and do arch-specific
90 * nastiness to get the wakeup code to the waking vector. 89 * nastiness to get the wakeup code to the waking vector.
91 */ 90 */
92 91
93static int acpi_pm_prepare(suspend_state_t pm_state) 92static int acpi_pm_prepare(void)
94{ 93{
95 int error = acpi_sleep_prepare(acpi_target_sleep_state); 94 int error = acpi_sleep_prepare(acpi_target_sleep_state);
96 95
@@ -159,13 +158,12 @@ static int acpi_pm_enter(suspend_state_t pm_state)
159 158
160/** 159/**
161 * acpi_pm_finish - Finish up suspend sequence. 160 * acpi_pm_finish - Finish up suspend sequence.
162 * @pm_state: ignored
163 * 161 *
164 * This is called after we wake back up (or if entering the sleep state 162 * This is called after we wake back up (or if entering the sleep state
165 * failed). 163 * failed).
166 */ 164 */
167 165
168static int acpi_pm_finish(suspend_state_t pm_state) 166static void acpi_pm_finish(void)
169{ 167{
170 u32 acpi_state = acpi_target_sleep_state; 168 u32 acpi_state = acpi_target_sleep_state;
171 169
@@ -183,7 +181,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
183 init_8259A(0); 181 init_8259A(0);
184 } 182 }
185#endif 183#endif
186 return 0;
187} 184}
188 185
189static int acpi_pm_state_valid(suspend_state_t pm_state) 186static int acpi_pm_state_valid(suspend_state_t pm_state)
@@ -202,7 +199,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state)
202 } 199 }
203} 200}
204 201
205static struct pm_ops acpi_pm_ops = { 202static struct platform_suspend_ops acpi_pm_ops = {
206 .valid = acpi_pm_state_valid, 203 .valid = acpi_pm_state_valid,
207 .set_target = acpi_pm_set_target, 204 .set_target = acpi_pm_set_target,
208 .prepare = acpi_pm_prepare, 205 .prepare = acpi_pm_prepare,
@@ -214,7 +211,7 @@ static struct pm_ops acpi_pm_ops = {
214 * Toshiba fails to preserve interrupts over S1, reinitialization 211 * Toshiba fails to preserve interrupts over S1, reinitialization
215 * of 8259 is needed after S1 resume. 212 * of 8259 is needed after S1 resume.
216 */ 213 */
217static int __init init_ints_after_s1(struct dmi_system_id *d) 214static int __init init_ints_after_s1(const struct dmi_system_id *d)
218{ 215{
219 printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); 216 printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
220 init_8259A_after_S1 = 1; 217 init_8259A_after_S1 = 1;
@@ -232,6 +229,12 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
232#endif /* CONFIG_SUSPEND */ 229#endif /* CONFIG_SUSPEND */
233 230
234#ifdef CONFIG_HIBERNATION 231#ifdef CONFIG_HIBERNATION
232static int acpi_hibernation_start(void)
233{
234 acpi_target_sleep_state = ACPI_STATE_S4;
235 return 0;
236}
237
235static int acpi_hibernation_prepare(void) 238static int acpi_hibernation_prepare(void)
236{ 239{
237 return acpi_sleep_prepare(ACPI_STATE_S4); 240 return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -253,6 +256,15 @@ static int acpi_hibernation_enter(void)
253 return ACPI_SUCCESS(status) ? 0 : -EFAULT; 256 return ACPI_SUCCESS(status) ? 0 : -EFAULT;
254} 257}
255 258
259static void acpi_hibernation_leave(void)
260{
261 /*
262 * If ACPI is not enabled by the BIOS and the boot kernel, we need to
263 * enable it here.
264 */
265 acpi_enable();
266}
267
256static void acpi_hibernation_finish(void) 268static void acpi_hibernation_finish(void)
257{ 269{
258 /* 270 /*
@@ -265,6 +277,8 @@ static void acpi_hibernation_finish(void)
265 277
266 /* reset firmware waking vector */ 278 /* reset firmware waking vector */
267 acpi_set_firmware_waking_vector((acpi_physical_address) 0); 279 acpi_set_firmware_waking_vector((acpi_physical_address) 0);
280
281 acpi_target_sleep_state = ACPI_STATE_S0;
268} 282}
269 283
270static int acpi_hibernation_pre_restore(void) 284static int acpi_hibernation_pre_restore(void)
@@ -281,10 +295,13 @@ static void acpi_hibernation_restore_cleanup(void)
281 acpi_hw_enable_all_runtime_gpes(); 295 acpi_hw_enable_all_runtime_gpes();
282} 296}
283 297
284static struct hibernation_ops acpi_hibernation_ops = { 298static struct platform_hibernation_ops acpi_hibernation_ops = {
299 .start = acpi_hibernation_start,
300 .pre_snapshot = acpi_hibernation_prepare,
301 .finish = acpi_hibernation_finish,
285 .prepare = acpi_hibernation_prepare, 302 .prepare = acpi_hibernation_prepare,
286 .enter = acpi_hibernation_enter, 303 .enter = acpi_hibernation_enter,
287 .finish = acpi_hibernation_finish, 304 .leave = acpi_hibernation_leave,
288 .pre_restore = acpi_hibernation_pre_restore, 305 .pre_restore = acpi_hibernation_pre_restore,
289 .restore_cleanup = acpi_hibernation_restore_cleanup, 306 .restore_cleanup = acpi_hibernation_restore_cleanup,
290}; 307};
@@ -421,7 +438,7 @@ int __init acpi_sleep_init(void)
421 } 438 }
422 } 439 }
423 440
424 pm_set_ops(&acpi_pm_ops); 441 suspend_set_ops(&acpi_pm_ops);
425#endif 442#endif
426 443
427#ifdef CONFIG_HIBERNATION 444#ifdef CONFIG_HIBERNATION
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 69ec73b0239d..5f79b4451212 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -1368,7 +1368,7 @@ static int acpi_thermal_resume(struct acpi_device *device)
1368} 1368}
1369 1369
1370#ifdef CONFIG_DMI 1370#ifdef CONFIG_DMI
1371static int thermal_act(struct dmi_system_id *d) { 1371static int thermal_act(const struct dmi_system_id *d) {
1372 1372
1373 if (act == 0) { 1373 if (act == 0) {
1374 printk(KERN_NOTICE "ACPI: %s detected: " 1374 printk(KERN_NOTICE "ACPI: %s detected: "
@@ -1377,14 +1377,14 @@ static int thermal_act(struct dmi_system_id *d) {
1377 } 1377 }
1378 return 0; 1378 return 0;
1379} 1379}
1380static int thermal_nocrt(struct dmi_system_id *d) { 1380static int thermal_nocrt(const struct dmi_system_id *d) {
1381 1381
1382 printk(KERN_NOTICE "ACPI: %s detected: " 1382 printk(KERN_NOTICE "ACPI: %s detected: "
1383 "disabling all critical thermal trip point actions.\n", d->ident); 1383 "disabling all critical thermal trip point actions.\n", d->ident);
1384 nocrt = 1; 1384 nocrt = 1;
1385 return 0; 1385 return 0;
1386} 1386}
1387static int thermal_tzp(struct dmi_system_id *d) { 1387static int thermal_tzp(const struct dmi_system_id *d) {
1388 1388
1389 if (tzp == 0) { 1389 if (tzp == 0) {
1390 printk(KERN_NOTICE "ACPI: %s detected: " 1390 printk(KERN_NOTICE "ACPI: %s detected: "
@@ -1393,7 +1393,7 @@ static int thermal_tzp(struct dmi_system_id *d) {
1393 } 1393 }
1394 return 0; 1394 return 0;
1395} 1395}
1396static int thermal_psv(struct dmi_system_id *d) { 1396static int thermal_psv(const struct dmi_system_id *d) {
1397 1397
1398 if (psv == 0) { 1398 if (psv == 0) {
1399 printk(KERN_NOTICE "ACPI: %s detected: " 1399 printk(KERN_NOTICE "ACPI: %s detected: "
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 13369b45563f..a736ef7bdee4 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -362,7 +362,7 @@ static unsigned long write_video(const char *buffer, unsigned long count)
362 int crt_out = -1; 362 int crt_out = -1;
363 int tv_out = -1; 363 int tv_out = -1;
364 u32 hci_result; 364 u32 hci_result;
365 int video_out; 365 u32 video_out;
366 366
367 /* scan expression. Multiple expressions may be delimited with ; 367 /* scan expression. Multiple expressions may be delimited with ;
368 * 368 *
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index f31e3c8749e0..bac956b30c57 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -316,7 +316,7 @@ static int acpi_video_output_get(struct output_device *od)
316{ 316{
317 unsigned long state; 317 unsigned long state;
318 struct acpi_video_device *vd = 318 struct acpi_video_device *vd =
319 (struct acpi_video_device *)class_get_devdata(&od->class_dev); 319 (struct acpi_video_device *)dev_get_drvdata(&od->dev);
320 acpi_video_device_get_state(vd, &state); 320 acpi_video_device_get_state(vd, &state);
321 return (int)state; 321 return (int)state;
322} 322}
@@ -325,7 +325,7 @@ static int acpi_video_output_set(struct output_device *od)
325{ 325{
326 unsigned long state = od->request_state; 326 unsigned long state = od->request_state;
327 struct acpi_video_device *vd= 327 struct acpi_video_device *vd=
328 (struct acpi_video_device *)class_get_devdata(&od->class_dev); 328 (struct acpi_video_device *)dev_get_drvdata(&od->dev);
329 return acpi_video_device_set_state(vd, state); 329 return acpi_video_device_set_state(vd, state);
330} 330}
331 331