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/battery.c2
-rw-r--r--drivers/acpi/pci_slot.c5
-rw-r--r--drivers/acpi/processor_idle.c3
-rw-r--r--drivers/acpi/thermal.c68
-rw-r--r--drivers/acpi/video.c30
7 files changed, 53 insertions, 59 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/battery.c b/drivers/acpi/battery.c
index b0de6312919a..3c7d8942f23b 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -903,7 +903,7 @@ static struct acpi_driver acpi_battery_driver = {
903 }, 903 },
904}; 904};
905 905
906static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) 906static void acpi_battery_init_async(void *unused, async_cookie_t cookie)
907{ 907{
908 if (acpi_disabled) 908 if (acpi_disabled)
909 return; 909 return;
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/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/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