diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:33:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-21 19:33:19 -0500 |
commit | 20f8d2a49360980f1dc0afe2ea227e3ba887e575 (patch) | |
tree | d2891d4604d3fd40da7a21650d07f83e73ae8d8e | |
parent | e6364cd3a1a3e7c3e9a80bad15698afe6cc7ee75 (diff) | |
parent | 1f1519ef597ae4628dbd47244f0f68d700231523 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (26 commits)
PM: Make suspend_device() static
PCI ACPI: Fix comment describing acpi_pci_choose_state
Hibernation: Handle DEBUG_PAGEALLOC on x86
ACPI: fix build warning
ACPI: TSC breaks atkbd suspend
ACPI: remove is_processor_present prototype
acer-wmi: Add DMI match for mail LED on Acer TravelMate 4200 series
ACPI: sparse fix, replace macro with static function
ACPI: thinkpad-acpi: add tablet-mode reporting
ACPI: thinkpad-acpi: minor hotkey_radio_sw fixes
ACPI: thinkpad-acpi: improve thinkpad-acpi input device documentation
ACPI: thinkpad-acpi: issue input events for tablet swivel events
ACPI: thinkpad-acpi: make the video output feature optional
ACPI: thinkpad-acpi: synchronize input device switches
ACPI: thinkpad-acpi: always track input device open/close
ACPI: thinkpad-acpi: trivial fix to documentation
ACPI: thinkpad-acpi: trivial fix to module_desc typo
intel_menlo: extract return values using PTR_ERR
ACPI video: check for error from thermal_cooling_device_register
ACPI thermal: extract return values using PTR_ERR
...
-rw-r--r-- | Documentation/laptops/thinkpad-acpi.txt | 63 | ||||
-rw-r--r-- | arch/x86/mm/pageattr.c | 19 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 6 | ||||
-rw-r--r-- | drivers/acpi/executer/exregion.c | 5 | ||||
-rw-r--r-- | drivers/acpi/fan.c | 30 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 39 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 10 | ||||
-rw-r--r-- | drivers/acpi/utils.c | 18 | ||||
-rw-r--r-- | drivers/acpi/video.c | 3 | ||||
-rw-r--r-- | drivers/base/power/main.c | 2 | ||||
-rw-r--r-- | drivers/misc/Kconfig | 17 | ||||
-rw-r--r-- | drivers/misc/acer-wmi.c | 9 | ||||
-rw-r--r-- | drivers/misc/intel_menlow.c | 11 | ||||
-rw-r--r-- | drivers/misc/thinkpad_acpi.c | 123 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 2 | ||||
-rw-r--r-- | drivers/thermal/thermal.c | 39 | ||||
-rw-r--r-- | include/linux/mm.h | 6 | ||||
-rw-r--r-- | kernel/power/snapshot.c | 42 |
18 files changed, 321 insertions, 123 deletions
diff --git a/Documentation/laptops/thinkpad-acpi.txt b/Documentation/laptops/thinkpad-acpi.txt index 6c2477754a2a..76cb428435da 100644 --- a/Documentation/laptops/thinkpad-acpi.txt +++ b/Documentation/laptops/thinkpad-acpi.txt | |||
@@ -160,7 +160,7 @@ Hot keys | |||
160 | procfs: /proc/acpi/ibm/hotkey | 160 | procfs: /proc/acpi/ibm/hotkey |
161 | sysfs device attribute: hotkey_* | 161 | sysfs device attribute: hotkey_* |
162 | 162 | ||
163 | In a ThinkPad, the ACPI HKEY handler is responsible for comunicating | 163 | In a ThinkPad, the ACPI HKEY handler is responsible for communicating |
164 | some important events and also keyboard hot key presses to the operating | 164 | some important events and also keyboard hot key presses to the operating |
165 | system. Enabling the hotkey functionality of thinkpad-acpi signals the | 165 | system. Enabling the hotkey functionality of thinkpad-acpi signals the |
166 | firmware that such a driver is present, and modifies how the ThinkPad | 166 | firmware that such a driver is present, and modifies how the ThinkPad |
@@ -193,7 +193,7 @@ Not all bits in the mask can be modified. Not all bits that can be | |||
193 | modified do anything. Not all hot keys can be individually controlled | 193 | modified do anything. Not all hot keys can be individually controlled |
194 | by the mask. Some models do not support the mask at all, and in those | 194 | by the mask. Some models do not support the mask at all, and in those |
195 | models, hot keys cannot be controlled individually. The behaviour of | 195 | models, hot keys cannot be controlled individually. The behaviour of |
196 | the mask is, therefore, higly dependent on the ThinkPad model. | 196 | the mask is, therefore, highly dependent on the ThinkPad model. |
197 | 197 | ||
198 | Note that unmasking some keys prevents their default behavior. For | 198 | Note that unmasking some keys prevents their default behavior. For |
199 | example, if Fn+F5 is unmasked, that key will no longer enable/disable | 199 | example, if Fn+F5 is unmasked, that key will no longer enable/disable |
@@ -288,7 +288,7 @@ sysfs notes: | |||
288 | in ACPI event mode, volume up/down/mute are reported as | 288 | in ACPI event mode, volume up/down/mute are reported as |
289 | separate events, but this behaviour may be corrected in | 289 | separate events, but this behaviour may be corrected in |
290 | future releases of this driver, in which case the | 290 | future releases of this driver, in which case the |
291 | ThinkPad volume mixer user interface semanthics will be | 291 | ThinkPad volume mixer user interface semantics will be |
292 | enforced. | 292 | enforced. |
293 | 293 | ||
294 | hotkey_poll_freq: | 294 | hotkey_poll_freq: |
@@ -306,13 +306,20 @@ sysfs notes: | |||
306 | The recommended polling frequency is 10Hz. | 306 | The recommended polling frequency is 10Hz. |
307 | 307 | ||
308 | hotkey_radio_sw: | 308 | hotkey_radio_sw: |
309 | if the ThinkPad has a hardware radio switch, this | 309 | If the ThinkPad has a hardware radio switch, this |
310 | attribute will read 0 if the switch is in the "radios | 310 | attribute will read 0 if the switch is in the "radios |
311 | disabled" postition, and 1 if the switch is in the | 311 | disabled" position, and 1 if the switch is in the |
312 | "radios enabled" position. | 312 | "radios enabled" position. |
313 | 313 | ||
314 | This attribute has poll()/select() support. | 314 | This attribute has poll()/select() support. |
315 | 315 | ||
316 | hotkey_tablet_mode: | ||
317 | If the ThinkPad has tablet capabilities, this attribute | ||
318 | will read 0 if the ThinkPad is in normal mode, and | ||
319 | 1 if the ThinkPad is in tablet mode. | ||
320 | |||
321 | This attribute has poll()/select() support. | ||
322 | |||
316 | hotkey_report_mode: | 323 | hotkey_report_mode: |
317 | Returns the state of the procfs ACPI event report mode | 324 | Returns the state of the procfs ACPI event report mode |
318 | filter for hot keys. If it is set to 1 (the default), | 325 | filter for hot keys. If it is set to 1 (the default), |
@@ -339,7 +346,7 @@ sysfs notes: | |||
339 | wakeup_hotunplug_complete: | 346 | wakeup_hotunplug_complete: |
340 | Set to 1 if the system was waken up because of an | 347 | Set to 1 if the system was waken up because of an |
341 | undock or bay ejection request, and that request | 348 | undock or bay ejection request, and that request |
342 | was sucessfully completed. At this point, it might | 349 | was successfully completed. At this point, it might |
343 | be useful to send the system back to sleep, at the | 350 | be useful to send the system back to sleep, at the |
344 | user's choice. Refer to HKEY events 0x4003 and | 351 | user's choice. Refer to HKEY events 0x4003 and |
345 | 0x3003, below. | 352 | 0x3003, below. |
@@ -392,7 +399,7 @@ event code Key Notes | |||
392 | Lenovo: battery | 399 | Lenovo: battery |
393 | 400 | ||
394 | 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button | 401 | 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button |
395 | semanthics, i.e. sleep-to-RAM). | 402 | semantics, i.e. sleep-to-RAM). |
396 | It is always generate some kind | 403 | It is always generate some kind |
397 | of event, either the hot key | 404 | of event, either the hot key |
398 | event or a ACPI sleep button | 405 | event or a ACPI sleep button |
@@ -403,12 +410,12 @@ event code Key Notes | |||
403 | time passes. | 410 | time passes. |
404 | 411 | ||
405 | 0x1005 0x04 FN+F5 Radio. Enables/disables | 412 | 0x1005 0x04 FN+F5 Radio. Enables/disables |
406 | the internal BlueTooth hardware | 413 | the internal Bluetooth hardware |
407 | and W-WAN card if left in control | 414 | and W-WAN card if left in control |
408 | of the firmware. Does not affect | 415 | of the firmware. Does not affect |
409 | the WLAN card. | 416 | the WLAN card. |
410 | Should be used to turn on/off all | 417 | Should be used to turn on/off all |
411 | radios (bluetooth+W-WAN+WLAN), | 418 | radios (Bluetooth+W-WAN+WLAN), |
412 | really. | 419 | really. |
413 | 420 | ||
414 | 0x1006 0x05 FN+F6 - | 421 | 0x1006 0x05 FN+F6 - |
@@ -417,7 +424,7 @@ event code Key Notes | |||
417 | Do you feel lucky today? | 424 | Do you feel lucky today? |
418 | 425 | ||
419 | 0x1008 0x07 FN+F8 IBM: toggle screen expand | 426 | 0x1008 0x07 FN+F8 IBM: toggle screen expand |
420 | Lenovo: configure ultranav | 427 | Lenovo: configure UltraNav |
421 | 428 | ||
422 | 0x1009 0x08 FN+F9 - | 429 | 0x1009 0x08 FN+F9 - |
423 | .. .. .. | 430 | .. .. .. |
@@ -447,7 +454,7 @@ event code Key Notes | |||
447 | 0x1011 0x10 FN+END Brightness down. See brightness | 454 | 0x1011 0x10 FN+END Brightness down. See brightness |
448 | up for details. | 455 | up for details. |
449 | 456 | ||
450 | 0x1012 0x11 FN+PGUP Thinklight toggle. This key is | 457 | 0x1012 0x11 FN+PGUP ThinkLight toggle. This key is |
451 | always handled by the firmware, | 458 | always handled by the firmware, |
452 | even when unmasked. | 459 | even when unmasked. |
453 | 460 | ||
@@ -469,7 +476,7 @@ event code Key Notes | |||
469 | key is always handled by the | 476 | key is always handled by the |
470 | firmware, even when unmasked. | 477 | firmware, even when unmasked. |
471 | 478 | ||
472 | 0x1018 0x17 THINKPAD Thinkpad/Access IBM/Lenovo key | 479 | 0x1018 0x17 THINKPAD ThinkPad/Access IBM/Lenovo key |
473 | 480 | ||
474 | 0x1019 0x18 unknown | 481 | 0x1019 0x18 unknown |
475 | .. .. .. | 482 | .. .. .. |
@@ -488,9 +495,17 @@ If a key is mapped to KEY_UNKNOWN, it generates an input event that | |||
488 | includes an scan code. If a key is mapped to anything else, it will | 495 | includes an scan code. If a key is mapped to anything else, it will |
489 | generate input device EV_KEY events. | 496 | generate input device EV_KEY events. |
490 | 497 | ||
498 | In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW | ||
499 | events for switches: | ||
500 | |||
501 | SW_RADIO T60 and later hardare rfkill rocker switch | ||
502 | SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A | ||
503 | |||
491 | Non hot-key ACPI HKEY event map: | 504 | Non hot-key ACPI HKEY event map: |
492 | 0x5001 Lid closed | 505 | 0x5001 Lid closed |
493 | 0x5002 Lid opened | 506 | 0x5002 Lid opened |
507 | 0x5009 Tablet swivel: switched to tablet mode | ||
508 | 0x500A Tablet swivel: switched to normal mode | ||
494 | 0x7000 Radio Switch may have changed state | 509 | 0x7000 Radio Switch may have changed state |
495 | 510 | ||
496 | The above events are not propagated by the driver, except for legacy | 511 | The above events are not propagated by the driver, except for legacy |
@@ -505,9 +520,7 @@ The above events are never propagated by the driver. | |||
505 | 520 | ||
506 | 0x3003 Bay ejection (see 0x2x05) complete, can sleep again | 521 | 0x3003 Bay ejection (see 0x2x05) complete, can sleep again |
507 | 0x4003 Undocked (see 0x2x04), can sleep again | 522 | 0x4003 Undocked (see 0x2x04), can sleep again |
508 | 0x5009 Tablet swivel: switched to tablet mode | 523 | 0x500B Tablet pen inserted into its storage bay |
509 | 0x500A Tablet swivel: switched to normal mode | ||
510 | 0x500B Tablet pen insterted into its storage bay | ||
511 | 0x500C Tablet pen removed from its storage bay | 524 | 0x500C Tablet pen removed from its storage bay |
512 | 0x5010 Brightness level changed (newer Lenovo BIOSes) | 525 | 0x5010 Brightness level changed (newer Lenovo BIOSes) |
513 | 526 | ||
@@ -539,7 +552,7 @@ sysfs (it is read-only). | |||
539 | If the hotkey_report_mode module parameter is set to 1 or 2, it cannot | 552 | If the hotkey_report_mode module parameter is set to 1 or 2, it cannot |
540 | be changed later through sysfs (any writes will return -EPERM to signal | 553 | be changed later through sysfs (any writes will return -EPERM to signal |
541 | that hotkey_report_mode was locked. On 2.6.23 and later, where | 554 | that hotkey_report_mode was locked. On 2.6.23 and later, where |
542 | hotkey_report_mode cannot be changed at all, writes will return -EACES). | 555 | hotkey_report_mode cannot be changed at all, writes will return -EACCES). |
543 | 556 | ||
544 | hotkey_report_mode set to 1 makes the driver export through the procfs | 557 | hotkey_report_mode set to 1 makes the driver export through the procfs |
545 | ACPI event interface all hot key presses (which are *also* sent to the | 558 | ACPI event interface all hot key presses (which are *also* sent to the |
@@ -584,7 +597,7 @@ Sysfs notes: | |||
584 | 0: disables Bluetooth / Bluetooth is disabled | 597 | 0: disables Bluetooth / Bluetooth is disabled |
585 | 1: enables Bluetooth / Bluetooth is enabled. | 598 | 1: enables Bluetooth / Bluetooth is enabled. |
586 | 599 | ||
587 | Note: this interface will be probably be superseeded by the | 600 | Note: this interface will be probably be superseded by the |
588 | generic rfkill class, so it is NOT to be considered stable yet. | 601 | generic rfkill class, so it is NOT to be considered stable yet. |
589 | 602 | ||
590 | Video output control -- /proc/acpi/ibm/video | 603 | Video output control -- /proc/acpi/ibm/video |
@@ -791,12 +804,12 @@ on the X40 (tpb is the ThinkPad Buttons utility): | |||
791 | 1 - Related to "Volume up" key press | 804 | 1 - Related to "Volume up" key press |
792 | 2 - Related to "Mute on" key press | 805 | 2 - Related to "Mute on" key press |
793 | 3 - Related to "Access IBM" key press | 806 | 3 - Related to "Access IBM" key press |
794 | 4 - Related to "LCD brightness up" key pess | 807 | 4 - Related to "LCD brightness up" key press |
795 | 5 - Related to "LCD brightness down" key press | 808 | 5 - Related to "LCD brightness down" key press |
796 | 11 - Related to "toggle screen expansion" key press/function | 809 | 11 - Related to "toggle screen expansion" key press/function |
797 | 12 - Related to "ThinkLight on" | 810 | 12 - Related to "ThinkLight on" |
798 | 13 - Related to "ThinkLight off" | 811 | 13 - Related to "ThinkLight off" |
799 | 14 - Related to "ThinkLight" key press (toggle thinklight) | 812 | 14 - Related to "ThinkLight" key press (toggle ThinkLight) |
800 | 813 | ||
801 | The cmos command interface is prone to firmware split-brain problems, as | 814 | The cmos command interface is prone to firmware split-brain problems, as |
802 | in newer ThinkPads it is just a compatibility layer. Do not use it, it is | 815 | in newer ThinkPads it is just a compatibility layer. Do not use it, it is |
@@ -1024,7 +1037,7 @@ There are two interfaces to the firmware for direct brightness control, | |||
1024 | EC and CMOS. To select which one should be used, use the | 1037 | EC and CMOS. To select which one should be used, use the |
1025 | brightness_mode module parameter: brightness_mode=1 selects EC mode, | 1038 | brightness_mode module parameter: brightness_mode=1 selects EC mode, |
1026 | brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC | 1039 | brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC |
1027 | and CMOS. The driver tries to autodetect which interface to use. | 1040 | and CMOS. The driver tries to auto-detect which interface to use. |
1028 | 1041 | ||
1029 | When display backlight brightness controls are available through the | 1042 | When display backlight brightness controls are available through the |
1030 | standard ACPI interface, it is best to use it instead of this direct | 1043 | standard ACPI interface, it is best to use it instead of this direct |
@@ -1266,8 +1279,8 @@ experimental=1 parameter when loading the module. | |||
1266 | This feature shows the presence and current state of a W-WAN (Sierra | 1279 | This feature shows the presence and current state of a W-WAN (Sierra |
1267 | Wireless EV-DO) device. | 1280 | Wireless EV-DO) device. |
1268 | 1281 | ||
1269 | It was tested on a Lenovo Thinkpad X60. It should probably work on other | 1282 | It was tested on a Lenovo ThinkPad X60. It should probably work on other |
1270 | Thinkpad models which come with this module installed. | 1283 | ThinkPad models which come with this module installed. |
1271 | 1284 | ||
1272 | Procfs notes: | 1285 | Procfs notes: |
1273 | 1286 | ||
@@ -1286,7 +1299,7 @@ Sysfs notes: | |||
1286 | 0: disables WWAN card / WWAN card is disabled | 1299 | 0: disables WWAN card / WWAN card is disabled |
1287 | 1: enables WWAN card / WWAN card is enabled. | 1300 | 1: enables WWAN card / WWAN card is enabled. |
1288 | 1301 | ||
1289 | Note: this interface will be probably be superseeded by the | 1302 | Note: this interface will be probably be superseded by the |
1290 | generic rfkill class, so it is NOT to be considered stable yet. | 1303 | generic rfkill class, so it is NOT to be considered stable yet. |
1291 | 1304 | ||
1292 | Multiple Commands, Module Parameters | 1305 | Multiple Commands, Module Parameters |
@@ -1309,7 +1322,7 @@ Enabling debugging output | |||
1309 | The module takes a debug parameter which can be used to selectively | 1322 | The module takes a debug parameter which can be used to selectively |
1310 | enable various classes of debugging output, for example: | 1323 | enable various classes of debugging output, for example: |
1311 | 1324 | ||
1312 | modprobe ibm_acpi debug=0xffff | 1325 | modprobe thinkpad_acpi debug=0xffff |
1313 | 1326 | ||
1314 | will enable all debugging output classes. It takes a bitmask, so | 1327 | will enable all debugging output classes. It takes a bitmask, so |
1315 | to enable more than one output class, just add their values. | 1328 | to enable more than one output class, just add their values. |
@@ -1356,7 +1369,7 @@ Sysfs interface changelog: | |||
1356 | NVRAM is compiled out by the user because it is | 1369 | NVRAM is compiled out by the user because it is |
1357 | unneeded/undesired in the first place). | 1370 | unneeded/undesired in the first place). |
1358 | 0x020101: Marker for thinkpad-acpi with hot key NVRAM polling | 1371 | 0x020101: Marker for thinkpad-acpi with hot key NVRAM polling |
1359 | and proper hotkey_mask semanthics (version 8 of the | 1372 | and proper hotkey_mask semantics (version 8 of the |
1360 | NVRAM polling patch). Some development snapshots of | 1373 | NVRAM polling patch). Some development snapshots of |
1361 | 0.18 had an earlier version that did strange things | 1374 | 0.18 had an earlier version that did strange things |
1362 | to hotkey_mask. | 1375 | to hotkey_mask. |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index e2a74ea11a53..464d8fc21ce6 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -899,7 +899,24 @@ void kernel_map_pages(struct page *page, int numpages, int enable) | |||
899 | */ | 899 | */ |
900 | cpa_fill_pool(); | 900 | cpa_fill_pool(); |
901 | } | 901 | } |
902 | #endif | 902 | |
903 | #ifdef CONFIG_HIBERNATION | ||
904 | |||
905 | bool kernel_page_present(struct page *page) | ||
906 | { | ||
907 | unsigned int level; | ||
908 | pte_t *pte; | ||
909 | |||
910 | if (PageHighMem(page)) | ||
911 | return false; | ||
912 | |||
913 | pte = lookup_address((unsigned long)page_address(page), &level); | ||
914 | return (pte_val(*pte) & _PAGE_PRESENT); | ||
915 | } | ||
916 | |||
917 | #endif /* CONFIG_HIBERNATION */ | ||
918 | |||
919 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | ||
903 | 920 | ||
904 | /* | 921 | /* |
905 | * The testcases use internal knowledge of the implementation that shouldn't | 922 | * The testcases use internal knowledge of the implementation that shouldn't |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 7222a18a0319..caf873c14bfb 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -943,7 +943,11 @@ int __init acpi_ec_ecdt_probe(void) | |||
943 | boot_ec->command_addr = ecdt_ptr->control.address; | 943 | boot_ec->command_addr = ecdt_ptr->control.address; |
944 | boot_ec->data_addr = ecdt_ptr->data.address; | 944 | boot_ec->data_addr = ecdt_ptr->data.address; |
945 | boot_ec->gpe = ecdt_ptr->gpe; | 945 | boot_ec->gpe = ecdt_ptr->gpe; |
946 | boot_ec->handle = ACPI_ROOT_OBJECT; | 946 | if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, |
947 | &boot_ec->handle))) { | ||
948 | pr_info("Failed to locate handle for boot EC\n"); | ||
949 | boot_ec->handle = ACPI_ROOT_OBJECT; | ||
950 | } | ||
947 | } else { | 951 | } else { |
948 | /* This workaround is needed only on some broken machines, | 952 | /* This workaround is needed only on some broken machines, |
949 | * which require early EC, but fail to provide ECDT */ | 953 | * which require early EC, but fail to provide ECDT */ |
diff --git a/drivers/acpi/executer/exregion.c b/drivers/acpi/executer/exregion.c index 2e9ce94798c7..3f51b7e84a17 100644 --- a/drivers/acpi/executer/exregion.c +++ b/drivers/acpi/executer/exregion.c | |||
@@ -338,6 +338,7 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
338 | acpi_status status = AE_OK; | 338 | acpi_status status = AE_OK; |
339 | struct acpi_pci_id *pci_id; | 339 | struct acpi_pci_id *pci_id; |
340 | u16 pci_register; | 340 | u16 pci_register; |
341 | u32 value32; | ||
341 | 342 | ||
342 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); | 343 | ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); |
343 | 344 | ||
@@ -364,9 +365,9 @@ acpi_ex_pci_config_space_handler(u32 function, | |||
364 | switch (function) { | 365 | switch (function) { |
365 | case ACPI_READ: | 366 | case ACPI_READ: |
366 | 367 | ||
367 | *value = 0; | ||
368 | status = acpi_os_read_pci_configuration(pci_id, pci_register, | 368 | status = acpi_os_read_pci_configuration(pci_id, pci_register, |
369 | value, bit_width); | 369 | &value32, bit_width); |
370 | *value = value32; | ||
370 | break; | 371 | break; |
371 | 372 | ||
372 | case ACPI_WRITE: | 373 | case ACPI_WRITE: |
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index 48cb705b274a..c8e3cba423ef 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -256,22 +256,28 @@ static int acpi_fan_add(struct acpi_device *device) | |||
256 | 256 | ||
257 | cdev = thermal_cooling_device_register("Fan", device, | 257 | cdev = thermal_cooling_device_register("Fan", device, |
258 | &fan_cooling_ops); | 258 | &fan_cooling_ops); |
259 | if (cdev) | 259 | if (IS_ERR(cdev)) { |
260 | result = PTR_ERR(cdev); | ||
261 | goto end; | ||
262 | } | ||
263 | if (cdev) { | ||
260 | printk(KERN_INFO PREFIX | 264 | printk(KERN_INFO PREFIX |
261 | "%s is registered as cooling_device%d\n", | 265 | "%s is registered as cooling_device%d\n", |
262 | device->dev.bus_id, cdev->id); | 266 | device->dev.bus_id, cdev->id); |
263 | else | ||
264 | goto end; | ||
265 | acpi_driver_data(device) = cdev; | ||
266 | result = sysfs_create_link(&device->dev.kobj, &cdev->device.kobj, | ||
267 | "thermal_cooling"); | ||
268 | if (result) | ||
269 | return result; | ||
270 | 267 | ||
271 | result = sysfs_create_link(&cdev->device.kobj, &device->dev.kobj, | 268 | acpi_driver_data(device) = cdev; |
272 | "device"); | 269 | result = sysfs_create_link(&device->dev.kobj, |
273 | if (result) | 270 | &cdev->device.kobj, |
274 | return result; | 271 | "thermal_cooling"); |
272 | if (result) | ||
273 | return result; | ||
274 | |||
275 | result = sysfs_create_link(&cdev->device.kobj, | ||
276 | &device->dev.kobj, | ||
277 | "device"); | ||
278 | if (result) | ||
279 | return result; | ||
280 | } | ||
275 | 281 | ||
276 | result = acpi_fan_add_fs(device); | 282 | result = acpi_fan_add_fs(device); |
277 | if (result) | 283 | if (result) |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 75ccf5d18bf4..a3cc8a98255c 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -670,21 +670,26 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
670 | 670 | ||
671 | pr->cdev = thermal_cooling_device_register("Processor", device, | 671 | pr->cdev = thermal_cooling_device_register("Processor", device, |
672 | &processor_cooling_ops); | 672 | &processor_cooling_ops); |
673 | if (pr->cdev) | 673 | if (IS_ERR(pr->cdev)) { |
674 | result = PTR_ERR(pr->cdev); | ||
675 | goto end; | ||
676 | } | ||
677 | if (pr->cdev) { | ||
674 | printk(KERN_INFO PREFIX | 678 | printk(KERN_INFO PREFIX |
675 | "%s is registered as cooling_device%d\n", | 679 | "%s is registered as cooling_device%d\n", |
676 | device->dev.bus_id, pr->cdev->id); | 680 | device->dev.bus_id, pr->cdev->id); |
677 | else | ||
678 | goto end; | ||
679 | 681 | ||
680 | result = sysfs_create_link(&device->dev.kobj, &pr->cdev->device.kobj, | 682 | result = sysfs_create_link(&device->dev.kobj, |
681 | "thermal_cooling"); | 683 | &pr->cdev->device.kobj, |
682 | if (result) | 684 | "thermal_cooling"); |
683 | return result; | 685 | if (result) |
684 | result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, | 686 | return result; |
685 | "device"); | 687 | result = sysfs_create_link(&pr->cdev->device.kobj, |
686 | if (result) | 688 | &device->dev.kobj, |
687 | return result; | 689 | "device"); |
690 | if (result) | ||
691 | return result; | ||
692 | } | ||
688 | 693 | ||
689 | if (pr->flags.throttling) { | 694 | if (pr->flags.throttling) { |
690 | printk(KERN_INFO PREFIX "%s [%s] (supports", | 695 | printk(KERN_INFO PREFIX "%s [%s] (supports", |
@@ -809,10 +814,12 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
809 | 814 | ||
810 | acpi_processor_remove_fs(device); | 815 | acpi_processor_remove_fs(device); |
811 | 816 | ||
812 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); | 817 | if (pr->cdev) { |
813 | sysfs_remove_link(&pr->cdev->device.kobj, "device"); | 818 | sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); |
814 | thermal_cooling_device_unregister(pr->cdev); | 819 | sysfs_remove_link(&pr->cdev->device.kobj, "device"); |
815 | pr->cdev = NULL; | 820 | thermal_cooling_device_unregister(pr->cdev); |
821 | pr->cdev = NULL; | ||
822 | } | ||
816 | 823 | ||
817 | processors[pr->id] = NULL; | 824 | processors[pr->id] = NULL; |
818 | 825 | ||
@@ -826,8 +833,6 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
826 | * Acpi processor hotplug support * | 833 | * Acpi processor hotplug support * |
827 | ****************************************************************************/ | 834 | ****************************************************************************/ |
828 | 835 | ||
829 | static int is_processor_present(acpi_handle handle); | ||
830 | |||
831 | static int is_processor_present(acpi_handle handle) | 836 | static int is_processor_present(acpi_handle handle) |
832 | { | 837 | { |
833 | acpi_status status; | 838 | acpi_status status; |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 980e1c33e6c5..6f3b217699e9 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -364,7 +364,7 @@ int acpi_processor_resume(struct acpi_device * device) | |||
364 | return 0; | 364 | return 0; |
365 | } | 365 | } |
366 | 366 | ||
367 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) | 367 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
368 | static int tsc_halts_in_c(int state) | 368 | static int tsc_halts_in_c(int state) |
369 | { | 369 | { |
370 | switch (boot_cpu_data.x86_vendor) { | 370 | switch (boot_cpu_data.x86_vendor) { |
@@ -544,7 +544,7 @@ static void acpi_processor_idle(void) | |||
544 | /* Get end time (ticks) */ | 544 | /* Get end time (ticks) */ |
545 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 545 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
546 | 546 | ||
547 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) | 547 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
548 | /* TSC halts in C2, so notify users */ | 548 | /* TSC halts in C2, so notify users */ |
549 | if (tsc_halts_in_c(ACPI_STATE_C2)) | 549 | if (tsc_halts_in_c(ACPI_STATE_C2)) |
550 | mark_tsc_unstable("possible TSC halt in C2"); | 550 | mark_tsc_unstable("possible TSC halt in C2"); |
@@ -609,7 +609,7 @@ static void acpi_processor_idle(void) | |||
609 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | 609 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); |
610 | } | 610 | } |
611 | 611 | ||
612 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) | 612 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
613 | /* TSC halts in C3, so notify users */ | 613 | /* TSC halts in C3, so notify users */ |
614 | if (tsc_halts_in_c(ACPI_STATE_C3)) | 614 | if (tsc_halts_in_c(ACPI_STATE_C3)) |
615 | mark_tsc_unstable("TSC halts in C3"); | 615 | mark_tsc_unstable("TSC halts in C3"); |
@@ -1500,7 +1500,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1500 | acpi_idle_do_entry(cx); | 1500 | acpi_idle_do_entry(cx); |
1501 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1501 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1502 | 1502 | ||
1503 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) | 1503 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
1504 | /* TSC could halt in idle, so notify users */ | 1504 | /* TSC could halt in idle, so notify users */ |
1505 | if (tsc_halts_in_c(cx->type)) | 1505 | if (tsc_halts_in_c(cx->type)) |
1506 | mark_tsc_unstable("TSC halts in idle");; | 1506 | mark_tsc_unstable("TSC halts in idle");; |
@@ -1614,7 +1614,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1614 | spin_unlock(&c3_lock); | 1614 | spin_unlock(&c3_lock); |
1615 | } | 1615 | } |
1616 | 1616 | ||
1617 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86_TSC) | 1617 | #if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86) |
1618 | /* TSC could halt in idle, so notify users */ | 1618 | /* TSC could halt in idle, so notify users */ |
1619 | if (tsc_halts_in_c(ACPI_STATE_C3)) | 1619 | if (tsc_halts_in_c(ACPI_STATE_C3)) |
1620 | mark_tsc_unstable("TSC halts in idle"); | 1620 | mark_tsc_unstable("TSC halts in idle"); |
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 34f157571080..eba55b7d6c95 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c | |||
@@ -36,16 +36,20 @@ ACPI_MODULE_NAME("utils"); | |||
36 | /* -------------------------------------------------------------------------- | 36 | /* -------------------------------------------------------------------------- |
37 | Object Evaluation Helpers | 37 | Object Evaluation Helpers |
38 | -------------------------------------------------------------------------- */ | 38 | -------------------------------------------------------------------------- */ |
39 | static void | ||
40 | acpi_util_eval_error(acpi_handle h, acpi_string p, acpi_status s) | ||
41 | { | ||
39 | #ifdef ACPI_DEBUG_OUTPUT | 42 | #ifdef ACPI_DEBUG_OUTPUT |
40 | #define acpi_util_eval_error(h,p,s) {\ | 43 | char prefix[80] = {'\0'}; |
41 | char prefix[80] = {'\0'};\ | 44 | struct acpi_buffer buffer = {sizeof(prefix), prefix}; |
42 | struct acpi_buffer buffer = {sizeof(prefix), prefix};\ | 45 | acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer); |
43 | acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);\ | 46 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n", |
44 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n",\ | 47 | (char *) prefix, p, acpi_format_exception(s))); |
45 | (char *) prefix, p, acpi_format_exception(s))); } | ||
46 | #else | 48 | #else |
47 | #define acpi_util_eval_error(h,p,s) | 49 | return; |
48 | #endif | 50 | #endif |
51 | } | ||
52 | |||
49 | acpi_status | 53 | acpi_status |
50 | acpi_extract_package(union acpi_object *package, | 54 | acpi_extract_package(union acpi_object *package, |
51 | struct acpi_buffer *format, struct acpi_buffer *buffer) | 55 | struct acpi_buffer *format, struct acpi_buffer *buffer) |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 7f714fa2a454..12cce69b5441 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -731,6 +731,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
731 | 731 | ||
732 | device->cdev = thermal_cooling_device_register("LCD", | 732 | device->cdev = thermal_cooling_device_register("LCD", |
733 | device->dev, &video_cooling_ops); | 733 | device->dev, &video_cooling_ops); |
734 | if (IS_ERR(device->cdev)) | ||
735 | return; | ||
736 | |||
734 | if (device->cdev) { | 737 | if (device->cdev) { |
735 | printk(KERN_INFO PREFIX | 738 | printk(KERN_INFO PREFIX |
736 | "%s is registered as cooling_device%d\n", | 739 | "%s is registered as cooling_device%d\n", |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index cea5ed3919cd..ee9d1c8db0d6 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -415,7 +415,7 @@ EXPORT_SYMBOL_GPL(device_power_down); | |||
415 | * @dev: Device. | 415 | * @dev: Device. |
416 | * @state: Power state device is entering. | 416 | * @state: Power state device is entering. |
417 | */ | 417 | */ |
418 | int suspend_device(struct device *dev, pm_message_t state) | 418 | static int suspend_device(struct device *dev, pm_message_t state) |
419 | { | 419 | { |
420 | int error = 0; | 420 | int error = 0; |
421 | 421 | ||
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 1abc95ca9dfa..982e27b86d10 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -258,6 +258,23 @@ config THINKPAD_ACPI_BAY | |||
258 | 258 | ||
259 | If you are not sure, say Y here. | 259 | If you are not sure, say Y here. |
260 | 260 | ||
261 | config THINKPAD_ACPI_VIDEO | ||
262 | bool "Video output control support" | ||
263 | depends on THINKPAD_ACPI | ||
264 | default y | ||
265 | ---help--- | ||
266 | Allows the thinkpad_acpi driver to provide an interface to control | ||
267 | the various video output ports. | ||
268 | |||
269 | This feature often won't work well, depending on ThinkPad model, | ||
270 | display state, video output devices in use, whether there is a X | ||
271 | server running, phase of the moon, and the current mood of | ||
272 | Schroedinger's cat. If you can use X.org's RandR to control | ||
273 | your ThinkPad's video output ports instead of this feature, | ||
274 | don't think twice: do it and say N here to save some memory. | ||
275 | |||
276 | If you are not sure, say Y here. | ||
277 | |||
261 | config THINKPAD_ACPI_HOTKEY_POLL | 278 | config THINKPAD_ACPI_HOTKEY_POLL |
262 | bool "Suport NVRAM polling for hot keys" | 279 | bool "Suport NVRAM polling for hot keys" |
263 | depends on THINKPAD_ACPI | 280 | depends on THINKPAD_ACPI |
diff --git a/drivers/misc/acer-wmi.c b/drivers/misc/acer-wmi.c index d7aea93081f2..74d12b4a3abd 100644 --- a/drivers/misc/acer-wmi.c +++ b/drivers/misc/acer-wmi.c | |||
@@ -273,6 +273,15 @@ static struct dmi_system_id acer_quirks[] = { | |||
273 | }, | 273 | }, |
274 | { | 274 | { |
275 | .callback = dmi_matched, | 275 | .callback = dmi_matched, |
276 | .ident = "Acer TravelMate 4200", | ||
277 | .matches = { | ||
278 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
279 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4200"), | ||
280 | }, | ||
281 | .driver_data = &quirk_acer_travelmate_2490, | ||
282 | }, | ||
283 | { | ||
284 | .callback = dmi_matched, | ||
276 | .ident = "Medion MD 98300", | 285 | .ident = "Medion MD 98300", |
277 | .matches = { | 286 | .matches = { |
278 | DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), | 287 | DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), |
diff --git a/drivers/misc/intel_menlow.c b/drivers/misc/intel_menlow.c index f70984ab1e1b..de16e88eb8d3 100644 --- a/drivers/misc/intel_menlow.c +++ b/drivers/misc/intel_menlow.c | |||
@@ -170,10 +170,13 @@ static int intel_menlow_memory_add(struct acpi_device *device) | |||
170 | 170 | ||
171 | cdev = thermal_cooling_device_register("Memory controller", device, | 171 | cdev = thermal_cooling_device_register("Memory controller", device, |
172 | &memory_cooling_ops); | 172 | &memory_cooling_ops); |
173 | acpi_driver_data(device) = cdev; | 173 | if (IS_ERR(cdev)) { |
174 | if (!cdev) | 174 | result = PTR_ERR(cdev); |
175 | result = -ENODEV; | 175 | goto end; |
176 | else { | 176 | } |
177 | |||
178 | if (cdev) { | ||
179 | acpi_driver_data(device) = cdev; | ||
177 | result = sysfs_create_link(&device->dev.kobj, | 180 | result = sysfs_create_link(&device->dev.kobj, |
178 | &cdev->device.kobj, "thermal_cooling"); | 181 | &cdev->device.kobj, "thermal_cooling"); |
179 | if (result) | 182 | if (result) |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e2c7edd206a6..bb269d0c677e 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -221,6 +221,7 @@ static struct { | |||
221 | u32 hotkey:1; | 221 | u32 hotkey:1; |
222 | u32 hotkey_mask:1; | 222 | u32 hotkey_mask:1; |
223 | u32 hotkey_wlsw:1; | 223 | u32 hotkey_wlsw:1; |
224 | u32 hotkey_tablet:1; | ||
224 | u32 light:1; | 225 | u32 light:1; |
225 | u32 light_status:1; | 226 | u32 light_status:1; |
226 | u32 bright_16levels:1; | 227 | u32 bright_16levels:1; |
@@ -301,6 +302,13 @@ TPACPI_HANDLE(hkey, ec, "\\_SB.HKEY", /* 600e/x, 770e, 770x */ | |||
301 | "HKEY", /* all others */ | 302 | "HKEY", /* all others */ |
302 | ); /* 570 */ | 303 | ); /* 570 */ |
303 | 304 | ||
305 | TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */ | ||
306 | "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ | ||
307 | "\\_SB.PCI0.VID0", /* 770e */ | ||
308 | "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ | ||
309 | "\\_SB.PCI0.AGP.VID", /* all others */ | ||
310 | ); /* R30, R31 */ | ||
311 | |||
304 | 312 | ||
305 | /************************************************************************* | 313 | /************************************************************************* |
306 | * ACPI helpers | 314 | * ACPI helpers |
@@ -1053,6 +1061,9 @@ static struct attribute_set *hotkey_dev_attributes; | |||
1053 | #define HOTKEY_CONFIG_CRITICAL_END | 1061 | #define HOTKEY_CONFIG_CRITICAL_END |
1054 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ | 1062 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ |
1055 | 1063 | ||
1064 | /* HKEY.MHKG() return bits */ | ||
1065 | #define TP_HOTKEY_TABLET_MASK (1 << 3) | ||
1066 | |||
1056 | static int hotkey_get_wlsw(int *status) | 1067 | static int hotkey_get_wlsw(int *status) |
1057 | { | 1068 | { |
1058 | if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) | 1069 | if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) |
@@ -1060,6 +1071,16 @@ static int hotkey_get_wlsw(int *status) | |||
1060 | return 0; | 1071 | return 0; |
1061 | } | 1072 | } |
1062 | 1073 | ||
1074 | static int hotkey_get_tablet_mode(int *status) | ||
1075 | { | ||
1076 | int s; | ||
1077 | |||
1078 | if (!acpi_evalf(hkey_handle, &s, "MHKG", "d")) | ||
1079 | return -EIO; | ||
1080 | |||
1081 | return ((s & TP_HOTKEY_TABLET_MASK) != 0); | ||
1082 | } | ||
1083 | |||
1063 | /* | 1084 | /* |
1064 | * Call with hotkey_mutex held | 1085 | * Call with hotkey_mutex held |
1065 | */ | 1086 | */ |
@@ -1154,15 +1175,31 @@ static void tpacpi_input_send_radiosw(void) | |||
1154 | { | 1175 | { |
1155 | int wlsw; | 1176 | int wlsw; |
1156 | 1177 | ||
1157 | mutex_lock(&tpacpi_inputdev_send_mutex); | ||
1158 | |||
1159 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { | 1178 | if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { |
1179 | mutex_lock(&tpacpi_inputdev_send_mutex); | ||
1180 | |||
1160 | input_report_switch(tpacpi_inputdev, | 1181 | input_report_switch(tpacpi_inputdev, |
1161 | SW_RADIO, !!wlsw); | 1182 | SW_RADIO, !!wlsw); |
1162 | input_sync(tpacpi_inputdev); | 1183 | input_sync(tpacpi_inputdev); |
1184 | |||
1185 | mutex_unlock(&tpacpi_inputdev_send_mutex); | ||
1163 | } | 1186 | } |
1187 | } | ||
1188 | |||
1189 | static void tpacpi_input_send_tabletsw(void) | ||
1190 | { | ||
1191 | int state; | ||
1192 | |||
1193 | if (tp_features.hotkey_tablet && | ||
1194 | !hotkey_get_tablet_mode(&state)) { | ||
1195 | mutex_lock(&tpacpi_inputdev_send_mutex); | ||
1164 | 1196 | ||
1165 | mutex_unlock(&tpacpi_inputdev_send_mutex); | 1197 | input_report_switch(tpacpi_inputdev, |
1198 | SW_TABLET_MODE, !!state); | ||
1199 | input_sync(tpacpi_inputdev); | ||
1200 | |||
1201 | mutex_unlock(&tpacpi_inputdev_send_mutex); | ||
1202 | } | ||
1166 | } | 1203 | } |
1167 | 1204 | ||
1168 | static void tpacpi_input_send_key(unsigned int scancode) | 1205 | static void tpacpi_input_send_key(unsigned int scancode) |
@@ -1417,6 +1454,14 @@ static void hotkey_poll_setup_safe(int may_warn) | |||
1417 | mutex_unlock(&hotkey_mutex); | 1454 | mutex_unlock(&hotkey_mutex); |
1418 | } | 1455 | } |
1419 | 1456 | ||
1457 | #else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ | ||
1458 | |||
1459 | static void hotkey_poll_setup_safe(int __unused) | ||
1460 | { | ||
1461 | } | ||
1462 | |||
1463 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ | ||
1464 | |||
1420 | static int hotkey_inputdev_open(struct input_dev *dev) | 1465 | static int hotkey_inputdev_open(struct input_dev *dev) |
1421 | { | 1466 | { |
1422 | switch (tpacpi_lifecycle) { | 1467 | switch (tpacpi_lifecycle) { |
@@ -1444,7 +1489,6 @@ static void hotkey_inputdev_close(struct input_dev *dev) | |||
1444 | if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING) | 1489 | if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING) |
1445 | hotkey_poll_setup_safe(0); | 1490 | hotkey_poll_setup_safe(0); |
1446 | } | 1491 | } |
1447 | #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ | ||
1448 | 1492 | ||
1449 | /* sysfs hotkey enable ------------------------------------------------- */ | 1493 | /* sysfs hotkey enable ------------------------------------------------- */ |
1450 | static ssize_t hotkey_enable_show(struct device *dev, | 1494 | static ssize_t hotkey_enable_show(struct device *dev, |
@@ -1666,6 +1710,29 @@ static void hotkey_radio_sw_notify_change(void) | |||
1666 | "hotkey_radio_sw"); | 1710 | "hotkey_radio_sw"); |
1667 | } | 1711 | } |
1668 | 1712 | ||
1713 | /* sysfs hotkey tablet mode (pollable) --------------------------------- */ | ||
1714 | static ssize_t hotkey_tablet_mode_show(struct device *dev, | ||
1715 | struct device_attribute *attr, | ||
1716 | char *buf) | ||
1717 | { | ||
1718 | int res, s; | ||
1719 | res = hotkey_get_tablet_mode(&s); | ||
1720 | if (res < 0) | ||
1721 | return res; | ||
1722 | |||
1723 | return snprintf(buf, PAGE_SIZE, "%d\n", !!s); | ||
1724 | } | ||
1725 | |||
1726 | static struct device_attribute dev_attr_hotkey_tablet_mode = | ||
1727 | __ATTR(hotkey_tablet_mode, S_IRUGO, hotkey_tablet_mode_show, NULL); | ||
1728 | |||
1729 | static void hotkey_tablet_mode_notify_change(void) | ||
1730 | { | ||
1731 | if (tp_features.hotkey_tablet) | ||
1732 | sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, | ||
1733 | "hotkey_tablet_mode"); | ||
1734 | } | ||
1735 | |||
1669 | /* sysfs hotkey report_mode -------------------------------------------- */ | 1736 | /* sysfs hotkey report_mode -------------------------------------------- */ |
1670 | static ssize_t hotkey_report_mode_show(struct device *dev, | 1737 | static ssize_t hotkey_report_mode_show(struct device *dev, |
1671 | struct device_attribute *attr, | 1738 | struct device_attribute *attr, |
@@ -1878,7 +1945,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
1878 | str_supported(tp_features.hotkey)); | 1945 | str_supported(tp_features.hotkey)); |
1879 | 1946 | ||
1880 | if (tp_features.hotkey) { | 1947 | if (tp_features.hotkey) { |
1881 | hotkey_dev_attributes = create_attr_set(12, NULL); | 1948 | hotkey_dev_attributes = create_attr_set(13, NULL); |
1882 | if (!hotkey_dev_attributes) | 1949 | if (!hotkey_dev_attributes) |
1883 | return -ENOMEM; | 1950 | return -ENOMEM; |
1884 | res = add_many_to_attr_set(hotkey_dev_attributes, | 1951 | res = add_many_to_attr_set(hotkey_dev_attributes, |
@@ -1957,6 +2024,18 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
1957 | &dev_attr_hotkey_radio_sw.attr); | 2024 | &dev_attr_hotkey_radio_sw.attr); |
1958 | } | 2025 | } |
1959 | 2026 | ||
2027 | /* For X41t, X60t, X61t Tablets... */ | ||
2028 | if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { | ||
2029 | tp_features.hotkey_tablet = 1; | ||
2030 | printk(TPACPI_INFO | ||
2031 | "possible tablet mode switch found; " | ||
2032 | "ThinkPad in %s mode\n", | ||
2033 | (status & TP_HOTKEY_TABLET_MASK)? | ||
2034 | "tablet" : "laptop"); | ||
2035 | res = add_to_attr_set(hotkey_dev_attributes, | ||
2036 | &dev_attr_hotkey_tablet_mode.attr); | ||
2037 | } | ||
2038 | |||
1960 | if (!res) | 2039 | if (!res) |
1961 | res = register_attr_set_with_sysfs( | 2040 | res = register_attr_set_with_sysfs( |
1962 | hotkey_dev_attributes, | 2041 | hotkey_dev_attributes, |
@@ -2006,6 +2085,10 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2006 | set_bit(EV_SW, tpacpi_inputdev->evbit); | 2085 | set_bit(EV_SW, tpacpi_inputdev->evbit); |
2007 | set_bit(SW_RADIO, tpacpi_inputdev->swbit); | 2086 | set_bit(SW_RADIO, tpacpi_inputdev->swbit); |
2008 | } | 2087 | } |
2088 | if (tp_features.hotkey_tablet) { | ||
2089 | set_bit(EV_SW, tpacpi_inputdev->evbit); | ||
2090 | set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit); | ||
2091 | } | ||
2009 | 2092 | ||
2010 | dbg_printk(TPACPI_DBG_INIT, | 2093 | dbg_printk(TPACPI_DBG_INIT, |
2011 | "enabling hot key handling\n"); | 2094 | "enabling hot key handling\n"); |
@@ -2023,12 +2106,12 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
2023 | (hotkey_report_mode < 2) ? | 2106 | (hotkey_report_mode < 2) ? |
2024 | "enabled" : "disabled"); | 2107 | "enabled" : "disabled"); |
2025 | 2108 | ||
2026 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL | ||
2027 | tpacpi_inputdev->open = &hotkey_inputdev_open; | 2109 | tpacpi_inputdev->open = &hotkey_inputdev_open; |
2028 | tpacpi_inputdev->close = &hotkey_inputdev_close; | 2110 | tpacpi_inputdev->close = &hotkey_inputdev_close; |
2029 | 2111 | ||
2030 | hotkey_poll_setup_safe(1); | 2112 | hotkey_poll_setup_safe(1); |
2031 | #endif | 2113 | tpacpi_input_send_radiosw(); |
2114 | tpacpi_input_send_tabletsw(); | ||
2032 | } | 2115 | } |
2033 | 2116 | ||
2034 | return (tp_features.hotkey)? 0 : 1; | 2117 | return (tp_features.hotkey)? 0 : 1; |
@@ -2156,11 +2239,15 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event) | |||
2156 | /* 0x5000-0x5FFF: human interface helpers */ | 2239 | /* 0x5000-0x5FFF: human interface helpers */ |
2157 | switch (hkey) { | 2240 | switch (hkey) { |
2158 | case 0x5010: /* Lenovo new BIOS: brightness changed */ | 2241 | case 0x5010: /* Lenovo new BIOS: brightness changed */ |
2159 | case 0x5009: /* X61t: swivel up (tablet mode) */ | ||
2160 | case 0x500a: /* X61t: swivel down (normal mode) */ | ||
2161 | case 0x500b: /* X61t: tablet pen inserted into bay */ | 2242 | case 0x500b: /* X61t: tablet pen inserted into bay */ |
2162 | case 0x500c: /* X61t: tablet pen removed from bay */ | 2243 | case 0x500c: /* X61t: tablet pen removed from bay */ |
2163 | break; | 2244 | break; |
2245 | case 0x5009: /* X41t-X61t: swivel up (tablet mode) */ | ||
2246 | case 0x500a: /* X41t-X61t: swivel down (normal mode) */ | ||
2247 | tpacpi_input_send_tabletsw(); | ||
2248 | hotkey_tablet_mode_notify_change(); | ||
2249 | send_acpi_ev = 0; | ||
2250 | break; | ||
2164 | case 0x5001: | 2251 | case 0x5001: |
2165 | case 0x5002: | 2252 | case 0x5002: |
2166 | /* LID switch events. Do not propagate */ | 2253 | /* LID switch events. Do not propagate */ |
@@ -2219,11 +2306,10 @@ static void hotkey_resume(void) | |||
2219 | "from firmware\n"); | 2306 | "from firmware\n"); |
2220 | tpacpi_input_send_radiosw(); | 2307 | tpacpi_input_send_radiosw(); |
2221 | hotkey_radio_sw_notify_change(); | 2308 | hotkey_radio_sw_notify_change(); |
2309 | hotkey_tablet_mode_notify_change(); | ||
2222 | hotkey_wakeup_reason_notify_change(); | 2310 | hotkey_wakeup_reason_notify_change(); |
2223 | hotkey_wakeup_hotunplug_complete_notify_change(); | 2311 | hotkey_wakeup_hotunplug_complete_notify_change(); |
2224 | #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL | ||
2225 | hotkey_poll_setup_safe(0); | 2312 | hotkey_poll_setup_safe(0); |
2226 | #endif | ||
2227 | } | 2313 | } |
2228 | 2314 | ||
2229 | /* procfs -------------------------------------------------------------- */ | 2315 | /* procfs -------------------------------------------------------------- */ |
@@ -2676,6 +2762,8 @@ static struct ibm_struct wan_driver_data = { | |||
2676 | * Video subdriver | 2762 | * Video subdriver |
2677 | */ | 2763 | */ |
2678 | 2764 | ||
2765 | #ifdef CONFIG_THINKPAD_ACPI_VIDEO | ||
2766 | |||
2679 | enum video_access_mode { | 2767 | enum video_access_mode { |
2680 | TPACPI_VIDEO_NONE = 0, | 2768 | TPACPI_VIDEO_NONE = 0, |
2681 | TPACPI_VIDEO_570, /* 570 */ | 2769 | TPACPI_VIDEO_570, /* 570 */ |
@@ -2703,13 +2791,6 @@ static int video_orig_autosw; | |||
2703 | static int video_autosw_get(void); | 2791 | static int video_autosw_get(void); |
2704 | static int video_autosw_set(int enable); | 2792 | static int video_autosw_set(int enable); |
2705 | 2793 | ||
2706 | TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */ | ||
2707 | "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ | ||
2708 | "\\_SB.PCI0.VID0", /* 770e */ | ||
2709 | "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ | ||
2710 | "\\_SB.PCI0.AGP.VID", /* all others */ | ||
2711 | ); /* R30, R31 */ | ||
2712 | |||
2713 | TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ | 2794 | TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ |
2714 | 2795 | ||
2715 | static int __init video_init(struct ibm_init_struct *iibm) | 2796 | static int __init video_init(struct ibm_init_struct *iibm) |
@@ -3019,6 +3100,8 @@ static struct ibm_struct video_driver_data = { | |||
3019 | .exit = video_exit, | 3100 | .exit = video_exit, |
3020 | }; | 3101 | }; |
3021 | 3102 | ||
3103 | #endif /* CONFIG_THINKPAD_ACPI_VIDEO */ | ||
3104 | |||
3022 | /************************************************************************* | 3105 | /************************************************************************* |
3023 | * Light (thinklight) subdriver | 3106 | * Light (thinklight) subdriver |
3024 | */ | 3107 | */ |
@@ -5803,10 +5886,12 @@ static struct ibm_init_struct ibms_init[] __initdata = { | |||
5803 | .init = wan_init, | 5886 | .init = wan_init, |
5804 | .data = &wan_driver_data, | 5887 | .data = &wan_driver_data, |
5805 | }, | 5888 | }, |
5889 | #ifdef CONFIG_THINKPAD_ACPI_VIDEO | ||
5806 | { | 5890 | { |
5807 | .init = video_init, | 5891 | .init = video_init, |
5808 | .data = &video_driver_data, | 5892 | .data = &video_driver_data, |
5809 | }, | 5893 | }, |
5894 | #endif | ||
5810 | { | 5895 | { |
5811 | .init = light_init, | 5896 | .init = light_init, |
5812 | .data = &light_driver_data, | 5897 | .data = &light_driver_data, |
@@ -5918,7 +6003,7 @@ MODULE_PARM_DESC(hotkey_report_mode, | |||
5918 | 6003 | ||
5919 | #define TPACPI_PARAM(feature) \ | 6004 | #define TPACPI_PARAM(feature) \ |
5920 | module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ | 6005 | module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ |
5921 | MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \ | 6006 | MODULE_PARM_DESC(feature, "Simulates thinkpad-acpi procfs command " \ |
5922 | "at module load, see documentation") | 6007 | "at module load, see documentation") |
5923 | 6008 | ||
5924 | TPACPI_PARAM(hotkey); | 6009 | TPACPI_PARAM(hotkey); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 2f2d308c9aa3..4a23654184fc 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -242,8 +242,6 @@ EXPORT_SYMBOL(pci_osc_control_set); | |||
242 | * choose from highest power _SxD to lowest power _SxW | 242 | * choose from highest power _SxD to lowest power _SxW |
243 | * else // no _PRW at S-state x | 243 | * else // no _PRW at S-state x |
244 | * choose highest power _SxD or any lower power | 244 | * choose highest power _SxD or any lower power |
245 | * | ||
246 | * currently we simply return _SxD, if present. | ||
247 | */ | 245 | */ |
248 | 246 | ||
249 | static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev, | 247 | static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev, |
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c index e782b3e7fcdb..8b86e53ccf7a 100644 --- a/drivers/thermal/thermal.c +++ b/drivers/thermal/thermal.c | |||
@@ -306,12 +306,23 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, | |||
306 | { | 306 | { |
307 | struct thermal_cooling_device_instance *dev; | 307 | struct thermal_cooling_device_instance *dev; |
308 | struct thermal_cooling_device_instance *pos; | 308 | struct thermal_cooling_device_instance *pos; |
309 | struct thermal_zone_device *pos1; | ||
310 | struct thermal_cooling_device *pos2; | ||
309 | int result; | 311 | int result; |
310 | 312 | ||
311 | if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) | 313 | if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) |
312 | return -EINVAL; | 314 | return -EINVAL; |
313 | 315 | ||
314 | if (!tz || !cdev) | 316 | list_for_each_entry(pos1, &thermal_tz_list, node) { |
317 | if (pos1 == tz) | ||
318 | break; | ||
319 | } | ||
320 | list_for_each_entry(pos2, &thermal_cdev_list, node) { | ||
321 | if (pos2 == cdev) | ||
322 | break; | ||
323 | } | ||
324 | |||
325 | if (tz != pos1 || cdev != pos2) | ||
315 | return -EINVAL; | 326 | return -EINVAL; |
316 | 327 | ||
317 | dev = | 328 | dev = |
@@ -437,20 +448,20 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
437 | int result; | 448 | int result; |
438 | 449 | ||
439 | if (strlen(type) >= THERMAL_NAME_LENGTH) | 450 | if (strlen(type) >= THERMAL_NAME_LENGTH) |
440 | return NULL; | 451 | return ERR_PTR(-EINVAL); |
441 | 452 | ||
442 | if (!ops || !ops->get_max_state || !ops->get_cur_state || | 453 | if (!ops || !ops->get_max_state || !ops->get_cur_state || |
443 | !ops->set_cur_state) | 454 | !ops->set_cur_state) |
444 | return NULL; | 455 | return ERR_PTR(-EINVAL); |
445 | 456 | ||
446 | cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); | 457 | cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); |
447 | if (!cdev) | 458 | if (!cdev) |
448 | return NULL; | 459 | return ERR_PTR(-ENOMEM); |
449 | 460 | ||
450 | result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); | 461 | result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); |
451 | if (result) { | 462 | if (result) { |
452 | kfree(cdev); | 463 | kfree(cdev); |
453 | return NULL; | 464 | return ERR_PTR(result); |
454 | } | 465 | } |
455 | 466 | ||
456 | strcpy(cdev->type, type); | 467 | strcpy(cdev->type, type); |
@@ -462,7 +473,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
462 | if (result) { | 473 | if (result) { |
463 | release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); | 474 | release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); |
464 | kfree(cdev); | 475 | kfree(cdev); |
465 | return NULL; | 476 | return ERR_PTR(result); |
466 | } | 477 | } |
467 | 478 | ||
468 | /* sys I/F */ | 479 | /* sys I/F */ |
@@ -498,7 +509,7 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type, | |||
498 | unregister: | 509 | unregister: |
499 | release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); | 510 | release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); |
500 | device_unregister(&cdev->device); | 511 | device_unregister(&cdev->device); |
501 | return NULL; | 512 | return ERR_PTR(result); |
502 | } | 513 | } |
503 | 514 | ||
504 | EXPORT_SYMBOL(thermal_cooling_device_register); | 515 | EXPORT_SYMBOL(thermal_cooling_device_register); |
@@ -570,17 +581,17 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
570 | int count; | 581 | int count; |
571 | 582 | ||
572 | if (strlen(type) >= THERMAL_NAME_LENGTH) | 583 | if (strlen(type) >= THERMAL_NAME_LENGTH) |
573 | return NULL; | 584 | return ERR_PTR(-EINVAL); |
574 | 585 | ||
575 | if (trips > THERMAL_MAX_TRIPS || trips < 0) | 586 | if (trips > THERMAL_MAX_TRIPS || trips < 0) |
576 | return NULL; | 587 | return ERR_PTR(-EINVAL); |
577 | 588 | ||
578 | if (!ops || !ops->get_temp) | 589 | if (!ops || !ops->get_temp) |
579 | return NULL; | 590 | return ERR_PTR(-EINVAL); |
580 | 591 | ||
581 | tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); | 592 | tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); |
582 | if (!tz) | 593 | if (!tz) |
583 | return NULL; | 594 | return ERR_PTR(-ENOMEM); |
584 | 595 | ||
585 | INIT_LIST_HEAD(&tz->cooling_devices); | 596 | INIT_LIST_HEAD(&tz->cooling_devices); |
586 | idr_init(&tz->idr); | 597 | idr_init(&tz->idr); |
@@ -588,7 +599,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
588 | result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); | 599 | result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); |
589 | if (result) { | 600 | if (result) { |
590 | kfree(tz); | 601 | kfree(tz); |
591 | return NULL; | 602 | return ERR_PTR(result); |
592 | } | 603 | } |
593 | 604 | ||
594 | strcpy(tz->type, type); | 605 | strcpy(tz->type, type); |
@@ -601,7 +612,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
601 | if (result) { | 612 | if (result) { |
602 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); | 613 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); |
603 | kfree(tz); | 614 | kfree(tz); |
604 | return NULL; | 615 | return ERR_PTR(result); |
605 | } | 616 | } |
606 | 617 | ||
607 | /* sys I/F */ | 618 | /* sys I/F */ |
@@ -643,7 +654,7 @@ struct thermal_zone_device *thermal_zone_device_register(char *type, | |||
643 | unregister: | 654 | unregister: |
644 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); | 655 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); |
645 | device_unregister(&tz->device); | 656 | device_unregister(&tz->device); |
646 | return NULL; | 657 | return ERR_PTR(result); |
647 | } | 658 | } |
648 | 659 | ||
649 | EXPORT_SYMBOL(thermal_zone_device_register); | 660 | EXPORT_SYMBOL(thermal_zone_device_register); |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 26c7124b841a..3b3e1341163f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1171,12 +1171,18 @@ static inline void enable_debug_pagealloc(void) | |||
1171 | { | 1171 | { |
1172 | debug_pagealloc_enabled = 1; | 1172 | debug_pagealloc_enabled = 1; |
1173 | } | 1173 | } |
1174 | #ifdef CONFIG_HIBERNATION | ||
1175 | extern bool kernel_page_present(struct page *page); | ||
1176 | #endif /* CONFIG_HIBERNATION */ | ||
1174 | #else | 1177 | #else |
1175 | static inline void | 1178 | static inline void |
1176 | kernel_map_pages(struct page *page, int numpages, int enable) {} | 1179 | kernel_map_pages(struct page *page, int numpages, int enable) {} |
1177 | static inline void enable_debug_pagealloc(void) | 1180 | static inline void enable_debug_pagealloc(void) |
1178 | { | 1181 | { |
1179 | } | 1182 | } |
1183 | #ifdef CONFIG_HIBERNATION | ||
1184 | static inline bool kernel_page_present(struct page *page) { return true; } | ||
1185 | #endif /* CONFIG_HIBERNATION */ | ||
1180 | #endif | 1186 | #endif |
1181 | 1187 | ||
1182 | extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); | 1188 | extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk); |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 95250d7c8d91..72a020cabb4c 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
@@ -875,8 +875,8 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; } | |||
875 | #endif /* CONFIG_HIGHMEM */ | 875 | #endif /* CONFIG_HIGHMEM */ |
876 | 876 | ||
877 | /** | 877 | /** |
878 | * saveable - Determine whether a non-highmem page should be included in | 878 | * saveable_page - Determine whether a non-highmem page should be included |
879 | * the suspend image. | 879 | * in the suspend image. |
880 | * | 880 | * |
881 | * We should save the page if it isn't Nosave, and is not in the range | 881 | * We should save the page if it isn't Nosave, and is not in the range |
882 | * of pages statically defined as 'unsaveable', and it isn't a part of | 882 | * of pages statically defined as 'unsaveable', and it isn't a part of |
@@ -897,7 +897,8 @@ static struct page *saveable_page(unsigned long pfn) | |||
897 | if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) | 897 | if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) |
898 | return NULL; | 898 | return NULL; |
899 | 899 | ||
900 | if (PageReserved(page) && pfn_is_nosave(pfn)) | 900 | if (PageReserved(page) |
901 | && (!kernel_page_present(page) || pfn_is_nosave(pfn))) | ||
901 | return NULL; | 902 | return NULL; |
902 | 903 | ||
903 | return page; | 904 | return page; |
@@ -938,6 +939,25 @@ static inline void do_copy_page(long *dst, long *src) | |||
938 | *dst++ = *src++; | 939 | *dst++ = *src++; |
939 | } | 940 | } |
940 | 941 | ||
942 | |||
943 | /** | ||
944 | * safe_copy_page - check if the page we are going to copy is marked as | ||
945 | * present in the kernel page tables (this always is the case if | ||
946 | * CONFIG_DEBUG_PAGEALLOC is not set and in that case | ||
947 | * kernel_page_present() always returns 'true'). | ||
948 | */ | ||
949 | static void safe_copy_page(void *dst, struct page *s_page) | ||
950 | { | ||
951 | if (kernel_page_present(s_page)) { | ||
952 | do_copy_page(dst, page_address(s_page)); | ||
953 | } else { | ||
954 | kernel_map_pages(s_page, 1, 1); | ||
955 | do_copy_page(dst, page_address(s_page)); | ||
956 | kernel_map_pages(s_page, 1, 0); | ||
957 | } | ||
958 | } | ||
959 | |||
960 | |||
941 | #ifdef CONFIG_HIGHMEM | 961 | #ifdef CONFIG_HIGHMEM |
942 | static inline struct page * | 962 | static inline struct page * |
943 | page_is_saveable(struct zone *zone, unsigned long pfn) | 963 | page_is_saveable(struct zone *zone, unsigned long pfn) |
@@ -946,8 +966,7 @@ page_is_saveable(struct zone *zone, unsigned long pfn) | |||
946 | saveable_highmem_page(pfn) : saveable_page(pfn); | 966 | saveable_highmem_page(pfn) : saveable_page(pfn); |
947 | } | 967 | } |
948 | 968 | ||
949 | static inline void | 969 | static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) |
950 | copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | ||
951 | { | 970 | { |
952 | struct page *s_page, *d_page; | 971 | struct page *s_page, *d_page; |
953 | void *src, *dst; | 972 | void *src, *dst; |
@@ -961,29 +980,26 @@ copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | |||
961 | kunmap_atomic(src, KM_USER0); | 980 | kunmap_atomic(src, KM_USER0); |
962 | kunmap_atomic(dst, KM_USER1); | 981 | kunmap_atomic(dst, KM_USER1); |
963 | } else { | 982 | } else { |
964 | src = page_address(s_page); | ||
965 | if (PageHighMem(d_page)) { | 983 | if (PageHighMem(d_page)) { |
966 | /* Page pointed to by src may contain some kernel | 984 | /* Page pointed to by src may contain some kernel |
967 | * data modified by kmap_atomic() | 985 | * data modified by kmap_atomic() |
968 | */ | 986 | */ |
969 | do_copy_page(buffer, src); | 987 | safe_copy_page(buffer, s_page); |
970 | dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); | 988 | dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); |
971 | memcpy(dst, buffer, PAGE_SIZE); | 989 | memcpy(dst, buffer, PAGE_SIZE); |
972 | kunmap_atomic(dst, KM_USER0); | 990 | kunmap_atomic(dst, KM_USER0); |
973 | } else { | 991 | } else { |
974 | dst = page_address(d_page); | 992 | safe_copy_page(page_address(d_page), s_page); |
975 | do_copy_page(dst, src); | ||
976 | } | 993 | } |
977 | } | 994 | } |
978 | } | 995 | } |
979 | #else | 996 | #else |
980 | #define page_is_saveable(zone, pfn) saveable_page(pfn) | 997 | #define page_is_saveable(zone, pfn) saveable_page(pfn) |
981 | 998 | ||
982 | static inline void | 999 | static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) |
983 | copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) | ||
984 | { | 1000 | { |
985 | do_copy_page(page_address(pfn_to_page(dst_pfn)), | 1001 | safe_copy_page(page_address(pfn_to_page(dst_pfn)), |
986 | page_address(pfn_to_page(src_pfn))); | 1002 | pfn_to_page(src_pfn)); |
987 | } | 1003 | } |
988 | #endif /* CONFIG_HIGHMEM */ | 1004 | #endif /* CONFIG_HIGHMEM */ |
989 | 1005 | ||