aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/hwvalid.c1
-rw-r--r--drivers/acpi/acpica/nsxfeval.c3
-rw-r--r--drivers/acpi/pci_slot.c5
-rw-r--r--drivers/acpi/proc.c13
-rw-r--r--drivers/acpi/processor_idle.c3
-rw-r--r--drivers/acpi/scan.c31
-rw-r--r--drivers/acpi/sleep.h3
-rw-r--r--drivers/acpi/thermal.c68
-rw-r--r--drivers/acpi/video.c30
-rw-r--r--drivers/acpi/wakeup.c30
10 files changed, 77 insertions, 110 deletions
diff --git a/drivers/acpi/acpica/hwvalid.c b/drivers/acpi/acpica/hwvalid.c
index bd3c937b0ac0..7737afb157c3 100644
--- a/drivers/acpi/acpica/hwvalid.c
+++ b/drivers/acpi/acpica/hwvalid.c
@@ -90,7 +90,6 @@ static const struct acpi_port_info acpi_protected_ports[] = {
90 {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP}, 90 {"PIT2", 0x0048, 0x004B, ACPI_OSI_WIN_XP},
91 {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP}, 91 {"RTC", 0x0070, 0x0071, ACPI_OSI_WIN_XP},
92 {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP}, 92 {"CMOS", 0x0074, 0x0076, ACPI_OSI_WIN_XP},
93 {"DMA1", 0x0081, 0x0083, ACPI_OSI_WIN_XP},
94 {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP}, 93 {"DMA1L", 0x0087, 0x0087, ACPI_OSI_WIN_XP},
95 {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP}, 94 {"DMA2", 0x0089, 0x008B, ACPI_OSI_WIN_XP},
96 {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP}, 95 {"DMA2L", 0x008F, 0x008F, ACPI_OSI_WIN_XP},
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index 045054037c2d..daf4ad37896d 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -53,7 +53,6 @@ ACPI_MODULE_NAME("nsxfeval")
53/* Local prototypes */ 53/* Local prototypes */
54static void acpi_ns_resolve_references(struct acpi_evaluate_info *info); 54static void acpi_ns_resolve_references(struct acpi_evaluate_info *info);
55 55
56#ifdef ACPI_FUTURE_USAGE
57/******************************************************************************* 56/*******************************************************************************
58 * 57 *
59 * FUNCTION: acpi_evaluate_object_typed 58 * FUNCTION: acpi_evaluate_object_typed
@@ -147,7 +146,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
147} 146}
148 147
149ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed) 148ACPI_EXPORT_SYMBOL(acpi_evaluate_object_typed)
150#endif /* ACPI_FUTURE_USAGE */ 149
151/******************************************************************************* 150/*******************************************************************************
152 * 151 *
153 * FUNCTION: acpi_evaluate_object 152 * FUNCTION: acpi_evaluate_object
diff --git a/drivers/acpi/pci_slot.c b/drivers/acpi/pci_slot.c
index cd1f4467be7b..12158e0d009b 100644
--- a/drivers/acpi/pci_slot.c
+++ b/drivers/acpi/pci_slot.c
@@ -164,6 +164,8 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
164 list_add(&slot->list, &slot_list); 164 list_add(&slot->list, &slot_list);
165 mutex_unlock(&slot_list_lock); 165 mutex_unlock(&slot_list_lock);
166 166
167 get_device(&pci_bus->dev);
168
167 dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n", 169 dbg("pci_slot: %p, pci_bus: %x, device: %d, name: %s\n",
168 pci_slot, pci_bus->number, device, name); 170 pci_slot, pci_bus->number, device, name);
169 171
@@ -310,12 +312,15 @@ static void
310acpi_pci_slot_remove(acpi_handle handle) 312acpi_pci_slot_remove(acpi_handle handle)
311{ 313{
312 struct acpi_pci_slot *slot, *tmp; 314 struct acpi_pci_slot *slot, *tmp;
315 struct pci_bus *pbus;
313 316
314 mutex_lock(&slot_list_lock); 317 mutex_lock(&slot_list_lock);
315 list_for_each_entry_safe(slot, tmp, &slot_list, list) { 318 list_for_each_entry_safe(slot, tmp, &slot_list, list) {
316 if (slot->root_handle == handle) { 319 if (slot->root_handle == handle) {
317 list_del(&slot->list); 320 list_del(&slot->list);
321 pbus = slot->pci_slot->bus;
318 pci_destroy_slot(slot->pci_slot); 322 pci_destroy_slot(slot->pci_slot);
323 put_device(&pbus->dev);
319 kfree(slot); 324 kfree(slot);
320 } 325 }
321 } 326 }
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
index 05dfdc96802e..d0d550d22a6d 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
@@ -343,9 +343,6 @@ acpi_system_write_alarm(struct file *file,
343} 343}
344#endif /* HAVE_ACPI_LEGACY_ALARM */ 344#endif /* HAVE_ACPI_LEGACY_ALARM */
345 345
346extern struct list_head acpi_wakeup_device_list;
347extern spinlock_t acpi_device_lock;
348
349static int 346static int
350acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset) 347acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
351{ 348{
@@ -353,7 +350,7 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
353 350
354 seq_printf(seq, "Device\tS-state\t Status Sysfs node\n"); 351 seq_printf(seq, "Device\tS-state\t Status Sysfs node\n");
355 352
356 spin_lock(&acpi_device_lock); 353 mutex_lock(&acpi_device_lock);
357 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 354 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
358 struct acpi_device *dev = 355 struct acpi_device *dev =
359 container_of(node, struct acpi_device, wakeup_list); 356 container_of(node, struct acpi_device, wakeup_list);
@@ -361,7 +358,6 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
361 358
362 if (!dev->wakeup.flags.valid) 359 if (!dev->wakeup.flags.valid)
363 continue; 360 continue;
364 spin_unlock(&acpi_device_lock);
365 361
366 ldev = acpi_get_physical_device(dev->handle); 362 ldev = acpi_get_physical_device(dev->handle);
367 seq_printf(seq, "%s\t S%d\t%c%-8s ", 363 seq_printf(seq, "%s\t S%d\t%c%-8s ",
@@ -376,9 +372,8 @@ acpi_system_wakeup_device_seq_show(struct seq_file *seq, void *offset)
376 seq_printf(seq, "\n"); 372 seq_printf(seq, "\n");
377 put_device(ldev); 373 put_device(ldev);
378 374
379 spin_lock(&acpi_device_lock);
380 } 375 }
381 spin_unlock(&acpi_device_lock); 376 mutex_unlock(&acpi_device_lock);
382 return 0; 377 return 0;
383} 378}
384 379
@@ -409,7 +404,7 @@ acpi_system_write_wakeup_device(struct file *file,
409 strbuf[len] = '\0'; 404 strbuf[len] = '\0';
410 sscanf(strbuf, "%s", str); 405 sscanf(strbuf, "%s", str);
411 406
412 spin_lock(&acpi_device_lock); 407 mutex_lock(&acpi_device_lock);
413 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 408 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
414 struct acpi_device *dev = 409 struct acpi_device *dev =
415 container_of(node, struct acpi_device, wakeup_list); 410 container_of(node, struct acpi_device, wakeup_list);
@@ -446,7 +441,7 @@ acpi_system_write_wakeup_device(struct file *file,
446 } 441 }
447 } 442 }
448 } 443 }
449 spin_unlock(&acpi_device_lock); 444 mutex_unlock(&acpi_device_lock);
450 return count; 445 return count;
451} 446}
452 447
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 4e6e758bd397..6fe121434ffb 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -145,6 +145,9 @@ static void acpi_timer_check_state(int state, struct acpi_processor *pr,
145 struct acpi_processor_power *pwr = &pr->power; 145 struct acpi_processor_power *pwr = &pr->power;
146 u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2; 146 u8 type = local_apic_timer_c2_ok ? ACPI_STATE_C3 : ACPI_STATE_C2;
147 147
148 if (cpu_has(&cpu_data(pr->id), X86_FEATURE_ARAT))
149 return;
150
148 /* 151 /*
149 * Check, if one of the previous states already marked the lapic 152 * Check, if one of the previous states already marked the lapic
150 * unstable 153 * unstable
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 20c23c049207..8ff510b91d88 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -24,7 +24,7 @@ extern struct acpi_device *acpi_root;
24 24
25static LIST_HEAD(acpi_device_list); 25static LIST_HEAD(acpi_device_list);
26static LIST_HEAD(acpi_bus_id_list); 26static LIST_HEAD(acpi_bus_id_list);
27DEFINE_SPINLOCK(acpi_device_lock); 27DEFINE_MUTEX(acpi_device_lock);
28LIST_HEAD(acpi_wakeup_device_list); 28LIST_HEAD(acpi_wakeup_device_list);
29 29
30struct acpi_device_bus_id{ 30struct acpi_device_bus_id{
@@ -491,7 +491,6 @@ static int acpi_device_register(struct acpi_device *device,
491 */ 491 */
492 INIT_LIST_HEAD(&device->children); 492 INIT_LIST_HEAD(&device->children);
493 INIT_LIST_HEAD(&device->node); 493 INIT_LIST_HEAD(&device->node);
494 INIT_LIST_HEAD(&device->g_list);
495 INIT_LIST_HEAD(&device->wakeup_list); 494 INIT_LIST_HEAD(&device->wakeup_list);
496 495
497 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL); 496 new_bus_id = kzalloc(sizeof(struct acpi_device_bus_id), GFP_KERNEL);
@@ -500,7 +499,7 @@ static int acpi_device_register(struct acpi_device *device,
500 return -ENOMEM; 499 return -ENOMEM;
501 } 500 }
502 501
503 spin_lock(&acpi_device_lock); 502 mutex_lock(&acpi_device_lock);
504 /* 503 /*
505 * Find suitable bus_id and instance number in acpi_bus_id_list 504 * Find suitable bus_id and instance number in acpi_bus_id_list
506 * If failed, create one and link it into acpi_bus_id_list 505 * If failed, create one and link it into acpi_bus_id_list
@@ -521,14 +520,12 @@ static int acpi_device_register(struct acpi_device *device,
521 } 520 }
522 dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no); 521 dev_set_name(&device->dev, "%s:%02x", acpi_device_bus_id->bus_id, acpi_device_bus_id->instance_no);
523 522
524 if (device->parent) { 523 if (device->parent)
525 list_add_tail(&device->node, &device->parent->children); 524 list_add_tail(&device->node, &device->parent->children);
526 list_add_tail(&device->g_list, &device->parent->g_list); 525
527 } else
528 list_add_tail(&device->g_list, &acpi_device_list);
529 if (device->wakeup.flags.valid) 526 if (device->wakeup.flags.valid)
530 list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); 527 list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);
531 spin_unlock(&acpi_device_lock); 528 mutex_unlock(&acpi_device_lock);
532 529
533 if (device->parent) 530 if (device->parent)
534 device->dev.parent = &parent->dev; 531 device->dev.parent = &parent->dev;
@@ -549,28 +546,22 @@ static int acpi_device_register(struct acpi_device *device,
549 device->removal_type = ACPI_BUS_REMOVAL_NORMAL; 546 device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
550 return 0; 547 return 0;
551 end: 548 end:
552 spin_lock(&acpi_device_lock); 549 mutex_lock(&acpi_device_lock);
553 if (device->parent) { 550 if (device->parent)
554 list_del(&device->node); 551 list_del(&device->node);
555 list_del(&device->g_list);
556 } else
557 list_del(&device->g_list);
558 list_del(&device->wakeup_list); 552 list_del(&device->wakeup_list);
559 spin_unlock(&acpi_device_lock); 553 mutex_unlock(&acpi_device_lock);
560 return result; 554 return result;
561} 555}
562 556
563static void acpi_device_unregister(struct acpi_device *device, int type) 557static void acpi_device_unregister(struct acpi_device *device, int type)
564{ 558{
565 spin_lock(&acpi_device_lock); 559 mutex_lock(&acpi_device_lock);
566 if (device->parent) { 560 if (device->parent)
567 list_del(&device->node); 561 list_del(&device->node);
568 list_del(&device->g_list);
569 } else
570 list_del(&device->g_list);
571 562
572 list_del(&device->wakeup_list); 563 list_del(&device->wakeup_list);
573 spin_unlock(&acpi_device_lock); 564 mutex_unlock(&acpi_device_lock);
574 565
575 acpi_detach_data(device->handle, acpi_bus_data_handler); 566 acpi_detach_data(device->handle, acpi_bus_data_handler);
576 567
diff --git a/drivers/acpi/sleep.h b/drivers/acpi/sleep.h
index cfaf8f5b0a14..8a8f3b3382a6 100644
--- a/drivers/acpi/sleep.h
+++ b/drivers/acpi/sleep.h
@@ -5,3 +5,6 @@ extern int acpi_suspend (u32 state);
5extern void acpi_enable_wakeup_device_prep(u8 sleep_state); 5extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
6extern void acpi_enable_wakeup_device(u8 sleep_state); 6extern void acpi_enable_wakeup_device(u8 sleep_state);
7extern void acpi_disable_wakeup_device(u8 sleep_state); 7extern void acpi_disable_wakeup_device(u8 sleep_state);
8
9extern struct list_head acpi_wakeup_device_list;
10extern struct mutex acpi_device_lock;
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index e8c143caf0fd..9cd15e8c8932 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -98,6 +98,7 @@ MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
98static int acpi_thermal_add(struct acpi_device *device); 98static int acpi_thermal_add(struct acpi_device *device);
99static int acpi_thermal_remove(struct acpi_device *device, int type); 99static int acpi_thermal_remove(struct acpi_device *device, int type);
100static int acpi_thermal_resume(struct acpi_device *device); 100static int acpi_thermal_resume(struct acpi_device *device);
101static void acpi_thermal_notify(struct acpi_device *device, u32 event);
101static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file); 102static int acpi_thermal_state_open_fs(struct inode *inode, struct file *file);
102static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file); 103static int acpi_thermal_temp_open_fs(struct inode *inode, struct file *file);
103static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file); 104static int acpi_thermal_trip_open_fs(struct inode *inode, struct file *file);
@@ -123,6 +124,7 @@ static struct acpi_driver acpi_thermal_driver = {
123 .add = acpi_thermal_add, 124 .add = acpi_thermal_add,
124 .remove = acpi_thermal_remove, 125 .remove = acpi_thermal_remove,
125 .resume = acpi_thermal_resume, 126 .resume = acpi_thermal_resume,
127 .notify = acpi_thermal_notify,
126 }, 128 },
127}; 129};
128 130
@@ -192,6 +194,7 @@ struct acpi_thermal {
192 struct acpi_handle_list devices; 194 struct acpi_handle_list devices;
193 struct thermal_zone_device *thermal_zone; 195 struct thermal_zone_device *thermal_zone;
194 int tz_enabled; 196 int tz_enabled;
197 int kelvin_offset;
195 struct mutex lock; 198 struct mutex lock;
196}; 199};
197 200
@@ -581,7 +584,7 @@ static void acpi_thermal_check(void *data)
581} 584}
582 585
583/* sys I/F for generic thermal sysfs support */ 586/* sys I/F for generic thermal sysfs support */
584#define KELVIN_TO_MILLICELSIUS(t) (t * 100 - 273200) 587#define KELVIN_TO_MILLICELSIUS(t, off) (((t) - (off)) * 100)
585 588
586static int thermal_get_temp(struct thermal_zone_device *thermal, 589static int thermal_get_temp(struct thermal_zone_device *thermal,
587 unsigned long *temp) 590 unsigned long *temp)
@@ -596,7 +599,7 @@ static int thermal_get_temp(struct thermal_zone_device *thermal,
596 if (result) 599 if (result)
597 return result; 600 return result;
598 601
599 *temp = KELVIN_TO_MILLICELSIUS(tz->temperature); 602 *temp = KELVIN_TO_MILLICELSIUS(tz->temperature, tz->kelvin_offset);
600 return 0; 603 return 0;
601} 604}
602 605
@@ -702,7 +705,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
702 if (tz->trips.critical.flags.valid) { 705 if (tz->trips.critical.flags.valid) {
703 if (!trip) { 706 if (!trip) {
704 *temp = KELVIN_TO_MILLICELSIUS( 707 *temp = KELVIN_TO_MILLICELSIUS(
705 tz->trips.critical.temperature); 708 tz->trips.critical.temperature,
709 tz->kelvin_offset);
706 return 0; 710 return 0;
707 } 711 }
708 trip--; 712 trip--;
@@ -711,7 +715,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
711 if (tz->trips.hot.flags.valid) { 715 if (tz->trips.hot.flags.valid) {
712 if (!trip) { 716 if (!trip) {
713 *temp = KELVIN_TO_MILLICELSIUS( 717 *temp = KELVIN_TO_MILLICELSIUS(
714 tz->trips.hot.temperature); 718 tz->trips.hot.temperature,
719 tz->kelvin_offset);
715 return 0; 720 return 0;
716 } 721 }
717 trip--; 722 trip--;
@@ -720,7 +725,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
720 if (tz->trips.passive.flags.valid) { 725 if (tz->trips.passive.flags.valid) {
721 if (!trip) { 726 if (!trip) {
722 *temp = KELVIN_TO_MILLICELSIUS( 727 *temp = KELVIN_TO_MILLICELSIUS(
723 tz->trips.passive.temperature); 728 tz->trips.passive.temperature,
729 tz->kelvin_offset);
724 return 0; 730 return 0;
725 } 731 }
726 trip--; 732 trip--;
@@ -730,7 +736,8 @@ static int thermal_get_trip_temp(struct thermal_zone_device *thermal,
730 tz->trips.active[i].flags.valid; i++) { 736 tz->trips.active[i].flags.valid; i++) {
731 if (!trip) { 737 if (!trip) {
732 *temp = KELVIN_TO_MILLICELSIUS( 738 *temp = KELVIN_TO_MILLICELSIUS(
733 tz->trips.active[i].temperature); 739 tz->trips.active[i].temperature,
740 tz->kelvin_offset);
734 return 0; 741 return 0;
735 } 742 }
736 trip--; 743 trip--;
@@ -745,7 +752,8 @@ static int thermal_get_crit_temp(struct thermal_zone_device *thermal,
745 752
746 if (tz->trips.critical.flags.valid) { 753 if (tz->trips.critical.flags.valid) {
747 *temperature = KELVIN_TO_MILLICELSIUS( 754 *temperature = KELVIN_TO_MILLICELSIUS(
748 tz->trips.critical.temperature); 755 tz->trips.critical.temperature,
756 tz->kelvin_offset);
749 return 0; 757 return 0;
750 } else 758 } else
751 return -EINVAL; 759 return -EINVAL;
@@ -1264,17 +1272,14 @@ static int acpi_thermal_remove_fs(struct acpi_device *device)
1264 Driver Interface 1272 Driver Interface
1265 -------------------------------------------------------------------------- */ 1273 -------------------------------------------------------------------------- */
1266 1274
1267static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data) 1275static void acpi_thermal_notify(struct acpi_device *device, u32 event)
1268{ 1276{
1269 struct acpi_thermal *tz = data; 1277 struct acpi_thermal *tz = acpi_driver_data(device);
1270 struct acpi_device *device = NULL;
1271 1278
1272 1279
1273 if (!tz) 1280 if (!tz)
1274 return; 1281 return;
1275 1282
1276 device = tz->device;
1277
1278 switch (event) { 1283 switch (event) {
1279 case ACPI_THERMAL_NOTIFY_TEMPERATURE: 1284 case ACPI_THERMAL_NOTIFY_TEMPERATURE:
1280 acpi_thermal_check(tz); 1285 acpi_thermal_check(tz);
@@ -1298,8 +1303,6 @@ static void acpi_thermal_notify(acpi_handle handle, u32 event, void *data)
1298 "Unsupported event [0x%x]\n", event)); 1303 "Unsupported event [0x%x]\n", event));
1299 break; 1304 break;
1300 } 1305 }
1301
1302 return;
1303} 1306}
1304 1307
1305static int acpi_thermal_get_info(struct acpi_thermal *tz) 1308static int acpi_thermal_get_info(struct acpi_thermal *tz)
@@ -1334,10 +1337,28 @@ static int acpi_thermal_get_info(struct acpi_thermal *tz)
1334 return 0; 1337 return 0;
1335} 1338}
1336 1339
1340/*
1341 * The exact offset between Kelvin and degree Celsius is 273.15. However ACPI
1342 * handles temperature values with a single decimal place. As a consequence,
1343 * some implementations use an offset of 273.1 and others use an offset of
1344 * 273.2. Try to find out which one is being used, to present the most
1345 * accurate and visually appealing number.
1346 *
1347 * The heuristic below should work for all ACPI thermal zones which have a
1348 * critical trip point with a value being a multiple of 0.5 degree Celsius.
1349 */
1350static void acpi_thermal_guess_offset(struct acpi_thermal *tz)
1351{
1352 if (tz->trips.critical.flags.valid &&
1353 (tz->trips.critical.temperature % 5) == 1)
1354 tz->kelvin_offset = 2731;
1355 else
1356 tz->kelvin_offset = 2732;
1357}
1358
1337static int acpi_thermal_add(struct acpi_device *device) 1359static int acpi_thermal_add(struct acpi_device *device)
1338{ 1360{
1339 int result = 0; 1361 int result = 0;
1340 acpi_status status = AE_OK;
1341 struct acpi_thermal *tz = NULL; 1362 struct acpi_thermal *tz = NULL;
1342 1363
1343 1364
@@ -1360,6 +1381,8 @@ static int acpi_thermal_add(struct acpi_device *device)
1360 if (result) 1381 if (result)
1361 goto free_memory; 1382 goto free_memory;
1362 1383
1384 acpi_thermal_guess_offset(tz);
1385
1363 result = acpi_thermal_register_thermal_zone(tz); 1386 result = acpi_thermal_register_thermal_zone(tz);
1364 if (result) 1387 if (result)
1365 goto free_memory; 1388 goto free_memory;
@@ -1368,21 +1391,11 @@ static int acpi_thermal_add(struct acpi_device *device)
1368 if (result) 1391 if (result)
1369 goto unregister_thermal_zone; 1392 goto unregister_thermal_zone;
1370 1393
1371 status = acpi_install_notify_handler(device->handle,
1372 ACPI_DEVICE_NOTIFY,
1373 acpi_thermal_notify, tz);
1374 if (ACPI_FAILURE(status)) {
1375 result = -ENODEV;
1376 goto remove_fs;
1377 }
1378
1379 printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n", 1394 printk(KERN_INFO PREFIX "%s [%s] (%ld C)\n",
1380 acpi_device_name(device), acpi_device_bid(device), 1395 acpi_device_name(device), acpi_device_bid(device),
1381 KELVIN_TO_CELSIUS(tz->temperature)); 1396 KELVIN_TO_CELSIUS(tz->temperature));
1382 goto end; 1397 goto end;
1383 1398
1384remove_fs:
1385 acpi_thermal_remove_fs(device);
1386unregister_thermal_zone: 1399unregister_thermal_zone:
1387 thermal_zone_device_unregister(tz->thermal_zone); 1400 thermal_zone_device_unregister(tz->thermal_zone);
1388free_memory: 1401free_memory:
@@ -1393,7 +1406,6 @@ end:
1393 1406
1394static int acpi_thermal_remove(struct acpi_device *device, int type) 1407static int acpi_thermal_remove(struct acpi_device *device, int type)
1395{ 1408{
1396 acpi_status status = AE_OK;
1397 struct acpi_thermal *tz = NULL; 1409 struct acpi_thermal *tz = NULL;
1398 1410
1399 if (!device || !acpi_driver_data(device)) 1411 if (!device || !acpi_driver_data(device))
@@ -1401,10 +1413,6 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
1401 1413
1402 tz = acpi_driver_data(device); 1414 tz = acpi_driver_data(device);
1403 1415
1404 status = acpi_remove_notify_handler(device->handle,
1405 ACPI_DEVICE_NOTIFY,
1406 acpi_thermal_notify);
1407
1408 acpi_thermal_remove_fs(device); 1416 acpi_thermal_remove_fs(device);
1409 acpi_thermal_unregister_thermal_zone(tz); 1417 acpi_thermal_unregister_thermal_zone(tz);
1410 mutex_destroy(&tz->lock); 1418 mutex_destroy(&tz->lock);
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index ab06143672bc..cd4fb7543a90 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -79,6 +79,7 @@ module_param(brightness_switch_enabled, bool, 0644);
79static int acpi_video_bus_add(struct acpi_device *device); 79static int acpi_video_bus_add(struct acpi_device *device);
80static int acpi_video_bus_remove(struct acpi_device *device, int type); 80static int acpi_video_bus_remove(struct acpi_device *device, int type);
81static int acpi_video_resume(struct acpi_device *device); 81static int acpi_video_resume(struct acpi_device *device);
82static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
82 83
83static const struct acpi_device_id video_device_ids[] = { 84static const struct acpi_device_id video_device_ids[] = {
84 {ACPI_VIDEO_HID, 0}, 85 {ACPI_VIDEO_HID, 0},
@@ -94,6 +95,7 @@ static struct acpi_driver acpi_video_bus = {
94 .add = acpi_video_bus_add, 95 .add = acpi_video_bus_add,
95 .remove = acpi_video_bus_remove, 96 .remove = acpi_video_bus_remove,
96 .resume = acpi_video_resume, 97 .resume = acpi_video_resume,
98 .notify = acpi_video_bus_notify,
97 }, 99 },
98}; 100};
99 101
@@ -1986,17 +1988,15 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
1986 return acpi_video_bus_DOS(video, 0, 1); 1988 return acpi_video_bus_DOS(video, 0, 1);
1987} 1989}
1988 1990
1989static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) 1991static void acpi_video_bus_notify(struct acpi_device *device, u32 event)
1990{ 1992{
1991 struct acpi_video_bus *video = data; 1993 struct acpi_video_bus *video = acpi_driver_data(device);
1992 struct acpi_device *device = NULL;
1993 struct input_dev *input; 1994 struct input_dev *input;
1994 int keycode; 1995 int keycode;
1995 1996
1996 if (!video) 1997 if (!video)
1997 return; 1998 return;
1998 1999
1999 device = video->device;
2000 input = video->input; 2000 input = video->input;
2001 2001
2002 switch (event) { 2002 switch (event) {
@@ -2127,7 +2127,6 @@ static int acpi_video_resume(struct acpi_device *device)
2127 2127
2128static int acpi_video_bus_add(struct acpi_device *device) 2128static int acpi_video_bus_add(struct acpi_device *device)
2129{ 2129{
2130 acpi_status status;
2131 struct acpi_video_bus *video; 2130 struct acpi_video_bus *video;
2132 struct input_dev *input; 2131 struct input_dev *input;
2133 int error; 2132 int error;
@@ -2169,20 +2168,10 @@ static int acpi_video_bus_add(struct acpi_device *device)
2169 acpi_video_bus_get_devices(video, device); 2168 acpi_video_bus_get_devices(video, device);
2170 acpi_video_bus_start_devices(video); 2169 acpi_video_bus_start_devices(video);
2171 2170
2172 status = acpi_install_notify_handler(device->handle,
2173 ACPI_DEVICE_NOTIFY,
2174 acpi_video_bus_notify, video);
2175 if (ACPI_FAILURE(status)) {
2176 printk(KERN_ERR PREFIX
2177 "Error installing notify handler\n");
2178 error = -ENODEV;
2179 goto err_stop_video;
2180 }
2181
2182 video->input = input = input_allocate_device(); 2171 video->input = input = input_allocate_device();
2183 if (!input) { 2172 if (!input) {
2184 error = -ENOMEM; 2173 error = -ENOMEM;
2185 goto err_uninstall_notify; 2174 goto err_stop_video;
2186 } 2175 }
2187 2176
2188 snprintf(video->phys, sizeof(video->phys), 2177 snprintf(video->phys, sizeof(video->phys),
@@ -2218,9 +2207,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
2218 2207
2219 err_free_input_dev: 2208 err_free_input_dev:
2220 input_free_device(input); 2209 input_free_device(input);
2221 err_uninstall_notify:
2222 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
2223 acpi_video_bus_notify);
2224 err_stop_video: 2210 err_stop_video:
2225 acpi_video_bus_stop_devices(video); 2211 acpi_video_bus_stop_devices(video);
2226 acpi_video_bus_put_devices(video); 2212 acpi_video_bus_put_devices(video);
@@ -2235,7 +2221,6 @@ static int acpi_video_bus_add(struct acpi_device *device)
2235 2221
2236static int acpi_video_bus_remove(struct acpi_device *device, int type) 2222static int acpi_video_bus_remove(struct acpi_device *device, int type)
2237{ 2223{
2238 acpi_status status = 0;
2239 struct acpi_video_bus *video = NULL; 2224 struct acpi_video_bus *video = NULL;
2240 2225
2241 2226
@@ -2245,11 +2230,6 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
2245 video = acpi_driver_data(device); 2230 video = acpi_driver_data(device);
2246 2231
2247 acpi_video_bus_stop_devices(video); 2232 acpi_video_bus_stop_devices(video);
2248
2249 status = acpi_remove_notify_handler(video->device->handle,
2250 ACPI_DEVICE_NOTIFY,
2251 acpi_video_bus_notify);
2252
2253 acpi_video_bus_put_devices(video); 2233 acpi_video_bus_put_devices(video);
2254 acpi_video_bus_remove_fs(device); 2234 acpi_video_bus_remove_fs(device);
2255 2235
diff --git a/drivers/acpi/wakeup.c b/drivers/acpi/wakeup.c
index 5aee8c26cc9f..88725dcdf8bc 100644
--- a/drivers/acpi/wakeup.c
+++ b/drivers/acpi/wakeup.c
@@ -12,12 +12,14 @@
12#include "internal.h" 12#include "internal.h"
13#include "sleep.h" 13#include "sleep.h"
14 14
15/*
16 * We didn't lock acpi_device_lock in the file, because it invokes oops in
17 * suspend/resume and isn't really required as this is called in S-state. At
18 * that time, there is no device hotplug
19 **/
15#define _COMPONENT ACPI_SYSTEM_COMPONENT 20#define _COMPONENT ACPI_SYSTEM_COMPONENT
16ACPI_MODULE_NAME("wakeup_devices") 21ACPI_MODULE_NAME("wakeup_devices")
17 22
18extern struct list_head acpi_wakeup_device_list;
19extern spinlock_t acpi_device_lock;
20
21/** 23/**
22 * acpi_enable_wakeup_device_prep - prepare wakeup devices 24 * acpi_enable_wakeup_device_prep - prepare wakeup devices
23 * @sleep_state: ACPI state 25 * @sleep_state: ACPI state
@@ -29,7 +31,6 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state)
29{ 31{
30 struct list_head *node, *next; 32 struct list_head *node, *next;
31 33
32 spin_lock(&acpi_device_lock);
33 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 34 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
34 struct acpi_device *dev = container_of(node, 35 struct acpi_device *dev = container_of(node,
35 struct acpi_device, 36 struct acpi_device,
@@ -40,11 +41,8 @@ void acpi_enable_wakeup_device_prep(u8 sleep_state)
40 (sleep_state > (u32) dev->wakeup.sleep_state)) 41 (sleep_state > (u32) dev->wakeup.sleep_state))
41 continue; 42 continue;
42 43
43 spin_unlock(&acpi_device_lock);
44 acpi_enable_wakeup_device_power(dev, sleep_state); 44 acpi_enable_wakeup_device_power(dev, sleep_state);
45 spin_lock(&acpi_device_lock);
46 } 45 }
47 spin_unlock(&acpi_device_lock);
48} 46}
49 47
50/** 48/**
@@ -60,7 +58,6 @@ void acpi_enable_wakeup_device(u8 sleep_state)
60 * Caution: this routine must be invoked when interrupt is disabled 58 * Caution: this routine must be invoked when interrupt is disabled
61 * Refer ACPI2.0: P212 59 * Refer ACPI2.0: P212
62 */ 60 */
63 spin_lock(&acpi_device_lock);
64 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 61 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
65 struct acpi_device *dev = 62 struct acpi_device *dev =
66 container_of(node, struct acpi_device, wakeup_list); 63 container_of(node, struct acpi_device, wakeup_list);
@@ -74,22 +71,17 @@ void acpi_enable_wakeup_device(u8 sleep_state)
74 if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) 71 if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared)
75 || sleep_state > (u32) dev->wakeup.sleep_state) { 72 || sleep_state > (u32) dev->wakeup.sleep_state) {
76 if (dev->wakeup.flags.run_wake) { 73 if (dev->wakeup.flags.run_wake) {
77 spin_unlock(&acpi_device_lock);
78 /* set_gpe_type will disable GPE, leave it like that */ 74 /* set_gpe_type will disable GPE, leave it like that */
79 acpi_set_gpe_type(dev->wakeup.gpe_device, 75 acpi_set_gpe_type(dev->wakeup.gpe_device,
80 dev->wakeup.gpe_number, 76 dev->wakeup.gpe_number,
81 ACPI_GPE_TYPE_RUNTIME); 77 ACPI_GPE_TYPE_RUNTIME);
82 spin_lock(&acpi_device_lock);
83 } 78 }
84 continue; 79 continue;
85 } 80 }
86 spin_unlock(&acpi_device_lock);
87 if (!dev->wakeup.flags.run_wake) 81 if (!dev->wakeup.flags.run_wake)
88 acpi_enable_gpe(dev->wakeup.gpe_device, 82 acpi_enable_gpe(dev->wakeup.gpe_device,
89 dev->wakeup.gpe_number); 83 dev->wakeup.gpe_number);
90 spin_lock(&acpi_device_lock);
91 } 84 }
92 spin_unlock(&acpi_device_lock);
93} 85}
94 86
95/** 87/**
@@ -101,7 +93,6 @@ void acpi_disable_wakeup_device(u8 sleep_state)
101{ 93{
102 struct list_head *node, *next; 94 struct list_head *node, *next;
103 95
104 spin_lock(&acpi_device_lock);
105 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 96 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
106 struct acpi_device *dev = 97 struct acpi_device *dev =
107 container_of(node, struct acpi_device, wakeup_list); 98 container_of(node, struct acpi_device, wakeup_list);
@@ -112,19 +103,16 @@ void acpi_disable_wakeup_device(u8 sleep_state)
112 if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared) 103 if ((!dev->wakeup.state.enabled && !dev->wakeup.flags.prepared)
113 || sleep_state > (u32) dev->wakeup.sleep_state) { 104 || sleep_state > (u32) dev->wakeup.sleep_state) {
114 if (dev->wakeup.flags.run_wake) { 105 if (dev->wakeup.flags.run_wake) {
115 spin_unlock(&acpi_device_lock);
116 acpi_set_gpe_type(dev->wakeup.gpe_device, 106 acpi_set_gpe_type(dev->wakeup.gpe_device,
117 dev->wakeup.gpe_number, 107 dev->wakeup.gpe_number,
118 ACPI_GPE_TYPE_WAKE_RUN); 108 ACPI_GPE_TYPE_WAKE_RUN);
119 /* Re-enable it, since set_gpe_type will disable it */ 109 /* Re-enable it, since set_gpe_type will disable it */
120 acpi_enable_gpe(dev->wakeup.gpe_device, 110 acpi_enable_gpe(dev->wakeup.gpe_device,
121 dev->wakeup.gpe_number); 111 dev->wakeup.gpe_number);
122 spin_lock(&acpi_device_lock);
123 } 112 }
124 continue; 113 continue;
125 } 114 }
126 115
127 spin_unlock(&acpi_device_lock);
128 acpi_disable_wakeup_device_power(dev); 116 acpi_disable_wakeup_device_power(dev);
129 /* Never disable run-wake GPE */ 117 /* Never disable run-wake GPE */
130 if (!dev->wakeup.flags.run_wake) { 118 if (!dev->wakeup.flags.run_wake) {
@@ -133,16 +121,14 @@ void acpi_disable_wakeup_device(u8 sleep_state)
133 acpi_clear_gpe(dev->wakeup.gpe_device, 121 acpi_clear_gpe(dev->wakeup.gpe_device,
134 dev->wakeup.gpe_number, ACPI_NOT_ISR); 122 dev->wakeup.gpe_number, ACPI_NOT_ISR);
135 } 123 }
136 spin_lock(&acpi_device_lock);
137 } 124 }
138 spin_unlock(&acpi_device_lock);
139} 125}
140 126
141int __init acpi_wakeup_device_init(void) 127int __init acpi_wakeup_device_init(void)
142{ 128{
143 struct list_head *node, *next; 129 struct list_head *node, *next;
144 130
145 spin_lock(&acpi_device_lock); 131 mutex_lock(&acpi_device_lock);
146 list_for_each_safe(node, next, &acpi_wakeup_device_list) { 132 list_for_each_safe(node, next, &acpi_wakeup_device_list) {
147 struct acpi_device *dev = container_of(node, 133 struct acpi_device *dev = container_of(node,
148 struct acpi_device, 134 struct acpi_device,
@@ -150,15 +136,13 @@ int __init acpi_wakeup_device_init(void)
150 /* In case user doesn't load button driver */ 136 /* In case user doesn't load button driver */
151 if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled) 137 if (!dev->wakeup.flags.run_wake || dev->wakeup.state.enabled)
152 continue; 138 continue;
153 spin_unlock(&acpi_device_lock);
154 acpi_set_gpe_type(dev->wakeup.gpe_device, 139 acpi_set_gpe_type(dev->wakeup.gpe_device,
155 dev->wakeup.gpe_number, 140 dev->wakeup.gpe_number,
156 ACPI_GPE_TYPE_WAKE_RUN); 141 ACPI_GPE_TYPE_WAKE_RUN);
157 acpi_enable_gpe(dev->wakeup.gpe_device, 142 acpi_enable_gpe(dev->wakeup.gpe_device,
158 dev->wakeup.gpe_number); 143 dev->wakeup.gpe_number);
159 dev->wakeup.state.enabled = 1; 144 dev->wakeup.state.enabled = 1;
160 spin_lock(&acpi_device_lock);
161 } 145 }
162 spin_unlock(&acpi_device_lock); 146 mutex_unlock(&acpi_device_lock);
163 return 0; 147 return 0;
164} 148}