Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
...

+322 -124
+38 -25
Documentation/laptops/thinkpad-acpi.txt
··· 160 160 procfs: /proc/acpi/ibm/hotkey 161 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 164 some important events and also keyboard hot key presses to the operating 165 165 system. Enabling the hotkey functionality of thinkpad-acpi signals the 166 166 firmware that such a driver is present, and modifies how the ThinkPad ··· 193 193 modified do anything. Not all hot keys can be individually controlled 194 194 by the mask. Some models do not support the mask at all, and in those 195 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 198 Note that unmasking some keys prevents their default behavior. For 199 199 example, if Fn+F5 is unmasked, that key will no longer enable/disable ··· 288 288 in ACPI event mode, volume up/down/mute are reported as 289 289 separate events, but this behaviour may be corrected in 290 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 292 enforced. 293 293 294 294 hotkey_poll_freq: ··· 306 306 The recommended polling frequency is 10Hz. 307 307 308 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 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 312 "radios enabled" position. 313 + 314 + This attribute has poll()/select() support. 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. 313 320 314 321 This attribute has poll()/select() support. 315 322 ··· 346 339 wakeup_hotunplug_complete: 347 340 Set to 1 if the system was waken up because of an 348 341 undock or bay ejection request, and that request 349 - was sucessfully completed. At this point, it might 342 + was successfully completed. At this point, it might 350 343 be useful to send the system back to sleep, at the 351 344 user's choice. Refer to HKEY events 0x4003 and 352 345 0x3003, below. ··· 399 392 Lenovo: battery 400 393 401 394 0x1004 0x03 FN+F4 Sleep button (ACPI sleep button 402 - semanthics, i.e. sleep-to-RAM). 395 + semantics, i.e. sleep-to-RAM). 403 396 It is always generate some kind 404 397 of event, either the hot key 405 398 event or a ACPI sleep button ··· 410 403 time passes. 411 404 412 405 0x1005 0x04 FN+F5 Radio. Enables/disables 413 - the internal BlueTooth hardware 406 + the internal Bluetooth hardware 414 407 and W-WAN card if left in control 415 408 of the firmware. Does not affect 416 409 the WLAN card. 417 410 Should be used to turn on/off all 418 - radios (bluetooth+W-WAN+WLAN), 411 + radios (Bluetooth+W-WAN+WLAN), 419 412 really. 420 413 421 414 0x1006 0x05 FN+F6 - ··· 424 417 Do you feel lucky today? 425 418 426 419 0x1008 0x07 FN+F8 IBM: toggle screen expand 427 - Lenovo: configure ultranav 420 + Lenovo: configure UltraNav 428 421 429 422 0x1009 0x08 FN+F9 - 430 423 .. .. .. ··· 454 447 0x1011 0x10 FN+END Brightness down. See brightness 455 448 up for details. 456 449 457 - 0x1012 0x11 FN+PGUP Thinklight toggle. This key is 450 + 0x1012 0x11 FN+PGUP ThinkLight toggle. This key is 458 451 always handled by the firmware, 459 452 even when unmasked. 460 453 ··· 476 469 key is always handled by the 477 470 firmware, even when unmasked. 478 471 479 - 0x1018 0x17 THINKPAD Thinkpad/Access IBM/Lenovo key 472 + 0x1018 0x17 THINKPAD ThinkPad/Access IBM/Lenovo key 480 473 481 474 0x1019 0x18 unknown 482 475 .. .. .. ··· 495 488 includes an scan code. If a key is mapped to anything else, it will 496 489 generate input device EV_KEY events. 497 490 491 + In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW 492 + events for switches: 493 + 494 + SW_RADIO T60 and later hardare rfkill rocker switch 495 + SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A 496 + 498 497 Non hot-key ACPI HKEY event map: 499 498 0x5001 Lid closed 500 499 0x5002 Lid opened 500 + 0x5009 Tablet swivel: switched to tablet mode 501 + 0x500A Tablet swivel: switched to normal mode 501 502 0x7000 Radio Switch may have changed state 502 503 503 504 The above events are not propagated by the driver, except for legacy ··· 520 505 521 506 0x3003 Bay ejection (see 0x2x05) complete, can sleep again 522 507 0x4003 Undocked (see 0x2x04), can sleep again 523 - 0x5009 Tablet swivel: switched to tablet mode 524 - 0x500A Tablet swivel: switched to normal mode 525 - 0x500B Tablet pen insterted into its storage bay 508 + 0x500B Tablet pen inserted into its storage bay 526 509 0x500C Tablet pen removed from its storage bay 527 510 0x5010 Brightness level changed (newer Lenovo BIOSes) 528 511 ··· 552 539 If the hotkey_report_mode module parameter is set to 1 or 2, it cannot 553 540 be changed later through sysfs (any writes will return -EPERM to signal 554 541 that hotkey_report_mode was locked. On 2.6.23 and later, where 555 - hotkey_report_mode cannot be changed at all, writes will return -EACES). 542 + hotkey_report_mode cannot be changed at all, writes will return -EACCES). 556 543 557 544 hotkey_report_mode set to 1 makes the driver export through the procfs 558 545 ACPI event interface all hot key presses (which are *also* sent to the ··· 597 584 0: disables Bluetooth / Bluetooth is disabled 598 585 1: enables Bluetooth / Bluetooth is enabled. 599 586 600 - Note: this interface will be probably be superseeded by the 587 + Note: this interface will be probably be superseded by the 601 588 generic rfkill class, so it is NOT to be considered stable yet. 602 589 603 590 Video output control -- /proc/acpi/ibm/video ··· 804 791 1 - Related to "Volume up" key press 805 792 2 - Related to "Mute on" key press 806 793 3 - Related to "Access IBM" key press 807 - 4 - Related to "LCD brightness up" key pess 794 + 4 - Related to "LCD brightness up" key press 808 795 5 - Related to "LCD brightness down" key press 809 796 11 - Related to "toggle screen expansion" key press/function 810 797 12 - Related to "ThinkLight on" 811 798 13 - Related to "ThinkLight off" 812 - 14 - Related to "ThinkLight" key press (toggle thinklight) 799 + 14 - Related to "ThinkLight" key press (toggle ThinkLight) 813 800 814 801 The cmos command interface is prone to firmware split-brain problems, as 815 802 in newer ThinkPads it is just a compatibility layer. Do not use it, it is ··· 1037 1024 EC and CMOS. To select which one should be used, use the 1038 1025 brightness_mode module parameter: brightness_mode=1 selects EC mode, 1039 1026 brightness_mode=2 selects CMOS mode, brightness_mode=3 selects both EC 1040 - and CMOS. The driver tries to autodetect which interface to use. 1027 + and CMOS. The driver tries to auto-detect which interface to use. 1041 1028 1042 1029 When display backlight brightness controls are available through the 1043 1030 standard ACPI interface, it is best to use it instead of this direct ··· 1279 1266 This feature shows the presence and current state of a W-WAN (Sierra 1280 1267 Wireless EV-DO) device. 1281 1268 1282 - It was tested on a Lenovo Thinkpad X60. It should probably work on other 1283 - Thinkpad models which come with this module installed. 1269 + It was tested on a Lenovo ThinkPad X60. It should probably work on other 1270 + ThinkPad models which come with this module installed. 1284 1271 1285 1272 Procfs notes: 1286 1273 ··· 1299 1286 0: disables WWAN card / WWAN card is disabled 1300 1287 1: enables WWAN card / WWAN card is enabled. 1301 1288 1302 - Note: this interface will be probably be superseeded by the 1289 + Note: this interface will be probably be superseded by the 1303 1290 generic rfkill class, so it is NOT to be considered stable yet. 1304 1291 1305 1292 Multiple Commands, Module Parameters ··· 1322 1309 The module takes a debug parameter which can be used to selectively 1323 1310 enable various classes of debugging output, for example: 1324 1311 1325 - modprobe ibm_acpi debug=0xffff 1312 + modprobe thinkpad_acpi debug=0xffff 1326 1313 1327 1314 will enable all debugging output classes. It takes a bitmask, so 1328 1315 to enable more than one output class, just add their values. ··· 1369 1356 NVRAM is compiled out by the user because it is 1370 1357 unneeded/undesired in the first place). 1371 1358 0x020101: Marker for thinkpad-acpi with hot key NVRAM polling 1372 - and proper hotkey_mask semanthics (version 8 of the 1359 + and proper hotkey_mask semantics (version 8 of the 1373 1360 NVRAM polling patch). Some development snapshots of 1374 1361 0.18 had an earlier version that did strange things 1375 1362 to hotkey_mask.
+18 -1
arch/x86/mm/pageattr.c
··· 899 899 */ 900 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 922 * The testcases use internal knowledge of the implementation that shouldn't
+5 -1
drivers/acpi/ec.c
··· 943 943 boot_ec->command_addr = ecdt_ptr->control.address; 944 944 boot_ec->data_addr = ecdt_ptr->data.address; 945 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 951 } else { 948 952 /* This workaround is needed only on some broken machines, 949 953 * which require early EC, but fail to provide ECDT */
+3 -2
drivers/acpi/executer/exregion.c
··· 338 338 acpi_status status = AE_OK; 339 339 struct acpi_pci_id *pci_id; 340 340 u16 pci_register; 341 + u32 value32; 341 342 342 343 ACPI_FUNCTION_TRACE(ex_pci_config_space_handler); 343 344 ··· 365 364 switch (function) { 366 365 case ACPI_READ: 367 366 368 - *value = 0; 369 367 status = acpi_os_read_pci_configuration(pci_id, pci_register, 370 - value, bit_width); 368 + &value32, bit_width); 369 + *value = value32; 371 370 break; 372 371 373 372 case ACPI_WRITE:
+18 -12
drivers/acpi/fan.c
··· 256 256 257 257 cdev = thermal_cooling_device_register("Fan", device, 258 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 264 printk(KERN_INFO PREFIX 261 265 "%s is registered as cooling_device%d\n", 262 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, 272 - "device"); 273 - if (result) 274 - return result; 268 + acpi_driver_data(device) = cdev; 269 + result = sysfs_create_link(&device->dev.kobj, 270 + &cdev->device.kobj, 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 282 result = acpi_fan_add_fs(device); 277 283 if (result)
+22 -17
drivers/acpi/processor_core.c
··· 670 670 671 671 pr->cdev = thermal_cooling_device_register("Processor", device, 672 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 678 printk(KERN_INFO PREFIX 675 679 "%s is registered as cooling_device%d\n", 676 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, 681 - "thermal_cooling"); 682 - if (result) 683 - return result; 684 - result = sysfs_create_link(&pr->cdev->device.kobj, &device->dev.kobj, 685 - "device"); 686 - if (result) 687 - return result; 682 + result = sysfs_create_link(&device->dev.kobj, 683 + &pr->cdev->device.kobj, 684 + "thermal_cooling"); 685 + if (result) 686 + return result; 687 + result = sysfs_create_link(&pr->cdev->device.kobj, 688 + &device->dev.kobj, 689 + "device"); 690 + if (result) 691 + return result; 692 + } 688 693 689 694 if (pr->flags.throttling) { 690 695 printk(KERN_INFO PREFIX "%s [%s] (supports", ··· 814 809 815 810 acpi_processor_remove_fs(device); 816 811 817 - sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 818 - sysfs_remove_link(&pr->cdev->device.kobj, "device"); 819 - thermal_cooling_device_unregister(pr->cdev); 820 - pr->cdev = NULL; 812 + if (pr->cdev) { 813 + sysfs_remove_link(&device->dev.kobj, "thermal_cooling"); 814 + sysfs_remove_link(&pr->cdev->device.kobj, "device"); 815 + thermal_cooling_device_unregister(pr->cdev); 816 + pr->cdev = NULL; 817 + } 821 818 822 819 processors[pr->id] = NULL; 823 820 ··· 832 825 /**************************************************************************** 833 826 * Acpi processor hotplug support * 834 827 ****************************************************************************/ 835 - 836 - static int is_processor_present(acpi_handle handle); 837 828 838 829 static int is_processor_present(acpi_handle handle) 839 830 {
+5 -5
drivers/acpi/processor_idle.c
··· 364 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 368 static int tsc_halts_in_c(int state) 369 369 { 370 370 switch (boot_cpu_data.x86_vendor) { ··· 544 544 /* Get end time (ticks) */ 545 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 548 /* TSC halts in C2, so notify users */ 549 549 if (tsc_halts_in_c(ACPI_STATE_C2)) 550 550 mark_tsc_unstable("possible TSC halt in C2"); ··· 609 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 613 /* TSC halts in C3, so notify users */ 614 614 if (tsc_halts_in_c(ACPI_STATE_C3)) 615 615 mark_tsc_unstable("TSC halts in C3"); ··· 1500 1500 acpi_idle_do_entry(cx); 1501 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 1504 /* TSC could halt in idle, so notify users */ 1505 1505 if (tsc_halts_in_c(cx->type)) 1506 1506 mark_tsc_unstable("TSC halts in idle");; ··· 1614 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 1618 /* TSC could halt in idle, so notify users */ 1619 1619 if (tsc_halts_in_c(ACPI_STATE_C3)) 1620 1620 mark_tsc_unstable("TSC halts in idle");
+11 -7
drivers/acpi/utils.c
··· 36 36 /* -------------------------------------------------------------------------- 37 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 42 #ifdef ACPI_DEBUG_OUTPUT 40 - #define acpi_util_eval_error(h,p,s) {\ 41 - char prefix[80] = {'\0'};\ 42 - struct acpi_buffer buffer = {sizeof(prefix), prefix};\ 43 - acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer);\ 44 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n",\ 45 - (char *) prefix, p, acpi_format_exception(s))); } 43 + char prefix[80] = {'\0'}; 44 + struct acpi_buffer buffer = {sizeof(prefix), prefix}; 45 + acpi_get_name(h, ACPI_FULL_PATHNAME, &buffer); 46 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluate [%s.%s]: %s\n", 47 + (char *) prefix, p, acpi_format_exception(s))); 46 48 #else 47 - #define acpi_util_eval_error(h,p,s) 49 + return; 48 50 #endif 51 + } 52 + 49 53 acpi_status 50 54 acpi_extract_package(union acpi_object *package, 51 55 struct acpi_buffer *format, struct acpi_buffer *buffer)
+3
drivers/acpi/video.c
··· 731 731 732 732 device->cdev = thermal_cooling_device_register("LCD", 733 733 device->dev, &video_cooling_ops); 734 + if (IS_ERR(device->cdev)) 735 + return; 736 + 734 737 if (device->cdev) { 735 738 printk(KERN_INFO PREFIX 736 739 "%s is registered as cooling_device%d\n",
+1 -1
drivers/base/power/main.c
··· 415 415 * @dev: Device. 416 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 420 int error = 0; 421 421
+17
drivers/misc/Kconfig
··· 258 258 259 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 278 config THINKPAD_ACPI_HOTKEY_POLL 262 279 bool "Suport NVRAM polling for hot keys" 263 280 depends on THINKPAD_ACPI
+9
drivers/misc/acer-wmi.c
··· 273 273 }, 274 274 { 275 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 285 .ident = "Medion MD 98300", 277 286 .matches = { 278 287 DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
+7 -4
drivers/misc/intel_menlow.c
··· 170 170 171 171 cdev = thermal_cooling_device_register("Memory controller", device, 172 172 &memory_cooling_ops); 173 - acpi_driver_data(device) = cdev; 174 - if (!cdev) 175 - result = -ENODEV; 176 - else { 173 + if (IS_ERR(cdev)) { 174 + result = PTR_ERR(cdev); 175 + goto end; 176 + } 177 + 178 + if (cdev) { 179 + acpi_driver_data(device) = cdev; 177 180 result = sysfs_create_link(&device->dev.kobj, 178 181 &cdev->device.kobj, "thermal_cooling"); 179 182 if (result)
+105 -20
drivers/misc/thinkpad_acpi.c
··· 221 221 u32 hotkey:1; 222 222 u32 hotkey_mask:1; 223 223 u32 hotkey_wlsw:1; 224 + u32 hotkey_tablet:1; 224 225 u32 light:1; 225 226 u32 light_status:1; 226 227 u32 bright_16levels:1; ··· 301 300 "^HKEY", /* R30, R31 */ 302 301 "HKEY", /* all others */ 303 302 ); /* 570 */ 303 + 304 + TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */ 305 + "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ 306 + "\\_SB.PCI0.VID0", /* 770e */ 307 + "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ 308 + "\\_SB.PCI0.AGP.VID", /* all others */ 309 + ); /* R30, R31 */ 304 310 305 311 306 312 /************************************************************************* ··· 1061 1053 #define HOTKEY_CONFIG_CRITICAL_END 1062 1054 #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1063 1055 1056 + /* HKEY.MHKG() return bits */ 1057 + #define TP_HOTKEY_TABLET_MASK (1 << 3) 1058 + 1064 1059 static int hotkey_get_wlsw(int *status) 1065 1060 { 1066 1061 if (!acpi_evalf(hkey_handle, status, "WLSW", "d")) 1067 1062 return -EIO; 1068 1063 return 0; 1064 + } 1065 + 1066 + static int hotkey_get_tablet_mode(int *status) 1067 + { 1068 + int s; 1069 + 1070 + if (!acpi_evalf(hkey_handle, &s, "MHKG", "d")) 1071 + return -EIO; 1072 + 1073 + return ((s & TP_HOTKEY_TABLET_MASK) != 0); 1069 1074 } 1070 1075 1071 1076 /* ··· 1175 1154 { 1176 1155 int wlsw; 1177 1156 1178 - mutex_lock(&tpacpi_inputdev_send_mutex); 1179 - 1180 1157 if (tp_features.hotkey_wlsw && !hotkey_get_wlsw(&wlsw)) { 1158 + mutex_lock(&tpacpi_inputdev_send_mutex); 1159 + 1181 1160 input_report_switch(tpacpi_inputdev, 1182 1161 SW_RADIO, !!wlsw); 1183 1162 input_sync(tpacpi_inputdev); 1184 - } 1185 1163 1186 - mutex_unlock(&tpacpi_inputdev_send_mutex); 1164 + mutex_unlock(&tpacpi_inputdev_send_mutex); 1165 + } 1166 + } 1167 + 1168 + static void tpacpi_input_send_tabletsw(void) 1169 + { 1170 + int state; 1171 + 1172 + if (tp_features.hotkey_tablet && 1173 + !hotkey_get_tablet_mode(&state)) { 1174 + mutex_lock(&tpacpi_inputdev_send_mutex); 1175 + 1176 + input_report_switch(tpacpi_inputdev, 1177 + SW_TABLET_MODE, !!state); 1178 + input_sync(tpacpi_inputdev); 1179 + 1180 + mutex_unlock(&tpacpi_inputdev_send_mutex); 1181 + } 1187 1182 } 1188 1183 1189 1184 static void tpacpi_input_send_key(unsigned int scancode) ··· 1454 1417 mutex_unlock(&hotkey_mutex); 1455 1418 } 1456 1419 1420 + #else /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1421 + 1422 + static void hotkey_poll_setup_safe(int __unused) 1423 + { 1424 + } 1425 + 1426 + #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1427 + 1457 1428 static int hotkey_inputdev_open(struct input_dev *dev) 1458 1429 { 1459 1430 switch (tpacpi_lifecycle) { ··· 1489 1444 if (tpacpi_lifecycle == TPACPI_LIFE_RUNNING) 1490 1445 hotkey_poll_setup_safe(0); 1491 1446 } 1492 - #endif /* CONFIG_THINKPAD_ACPI_HOTKEY_POLL */ 1493 1447 1494 1448 /* sysfs hotkey enable ------------------------------------------------- */ 1495 1449 static ssize_t hotkey_enable_show(struct device *dev, ··· 1710 1666 "hotkey_radio_sw"); 1711 1667 } 1712 1668 1669 + /* sysfs hotkey tablet mode (pollable) --------------------------------- */ 1670 + static ssize_t hotkey_tablet_mode_show(struct device *dev, 1671 + struct device_attribute *attr, 1672 + char *buf) 1673 + { 1674 + int res, s; 1675 + res = hotkey_get_tablet_mode(&s); 1676 + if (res < 0) 1677 + return res; 1678 + 1679 + return snprintf(buf, PAGE_SIZE, "%d\n", !!s); 1680 + } 1681 + 1682 + static struct device_attribute dev_attr_hotkey_tablet_mode = 1683 + __ATTR(hotkey_tablet_mode, S_IRUGO, hotkey_tablet_mode_show, NULL); 1684 + 1685 + static void hotkey_tablet_mode_notify_change(void) 1686 + { 1687 + if (tp_features.hotkey_tablet) 1688 + sysfs_notify(&tpacpi_pdev->dev.kobj, NULL, 1689 + "hotkey_tablet_mode"); 1690 + } 1691 + 1713 1692 /* sysfs hotkey report_mode -------------------------------------------- */ 1714 1693 static ssize_t hotkey_report_mode_show(struct device *dev, 1715 1694 struct device_attribute *attr, ··· 1945 1878 str_supported(tp_features.hotkey)); 1946 1879 1947 1880 if (tp_features.hotkey) { 1948 - hotkey_dev_attributes = create_attr_set(12, NULL); 1881 + hotkey_dev_attributes = create_attr_set(13, NULL); 1949 1882 if (!hotkey_dev_attributes) 1950 1883 return -ENOMEM; 1951 1884 res = add_many_to_attr_set(hotkey_dev_attributes, ··· 2024 1957 &dev_attr_hotkey_radio_sw.attr); 2025 1958 } 2026 1959 1960 + /* For X41t, X60t, X61t Tablets... */ 1961 + if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { 1962 + tp_features.hotkey_tablet = 1; 1963 + printk(TPACPI_INFO 1964 + "possible tablet mode switch found; " 1965 + "ThinkPad in %s mode\n", 1966 + (status & TP_HOTKEY_TABLET_MASK)? 1967 + "tablet" : "laptop"); 1968 + res = add_to_attr_set(hotkey_dev_attributes, 1969 + &dev_attr_hotkey_tablet_mode.attr); 1970 + } 1971 + 2027 1972 if (!res) 2028 1973 res = register_attr_set_with_sysfs( 2029 1974 hotkey_dev_attributes, ··· 2085 2006 set_bit(EV_SW, tpacpi_inputdev->evbit); 2086 2007 set_bit(SW_RADIO, tpacpi_inputdev->swbit); 2087 2008 } 2009 + if (tp_features.hotkey_tablet) { 2010 + set_bit(EV_SW, tpacpi_inputdev->evbit); 2011 + set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit); 2012 + } 2088 2013 2089 2014 dbg_printk(TPACPI_DBG_INIT, 2090 2015 "enabling hot key handling\n"); ··· 2106 2023 (hotkey_report_mode < 2) ? 2107 2024 "enabled" : "disabled"); 2108 2025 2109 - #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2110 2026 tpacpi_inputdev->open = &hotkey_inputdev_open; 2111 2027 tpacpi_inputdev->close = &hotkey_inputdev_close; 2112 2028 2113 2029 hotkey_poll_setup_safe(1); 2114 - #endif 2030 + tpacpi_input_send_radiosw(); 2031 + tpacpi_input_send_tabletsw(); 2115 2032 } 2116 2033 2117 2034 return (tp_features.hotkey)? 0 : 1; ··· 2239 2156 /* 0x5000-0x5FFF: human interface helpers */ 2240 2157 switch (hkey) { 2241 2158 case 0x5010: /* Lenovo new BIOS: brightness changed */ 2242 - case 0x5009: /* X61t: swivel up (tablet mode) */ 2243 - case 0x500a: /* X61t: swivel down (normal mode) */ 2244 2159 case 0x500b: /* X61t: tablet pen inserted into bay */ 2245 2160 case 0x500c: /* X61t: tablet pen removed from bay */ 2161 + break; 2162 + case 0x5009: /* X41t-X61t: swivel up (tablet mode) */ 2163 + case 0x500a: /* X41t-X61t: swivel down (normal mode) */ 2164 + tpacpi_input_send_tabletsw(); 2165 + hotkey_tablet_mode_notify_change(); 2166 + send_acpi_ev = 0; 2246 2167 break; 2247 2168 case 0x5001: 2248 2169 case 0x5002: ··· 2306 2219 "from firmware\n"); 2307 2220 tpacpi_input_send_radiosw(); 2308 2221 hotkey_radio_sw_notify_change(); 2222 + hotkey_tablet_mode_notify_change(); 2309 2223 hotkey_wakeup_reason_notify_change(); 2310 2224 hotkey_wakeup_hotunplug_complete_notify_change(); 2311 - #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2312 2225 hotkey_poll_setup_safe(0); 2313 - #endif 2314 2226 } 2315 2227 2316 2228 /* procfs -------------------------------------------------------------- */ ··· 2762 2676 * Video subdriver 2763 2677 */ 2764 2678 2679 + #ifdef CONFIG_THINKPAD_ACPI_VIDEO 2680 + 2765 2681 enum video_access_mode { 2766 2682 TPACPI_VIDEO_NONE = 0, 2767 2683 TPACPI_VIDEO_570, /* 570 */ ··· 2790 2702 2791 2703 static int video_autosw_get(void); 2792 2704 static int video_autosw_set(int enable); 2793 - 2794 - TPACPI_HANDLE(vid, root, "\\_SB.PCI.AGP.VGA", /* 570 */ 2795 - "\\_SB.PCI0.AGP0.VID0", /* 600e/x, 770x */ 2796 - "\\_SB.PCI0.VID0", /* 770e */ 2797 - "\\_SB.PCI0.VID", /* A21e, G4x, R50e, X30, X40 */ 2798 - "\\_SB.PCI0.AGP.VID", /* all others */ 2799 - ); /* R30, R31 */ 2800 2705 2801 2706 TPACPI_HANDLE(vid2, root, "\\_SB.PCI0.AGPB.VID"); /* G41 */ 2802 2707 ··· 3099 3018 .write = video_write, 3100 3019 .exit = video_exit, 3101 3020 }; 3021 + 3022 + #endif /* CONFIG_THINKPAD_ACPI_VIDEO */ 3102 3023 3103 3024 /************************************************************************* 3104 3025 * Light (thinklight) subdriver ··· 5886 5803 .init = wan_init, 5887 5804 .data = &wan_driver_data, 5888 5805 }, 5806 + #ifdef CONFIG_THINKPAD_ACPI_VIDEO 5889 5807 { 5890 5808 .init = video_init, 5891 5809 .data = &video_driver_data, 5892 5810 }, 5811 + #endif 5893 5812 { 5894 5813 .init = light_init, 5895 5814 .data = &light_driver_data, ··· 6003 5918 6004 5919 #define TPACPI_PARAM(feature) \ 6005 5920 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ 6006 - MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \ 5921 + MODULE_PARM_DESC(feature, "Simulates thinkpad-acpi procfs command " \ 6007 5922 "at module load, see documentation") 6008 5923 6009 5924 TPACPI_PARAM(hotkey);
-2
drivers/pci/pci-acpi.c
··· 242 242 * choose from highest power _SxD to lowest power _SxW 243 243 * else // no _PRW at S-state x 244 244 * choose highest power _SxD or any lower power 245 - * 246 - * currently we simply return _SxD, if present. 247 245 */ 248 246 249 247 static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
+25 -14
drivers/thermal/thermal.c
··· 306 306 { 307 307 struct thermal_cooling_device_instance *dev; 308 308 struct thermal_cooling_device_instance *pos; 309 + struct thermal_zone_device *pos1; 310 + struct thermal_cooling_device *pos2; 309 311 int result; 310 312 311 313 if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) 312 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 326 return -EINVAL; 316 327 317 328 dev = ··· 448 437 int result; 449 438 450 439 if (strlen(type) >= THERMAL_NAME_LENGTH) 451 - return NULL; 440 + return ERR_PTR(-EINVAL); 452 441 453 442 if (!ops || !ops->get_max_state || !ops->get_cur_state || 454 443 !ops->set_cur_state) 455 - return NULL; 444 + return ERR_PTR(-EINVAL); 456 445 457 446 cdev = kzalloc(sizeof(struct thermal_cooling_device), GFP_KERNEL); 458 447 if (!cdev) 459 - return NULL; 448 + return ERR_PTR(-ENOMEM); 460 449 461 450 result = get_idr(&thermal_cdev_idr, &thermal_idr_lock, &cdev->id); 462 451 if (result) { 463 452 kfree(cdev); 464 - return NULL; 453 + return ERR_PTR(result); 465 454 } 466 455 467 456 strcpy(cdev->type, type); ··· 473 462 if (result) { 474 463 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); 475 464 kfree(cdev); 476 - return NULL; 465 + return ERR_PTR(result); 477 466 } 478 467 479 468 /* sys I/F */ ··· 509 498 unregister: 510 499 release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id); 511 500 device_unregister(&cdev->device); 512 - return NULL; 501 + return ERR_PTR(result); 513 502 } 514 503 515 504 EXPORT_SYMBOL(thermal_cooling_device_register); ··· 581 570 int count; 582 571 583 572 if (strlen(type) >= THERMAL_NAME_LENGTH) 584 - return NULL; 573 + return ERR_PTR(-EINVAL); 585 574 586 575 if (trips > THERMAL_MAX_TRIPS || trips < 0) 587 - return NULL; 576 + return ERR_PTR(-EINVAL); 588 577 589 578 if (!ops || !ops->get_temp) 590 - return NULL; 579 + return ERR_PTR(-EINVAL); 591 580 592 581 tz = kzalloc(sizeof(struct thermal_zone_device), GFP_KERNEL); 593 582 if (!tz) 594 - return NULL; 583 + return ERR_PTR(-ENOMEM); 595 584 596 585 INIT_LIST_HEAD(&tz->cooling_devices); 597 586 idr_init(&tz->idr); ··· 599 588 result = get_idr(&thermal_tz_idr, &thermal_idr_lock, &tz->id); 600 589 if (result) { 601 590 kfree(tz); 602 - return NULL; 591 + return ERR_PTR(result); 603 592 } 604 593 605 594 strcpy(tz->type, type); ··· 612 601 if (result) { 613 602 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 614 603 kfree(tz); 615 - return NULL; 604 + return ERR_PTR(result); 616 605 } 617 606 618 607 /* sys I/F */ ··· 654 643 unregister: 655 644 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); 656 645 device_unregister(&tz->device); 657 - return NULL; 646 + return ERR_PTR(result); 658 647 } 659 648 660 649 EXPORT_SYMBOL(thermal_zone_device_register);
+6
include/linux/mm.h
··· 1171 1171 { 1172 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 1177 #else 1175 1178 static inline void 1176 1179 kernel_map_pages(struct page *page, int numpages, int enable) {} 1177 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 1186 #endif 1181 1187 1182 1188 extern struct vm_area_struct *get_gate_vma(struct task_struct *tsk);
+29 -13
kernel/power/snapshot.c
··· 875 875 #endif /* CONFIG_HIGHMEM */ 876 876 877 877 /** 878 - * saveable - Determine whether a non-highmem page should be included in 879 - * the suspend image. 878 + * saveable_page - Determine whether a non-highmem page should be included 879 + * in the suspend image. 880 880 * 881 881 * We should save the page if it isn't Nosave, and is not in the range 882 882 * of pages statically defined as 'unsaveable', and it isn't a part of ··· 897 897 if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) 898 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 902 return NULL; 902 903 903 904 return page; ··· 939 938 *dst++ = *src++; 940 939 } 941 940 941 + 942 + /** 943 + * safe_copy_page - check if the page we are going to copy is marked as 944 + * present in the kernel page tables (this always is the case if 945 + * CONFIG_DEBUG_PAGEALLOC is not set and in that case 946 + * kernel_page_present() always returns 'true'). 947 + */ 948 + static void safe_copy_page(void *dst, struct page *s_page) 949 + { 950 + if (kernel_page_present(s_page)) { 951 + do_copy_page(dst, page_address(s_page)); 952 + } else { 953 + kernel_map_pages(s_page, 1, 1); 954 + do_copy_page(dst, page_address(s_page)); 955 + kernel_map_pages(s_page, 1, 0); 956 + } 957 + } 958 + 959 + 942 960 #ifdef CONFIG_HIGHMEM 943 961 static inline struct page * 944 962 page_is_saveable(struct zone *zone, unsigned long pfn) ··· 966 946 saveable_highmem_page(pfn) : saveable_page(pfn); 967 947 } 968 948 969 - static inline void 970 - copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) 949 + static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) 971 950 { 972 951 struct page *s_page, *d_page; 973 952 void *src, *dst; ··· 980 961 kunmap_atomic(src, KM_USER0); 981 962 kunmap_atomic(dst, KM_USER1); 982 963 } else { 983 - src = page_address(s_page); 984 964 if (PageHighMem(d_page)) { 985 965 /* Page pointed to by src may contain some kernel 986 966 * data modified by kmap_atomic() 987 967 */ 988 - do_copy_page(buffer, src); 968 + safe_copy_page(buffer, s_page); 989 969 dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); 990 970 memcpy(dst, buffer, PAGE_SIZE); 991 971 kunmap_atomic(dst, KM_USER0); 992 972 } else { 993 - dst = page_address(d_page); 994 - do_copy_page(dst, src); 973 + safe_copy_page(page_address(d_page), s_page); 995 974 } 996 975 } 997 976 } 998 977 #else 999 978 #define page_is_saveable(zone, pfn) saveable_page(pfn) 1000 979 1001 - static inline void 1002 - copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) 980 + static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn) 1003 981 { 1004 - do_copy_page(page_address(pfn_to_page(dst_pfn)), 1005 - page_address(pfn_to_page(src_pfn))); 982 + safe_copy_page(page_address(pfn_to_page(dst_pfn)), 983 + pfn_to_page(src_pfn)); 1006 984 } 1007 985 #endif /* CONFIG_HIGHMEM */ 1008 986