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

Configure Feed

Select the types of activity you want to include in your feed.

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: (23 commits)
ACPICA: fix stray va_end() caused by mis-merge
ACPI: Reject below-freezing temperatures as invalid critical temperatures
ACPICA: Fix for access to deleted object <regression>
ACPICA: Fix to make _SST method optional
ACPICA: Fix for Load operator, load table at the namespace root
ACPICA: Ignore ACPI table signature for Load() operator
ACPICA: Fix to allow zero-length ASL field declarations
ACPI: use memory_read_from_buffer()
bay: exit if notify handler cannot be installed
dock.c remove trailing printk whitespace
proper prototype for acpi_processor_tstate_has_changed()
ACPI: handle invalid ACPI SLIT table
PNPACPI: use _CRS IRQ descriptor length for _SRS
pnpacpi: fix shareable IRQ encode/decode
pnpacpi: fix IRQ flag decoding
MAINTAINERS: update ACPI homepage
ACPI 2.6.26-rc2: Add missing newline to DSDT/SSDT warning message
ACPI: EC: Use msleep instead of udelay while waiting for event.
thinkpad-acpi: fix LED handling on older ThinkPads
thinkpad-acpi: fix initialization error paths
...

+443 -368
+1 -1
Documentation/laptops/thinkpad-acpi.txt
··· 503 503 In addition to the EV_KEY events, thinkpad-acpi may also issue EV_SW 504 504 events for switches: 505 505 506 - SW_RADIO T60 and later hardare rfkill rocker switch 506 + SW_RFKILL_ALL T60 and later hardare rfkill rocker switch 507 507 SW_TABLET_MODE Tablet ThinkPads HKEY events 0x5009 and 0x500A 508 508 509 509 Non hot-key ACPI HKEY event map:
+5 -5
MAINTAINERS
··· 228 228 P: Alexey Starikovskiy 229 229 M: astarikovskiy@suse.de 230 230 L: linux-acpi@vger.kernel.org 231 - W: http://acpi.sourceforge.net/ 231 + W: http://www.lesswatts.org/projects/acpi/ 232 232 S: Supported 233 233 234 234 ACPI EC DRIVER 235 235 P: Alexey Starikovskiy 236 236 M: astarikovskiy@suse.de 237 237 L: linux-acpi@vger.kernel.org 238 - W: http://acpi.sourceforge.net/ 238 + W: http://www.lesswatts.org/projects/acpi/ 239 239 S: Supported 240 240 241 241 ACPI FAN DRIVER 242 242 P: Len Brown 243 243 M: len.brown@intel.com 244 244 L: linux-acpi@vger.kernel.org 245 - W: http://acpi.sourceforge.net/ 245 + W: http://www.lesswatts.org/projects/acpi/ 246 246 S: Supported 247 247 248 248 ACPI PCI HOTPLUG DRIVER ··· 255 255 P: Len Brown 256 256 M: len.brown@intel.com 257 257 L: linux-acpi@vger.kernel.org 258 - W: http://acpi.sourceforge.net/ 258 + W: http://www.lesswatts.org/projects/acpi/ 259 259 S: Supported 260 260 261 261 ACPI VIDEO DRIVER 262 262 P: Rui Zhang 263 263 M: rui.zhang@intel.com 264 264 L: linux-acpi@vger.kernel.org 265 - W: http://acpi.sourceforge.net/ 265 + W: http://www.lesswatts.org/projects/acpi/ 266 266 S: Supported 267 267 268 268 ACPI WMI DRIVER
+7 -2
arch/ia64/kernel/acpi.c
··· 465 465 printk(KERN_ERR 466 466 "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", 467 467 len, slit->header.length); 468 - memset(numa_slit, 10, sizeof(numa_slit)); 469 468 return; 470 469 } 471 470 slit_table = slit; ··· 573 574 printk(KERN_INFO "Number of memory chunks in system = %d\n", 574 575 num_node_memblks); 575 576 576 - if (!slit_table) 577 + if (!slit_table) { 578 + for (i = 0; i < MAX_NUMNODES; i++) 579 + for (j = 0; j < MAX_NUMNODES; j++) 580 + node_distance(i, j) = i == j ? LOCAL_DISTANCE : 581 + REMOTE_DISTANCE; 577 582 return; 583 + } 584 + 578 585 memset(numa_slit, -1, sizeof(numa_slit)); 579 586 for (i = 0; i < slit_table->locality_count; i++) { 580 587 if (!pxm_bit_test(i))
-27
arch/x86/mm/srat_64.c
··· 97 97 return numa_off || acpi_numa < 0; 98 98 } 99 99 100 - /* 101 - * A lot of BIOS fill in 10 (= no distance) everywhere. This messes 102 - * up the NUMA heuristics which wants the local node to have a smaller 103 - * distance than the others. 104 - * Do some quick checks here and only use the SLIT if it passes. 105 - */ 106 - static __init int slit_valid(struct acpi_table_slit *slit) 107 - { 108 - int i, j; 109 - int d = slit->locality_count; 110 - for (i = 0; i < d; i++) { 111 - for (j = 0; j < d; j++) { 112 - u8 val = slit->entry[d*i + j]; 113 - if (i == j) { 114 - if (val != LOCAL_DISTANCE) 115 - return 0; 116 - } else if (val <= LOCAL_DISTANCE) 117 - return 0; 118 - } 119 - } 120 - return 1; 121 - } 122 - 123 100 /* Callback for SLIT parsing */ 124 101 void __init acpi_numa_slit_init(struct acpi_table_slit *slit) 125 102 { 126 - if (!slit_valid(slit)) { 127 - printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); 128 - return; 129 - } 130 103 acpi_slit = slit; 131 104 } 132 105
+10 -6
drivers/acpi/bay.c
··· 301 301 */ 302 302 pdev->dev.uevent_suppress = 0; 303 303 304 - if (acpi_bay_add_fs(new_bay)) { 305 - platform_device_unregister(new_bay->pdev); 306 - goto bay_add_err; 307 - } 308 - 309 304 /* register for events on this device */ 310 305 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 311 306 bay_notify, new_bay); 312 307 if (ACPI_FAILURE(status)) { 313 - printk(KERN_ERR PREFIX "Error installing bay notify handler\n"); 308 + printk(KERN_INFO PREFIX "Error installing bay notify handler\n"); 309 + platform_device_unregister(new_bay->pdev); 310 + goto bay_add_err; 311 + } 312 + 313 + if (acpi_bay_add_fs(new_bay)) { 314 + acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 315 + bay_notify); 316 + platform_device_unregister(new_bay->pdev); 317 + goto bay_add_err; 314 318 } 315 319 316 320 /* if we are on a dock station, we should register for dock
+1 -4
drivers/acpi/dispatcher/dsfield.c
··· 450 450 return_ACPI_STATUS(AE_BAD_PARAMETER); 451 451 } 452 452 453 - if (!arg) { 454 - return_ACPI_STATUS(AE_AML_NO_OPERAND); 455 - } 456 - 457 453 /* Creating new namespace node(s), should not already exist */ 458 454 459 455 flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ··· 463 467 464 468 /* 465 469 * Walk the list of entries in the field_list 470 + * Note: field_list can be of zero length. In this case, Arg will be NULL. 466 471 */ 467 472 while (arg) { 468 473 /*
+1 -1
drivers/acpi/dock.c
··· 834 834 goto dock_add_err; 835 835 } 836 836 837 - printk(KERN_INFO PREFIX "%s \n", ACPI_DOCK_DRIVER_DESCRIPTION); 837 + printk(KERN_INFO PREFIX "%s\n", ACPI_DOCK_DRIVER_DESCRIPTION); 838 838 839 839 return 0; 840 840
+1 -1
drivers/acpi/ec.c
··· 194 194 while (time_before(jiffies, delay)) { 195 195 if (acpi_ec_check_status(ec, event)) 196 196 return 0; 197 - udelay(ACPI_EC_UDELAY); 197 + msleep(1); 198 198 } 199 199 } 200 200 pr_err(PREFIX "acpi_ec_wait timeout, status = 0x%2.2x, event = %s\n",
+8 -2
drivers/acpi/executer/exconfig.c
··· 375 375 goto cleanup; 376 376 } 377 377 378 + /* 379 + * Add the table to the namespace. 380 + * 381 + * Note: We load the table objects relative to the root of the namespace. 382 + * This appears to go against the ACPI specification, but we do it for 383 + * compatibility with other ACPI implementations. 384 + */ 378 385 status = 379 - acpi_ex_add_table(table_index, walk_state->scope_info->scope.node, 380 - &ddb_handle); 386 + acpi_ex_add_table(table_index, acpi_gbl_root_node, &ddb_handle); 381 387 if (ACPI_FAILURE(status)) { 382 388 383 389 /* On error, table_ptr was deallocated above */
+6
drivers/acpi/glue.c
··· 272 272 static inline void rtc_wake_setup(void) 273 273 { 274 274 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 275 + /* 276 + * After the RTC handler is installed, the Fixed_RTC event should 277 + * be disabled. Only when the RTC alarm is set will it be enabled. 278 + */ 279 + acpi_clear_event(ACPI_EVENT_RTC); 280 + acpi_disable_event(ACPI_EVENT_RTC, 0); 275 281 } 276 282 277 283 static void rtc_wake_on(struct device *dev)
+5 -3
drivers/acpi/hardware/hwsleep.c
··· 223 223 break; 224 224 } 225 225 226 - /* Set the system indicators to show the desired sleep state. */ 227 - 226 + /* 227 + * Set the system indicators to show the desired sleep state. 228 + * _SST is an optional method (return no error if not found) 229 + */ 228 230 status = acpi_evaluate_object(NULL, METHOD_NAME__SST, &arg_list, NULL); 229 231 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { 230 232 ACPI_EXCEPTION((AE_INFO, status, 231 233 "While executing method _SST")); 232 234 } 233 235 234 - return_ACPI_STATUS(status); 236 + return_ACPI_STATUS(AE_OK); 235 237 } 236 238 237 239 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep)
+27 -4
drivers/acpi/numa.c
··· 140 140 } 141 141 } 142 142 143 + /* 144 + * A lot of BIOS fill in 10 (= no distance) everywhere. This messes 145 + * up the NUMA heuristics which wants the local node to have a smaller 146 + * distance than the others. 147 + * Do some quick checks here and only use the SLIT if it passes. 148 + */ 149 + static __init int slit_valid(struct acpi_table_slit *slit) 150 + { 151 + int i, j; 152 + int d = slit->locality_count; 153 + for (i = 0; i < d; i++) { 154 + for (j = 0; j < d; j++) { 155 + u8 val = slit->entry[d*i + j]; 156 + if (i == j) { 157 + if (val != LOCAL_DISTANCE) 158 + return 0; 159 + } else if (val <= LOCAL_DISTANCE) 160 + return 0; 161 + } 162 + } 163 + return 1; 164 + } 165 + 143 166 static int __init acpi_parse_slit(struct acpi_table_header *table) 144 167 { 145 168 struct acpi_table_slit *slit; 146 - u32 localities; 147 169 148 170 if (!table) 149 171 return -EINVAL; 150 172 151 173 slit = (struct acpi_table_slit *)table; 152 174 153 - /* downcast just for %llu vs %lu for i386/ia64 */ 154 - localities = (u32) slit->locality_count; 155 - 175 + if (!slit_valid(slit)) { 176 + printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n"); 177 + return -EINVAL; 178 + } 156 179 acpi_numa_slit_init(slit); 157 180 158 181 return 0;
+2 -2
drivers/acpi/parser/psargs.c
··· 268 268 */ 269 269 if (ACPI_SUCCESS(status) && 270 270 possible_method_call && (node->type == ACPI_TYPE_METHOD)) { 271 - if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 271 + if (walk_state->opcode == AML_UNLOAD_OP) { 272 272 /* 273 273 * acpi_ps_get_next_namestring has increased the AML pointer, 274 274 * so we need to restore the saved AML pointer for method call. ··· 691 691 692 692 /* To support super_name arg of Unload */ 693 693 694 - if (walk_state->op->common.aml_opcode == AML_UNLOAD_OP) { 694 + if (walk_state->opcode == AML_UNLOAD_OP) { 695 695 status = 696 696 acpi_ps_get_next_namepath(walk_state, 697 697 parser_state, arg,
-1
drivers/acpi/processor_core.c
··· 86 86 static void acpi_processor_notify(acpi_handle handle, u32 event, void *data); 87 87 static acpi_status acpi_processor_hotadd_init(acpi_handle handle, int *p_cpu); 88 88 static int acpi_processor_handle_eject(struct acpi_processor *pr); 89 - extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 90 89 91 90 92 91 static const struct acpi_device_id processor_device_ids[] = {
+7 -6
drivers/acpi/processor_idle.c
··· 1669 1669 return -EINVAL; 1670 1670 } 1671 1671 1672 + dev->cpu = pr->id; 1672 1673 for (i = 0; i < CPUIDLE_STATE_MAX; i++) { 1673 1674 dev->states[i].name[0] = '\0'; 1674 1675 dev->states[i].desc[0] = '\0'; ··· 1739 1738 1740 1739 int acpi_processor_cst_has_changed(struct acpi_processor *pr) 1741 1740 { 1742 - int ret; 1741 + int ret = 0; 1743 1742 1744 1743 if (boot_option_idle_override) 1745 1744 return 0; ··· 1757 1756 cpuidle_pause_and_lock(); 1758 1757 cpuidle_disable_device(&pr->power.dev); 1759 1758 acpi_processor_get_power_info(pr); 1760 - acpi_processor_setup_cpuidle(pr); 1761 - ret = cpuidle_enable_device(&pr->power.dev); 1759 + if (pr->flags.power) { 1760 + acpi_processor_setup_cpuidle(pr); 1761 + ret = cpuidle_enable_device(&pr->power.dev); 1762 + } 1762 1763 cpuidle_resume_and_unlock(); 1763 1764 1764 1765 return ret; ··· 1816 1813 if (pr->flags.power) { 1817 1814 #ifdef CONFIG_CPU_IDLE 1818 1815 acpi_processor_setup_cpuidle(pr); 1819 - pr->power.dev.cpu = pr->id; 1820 1816 if (cpuidle_register_device(&pr->power.dev)) 1821 1817 return -EIO; 1822 1818 #endif ··· 1852 1850 return 0; 1853 1851 1854 1852 #ifdef CONFIG_CPU_IDLE 1855 - if (pr->flags.power) 1856 - cpuidle_unregister_device(&pr->power.dev); 1853 + cpuidle_unregister_device(&pr->power.dev); 1857 1854 #endif 1858 1855 pr->flags.power_setup_done = 0; 1859 1856
+6
drivers/acpi/sleep/proc.c
··· 495 495 acpi_root_dir, &acpi_system_alarm_fops); 496 496 497 497 acpi_install_fixed_event_handler(ACPI_EVENT_RTC, rtc_handler, NULL); 498 + /* 499 + * Disable the RTC event after installing RTC handler. 500 + * Only when RTC alarm is set will it be enabled. 501 + */ 502 + acpi_clear_event(ACPI_EVENT_RTC); 503 + acpi_disable_event(ACPI_EVENT_RTC, 0); 498 504 #endif /* HAVE_ACPI_LEGACY_ALARM */ 499 505 500 506 /* 'wakeup device' [R/W] */
+2 -13
drivers/acpi/system.c
··· 77 77 container_of(bin_attr, struct acpi_table_attr, attr); 78 78 struct acpi_table_header *table_header = NULL; 79 79 acpi_status status; 80 - ssize_t ret_count = count; 81 80 82 81 status = 83 82 acpi_get_table(table_attr->name, table_attr->instance, ··· 84 85 if (ACPI_FAILURE(status)) 85 86 return -ENODEV; 86 87 87 - if (offset >= table_header->length) { 88 - ret_count = 0; 89 - goto end; 90 - } 91 - 92 - if (offset + ret_count > table_header->length) 93 - ret_count = table_header->length - offset; 94 - 95 - memcpy(buf, ((char *)table_header) + offset, ret_count); 96 - 97 - end: 98 - return ret_count; 88 + return memory_read_from_buffer(buf, count, &offset, 89 + table_header, table_header->length); 99 90 } 100 91 101 92 static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
+7 -18
drivers/acpi/tables/tbinstal.c
··· 123 123 } 124 124 } 125 125 126 - /* The table must be either an SSDT or a PSDT or an OEMx */ 127 - 128 - if (!ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_PSDT)&& 129 - !ACPI_COMPARE_NAME(table_desc->pointer->signature, ACPI_SIG_SSDT)&& 130 - strncmp(table_desc->pointer->signature, "OEM", 3)) { 131 - /* Check for a printable name */ 132 - if (acpi_ut_valid_acpi_name( 133 - *(u32 *) table_desc->pointer->signature)) { 134 - ACPI_ERROR((AE_INFO, "Table has invalid signature " 135 - "[%4.4s], must be SSDT or PSDT", 136 - table_desc->pointer->signature)); 137 - } else { 138 - ACPI_ERROR((AE_INFO, "Table has invalid signature " 139 - "(0x%8.8X), must be SSDT or PSDT", 140 - *(u32 *) table_desc->pointer->signature)); 141 - } 142 - return_ACPI_STATUS(AE_BAD_SIGNATURE); 143 - } 126 + /* 127 + * Originally, we checked the table signature for "SSDT" or "PSDT" here. 128 + * Next, we added support for OEMx tables, signature "OEM". 129 + * Valid tables were encountered with a null signature, so we've just 130 + * given up on validating the signature, since it seems to be a waste 131 + * of code. The original code was removed (05/2008). 132 + */ 144 133 145 134 (void)acpi_ut_acquire_mutex(ACPI_MTX_TABLES); 146 135
+1 -1
drivers/acpi/tables/tbxface.c
··· 540 540 acpi_tb_print_table_header(0, table); 541 541 542 542 if (no_auto_ssdt == 0) { 543 - printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\""); 543 + printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"\n"); 544 544 } 545 545 } 546 546
+9 -2
drivers/acpi/thermal.c
··· 364 364 if (flag & ACPI_TRIPS_CRITICAL) { 365 365 status = acpi_evaluate_integer(tz->device->handle, 366 366 "_CRT", NULL, &tz->trips.critical.temperature); 367 - if (ACPI_FAILURE(status)) { 367 + /* 368 + * Treat freezing temperatures as invalid as well; some 369 + * BIOSes return really low values and cause reboots at startup. 370 + * Below zero (Celcius) values clearly aren't right for sure.. 371 + * ... so lets discard those as invalid. 372 + */ 373 + if (ACPI_FAILURE(status) || 374 + tz->trips.critical.temperature <= 2732) { 368 375 tz->trips.critical.flags.valid = 0; 369 376 ACPI_EXCEPTION((AE_INFO, status, 370 - "No critical threshold")); 377 + "No or invalid critical threshold")); 371 378 return -ENODEV; 372 379 } else { 373 380 tz->trips.critical.flags.valid = 1;
+1 -1
drivers/acpi/utilities/utmisc.c
··· 1048 1048 va_start(args, format); 1049 1049 acpi_os_vprintf(format, args); 1050 1050 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1051 + va_end(args); 1051 1052 } 1052 1053 1053 1054 EXPORT_SYMBOL(acpi_ut_exception); ··· 1063 1062 va_start(args, format); 1064 1063 acpi_os_vprintf(format, args); 1065 1064 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION); 1066 - va_end(args); 1067 1065 va_end(args); 1068 1066 } 1069 1067
+35 -5
drivers/cpuidle/cpuidle.c
··· 38 38 static void cpuidle_kick_cpus(void) {} 39 39 #endif 40 40 41 + static int __cpuidle_register_device(struct cpuidle_device *dev); 42 + 41 43 /** 42 44 * cpuidle_idle_call - the main idle loop 43 45 * ··· 140 138 if (!dev->state_count) 141 139 return -EINVAL; 142 140 141 + if (dev->registered == 0) { 142 + ret = __cpuidle_register_device(dev); 143 + if (ret) 144 + return ret; 145 + } 146 + 143 147 if ((ret = cpuidle_add_state_sysfs(dev))) 144 148 return ret; 145 149 ··· 240 232 #endif /* CONFIG_ARCH_HAS_CPU_RELAX */ 241 233 242 234 /** 243 - * cpuidle_register_device - registers a CPU's idle PM feature 235 + * __cpuidle_register_device - internal register function called before register 236 + * and enable routines 244 237 * @dev: the cpu 238 + * 239 + * cpuidle_lock mutex must be held before this is called 245 240 */ 246 - int cpuidle_register_device(struct cpuidle_device *dev) 241 + static int __cpuidle_register_device(struct cpuidle_device *dev) 247 242 { 248 243 int ret; 249 244 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); ··· 258 247 259 248 init_completion(&dev->kobj_unregister); 260 249 261 - mutex_lock(&cpuidle_lock); 262 - 263 250 poll_idle_init(dev); 264 251 265 252 per_cpu(cpuidle_devices, dev->cpu) = dev; 266 253 list_add(&dev->device_list, &cpuidle_detected_devices); 267 254 if ((ret = cpuidle_add_sysfs(sys_dev))) { 268 - mutex_unlock(&cpuidle_lock); 269 255 module_put(cpuidle_curr_driver->owner); 256 + return ret; 257 + } 258 + 259 + dev->registered = 1; 260 + return 0; 261 + } 262 + 263 + /** 264 + * cpuidle_register_device - registers a CPU's idle PM feature 265 + * @dev: the cpu 266 + */ 267 + int cpuidle_register_device(struct cpuidle_device *dev) 268 + { 269 + int ret; 270 + 271 + mutex_lock(&cpuidle_lock); 272 + 273 + if ((ret = __cpuidle_register_device(dev))) { 274 + mutex_unlock(&cpuidle_lock); 270 275 return ret; 271 276 } 272 277 ··· 304 277 void cpuidle_unregister_device(struct cpuidle_device *dev) 305 278 { 306 279 struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); 280 + 281 + if (dev->registered == 0) 282 + return; 307 283 308 284 cpuidle_pause_and_lock(); 309 285
+267 -243
drivers/misc/thinkpad_acpi.c
··· 1293 1293 mutex_lock(&tpacpi_inputdev_send_mutex); 1294 1294 1295 1295 input_report_switch(tpacpi_inputdev, 1296 - SW_RADIO, !!wlsw); 1296 + SW_RFKILL_ALL, !!wlsw); 1297 1297 input_sync(tpacpi_inputdev); 1298 1298 1299 1299 mutex_unlock(&tpacpi_inputdev_send_mutex); ··· 1921 1921 &dev_attr_hotkey_wakeup_hotunplug_complete.attr, 1922 1922 }; 1923 1923 1924 + static void hotkey_exit(void) 1925 + { 1926 + #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 1927 + hotkey_poll_stop_sync(); 1928 + #endif 1929 + 1930 + if (hotkey_dev_attributes) 1931 + delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj); 1932 + 1933 + kfree(hotkey_keycode_map); 1934 + 1935 + if (tp_features.hotkey) { 1936 + dbg_printk(TPACPI_DBG_EXIT, 1937 + "restoring original hot key mask\n"); 1938 + /* no short-circuit boolean operator below! */ 1939 + if ((hotkey_mask_set(hotkey_orig_mask) | 1940 + hotkey_status_set(hotkey_orig_status)) != 0) 1941 + printk(TPACPI_ERR 1942 + "failed to restore hot key mask " 1943 + "to BIOS defaults\n"); 1944 + } 1945 + } 1946 + 1924 1947 static int __init hotkey_init(struct ibm_init_struct *iibm) 1925 1948 { 1926 1949 /* Requirements for changing the default keymaps: ··· 2083 2060 vdbg_printk(TPACPI_DBG_INIT, "hotkeys are %s\n", 2084 2061 str_supported(tp_features.hotkey)); 2085 2062 2086 - if (tp_features.hotkey) { 2087 - hotkey_dev_attributes = create_attr_set(13, NULL); 2088 - if (!hotkey_dev_attributes) 2089 - return -ENOMEM; 2090 - res = add_many_to_attr_set(hotkey_dev_attributes, 2091 - hotkey_attributes, 2092 - ARRAY_SIZE(hotkey_attributes)); 2063 + if (!tp_features.hotkey) 2064 + return 1; 2065 + 2066 + hotkey_dev_attributes = create_attr_set(13, NULL); 2067 + if (!hotkey_dev_attributes) 2068 + return -ENOMEM; 2069 + res = add_many_to_attr_set(hotkey_dev_attributes, 2070 + hotkey_attributes, 2071 + ARRAY_SIZE(hotkey_attributes)); 2072 + if (res) 2073 + goto err_exit; 2074 + 2075 + /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 2076 + A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking 2077 + for HKEY interface version 0x100 */ 2078 + if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { 2079 + if ((hkeyv >> 8) != 1) { 2080 + printk(TPACPI_ERR "unknown version of the " 2081 + "HKEY interface: 0x%x\n", hkeyv); 2082 + printk(TPACPI_ERR "please report this to %s\n", 2083 + TPACPI_MAIL); 2084 + } else { 2085 + /* 2086 + * MHKV 0x100 in A31, R40, R40e, 2087 + * T4x, X31, and later 2088 + */ 2089 + tp_features.hotkey_mask = 1; 2090 + } 2091 + } 2092 + 2093 + vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", 2094 + str_supported(tp_features.hotkey_mask)); 2095 + 2096 + if (tp_features.hotkey_mask) { 2097 + if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 2098 + "MHKA", "qd")) { 2099 + printk(TPACPI_ERR 2100 + "missing MHKA handler, " 2101 + "please report this to %s\n", 2102 + TPACPI_MAIL); 2103 + /* FN+F12, FN+F4, FN+F3 */ 2104 + hotkey_all_mask = 0x080cU; 2105 + } 2106 + } 2107 + 2108 + /* hotkey_source_mask *must* be zero for 2109 + * the first hotkey_mask_get */ 2110 + res = hotkey_status_get(&hotkey_orig_status); 2111 + if (res) 2112 + goto err_exit; 2113 + 2114 + if (tp_features.hotkey_mask) { 2115 + res = hotkey_mask_get(); 2093 2116 if (res) 2094 - return res; 2117 + goto err_exit; 2095 2118 2096 - /* mask not supported on 570, 600e/x, 770e, 770x, A21e, A2xm/p, 2097 - A30, R30, R31, T20-22, X20-21, X22-24. Detected by checking 2098 - for HKEY interface version 0x100 */ 2099 - if (acpi_evalf(hkey_handle, &hkeyv, "MHKV", "qd")) { 2100 - if ((hkeyv >> 8) != 1) { 2101 - printk(TPACPI_ERR "unknown version of the " 2102 - "HKEY interface: 0x%x\n", hkeyv); 2103 - printk(TPACPI_ERR "please report this to %s\n", 2104 - TPACPI_MAIL); 2105 - } else { 2106 - /* 2107 - * MHKV 0x100 in A31, R40, R40e, 2108 - * T4x, X31, and later 2109 - */ 2110 - tp_features.hotkey_mask = 1; 2111 - } 2112 - } 2113 - 2114 - vdbg_printk(TPACPI_DBG_INIT, "hotkey masks are %s\n", 2115 - str_supported(tp_features.hotkey_mask)); 2116 - 2117 - if (tp_features.hotkey_mask) { 2118 - if (!acpi_evalf(hkey_handle, &hotkey_all_mask, 2119 - "MHKA", "qd")) { 2120 - printk(TPACPI_ERR 2121 - "missing MHKA handler, " 2122 - "please report this to %s\n", 2123 - TPACPI_MAIL); 2124 - /* FN+F12, FN+F4, FN+F3 */ 2125 - hotkey_all_mask = 0x080cU; 2126 - } 2127 - } 2128 - 2129 - /* hotkey_source_mask *must* be zero for 2130 - * the first hotkey_mask_get */ 2131 - res = hotkey_status_get(&hotkey_orig_status); 2132 - if (!res && tp_features.hotkey_mask) { 2133 - res = hotkey_mask_get(); 2134 - hotkey_orig_mask = hotkey_mask; 2135 - if (!res) { 2136 - res = add_many_to_attr_set( 2137 - hotkey_dev_attributes, 2138 - hotkey_mask_attributes, 2139 - ARRAY_SIZE(hotkey_mask_attributes)); 2140 - } 2141 - } 2119 + hotkey_orig_mask = hotkey_mask; 2120 + res = add_many_to_attr_set( 2121 + hotkey_dev_attributes, 2122 + hotkey_mask_attributes, 2123 + ARRAY_SIZE(hotkey_mask_attributes)); 2124 + if (res) 2125 + goto err_exit; 2126 + } 2142 2127 2143 2128 #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2144 - if (tp_features.hotkey_mask) { 2145 - hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 2146 - & ~hotkey_all_mask; 2147 - } else { 2148 - hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; 2149 - } 2129 + if (tp_features.hotkey_mask) { 2130 + hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK 2131 + & ~hotkey_all_mask; 2132 + } else { 2133 + hotkey_source_mask = TPACPI_HKEY_NVRAM_GOOD_MASK; 2134 + } 2150 2135 2151 - vdbg_printk(TPACPI_DBG_INIT, 2152 - "hotkey source mask 0x%08x, polling freq %d\n", 2153 - hotkey_source_mask, hotkey_poll_freq); 2136 + vdbg_printk(TPACPI_DBG_INIT, 2137 + "hotkey source mask 0x%08x, polling freq %d\n", 2138 + hotkey_source_mask, hotkey_poll_freq); 2154 2139 #endif 2155 2140 2156 - /* Not all thinkpads have a hardware radio switch */ 2157 - if (!res && acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { 2158 - tp_features.hotkey_wlsw = 1; 2159 - printk(TPACPI_INFO 2160 - "radio switch found; radios are %s\n", 2161 - enabled(status, 0)); 2162 - res = add_to_attr_set(hotkey_dev_attributes, 2163 - &dev_attr_hotkey_radio_sw.attr); 2164 - } 2141 + /* Not all thinkpads have a hardware radio switch */ 2142 + if (acpi_evalf(hkey_handle, &status, "WLSW", "qd")) { 2143 + tp_features.hotkey_wlsw = 1; 2144 + printk(TPACPI_INFO 2145 + "radio switch found; radios are %s\n", 2146 + enabled(status, 0)); 2147 + res = add_to_attr_set(hotkey_dev_attributes, 2148 + &dev_attr_hotkey_radio_sw.attr); 2149 + } 2165 2150 2166 - /* For X41t, X60t, X61t Tablets... */ 2167 - if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { 2168 - tp_features.hotkey_tablet = 1; 2169 - printk(TPACPI_INFO 2170 - "possible tablet mode switch found; " 2171 - "ThinkPad in %s mode\n", 2172 - (status & TP_HOTKEY_TABLET_MASK)? 2173 - "tablet" : "laptop"); 2174 - res = add_to_attr_set(hotkey_dev_attributes, 2175 - &dev_attr_hotkey_tablet_mode.attr); 2176 - } 2151 + /* For X41t, X60t, X61t Tablets... */ 2152 + if (!res && acpi_evalf(hkey_handle, &status, "MHKG", "qd")) { 2153 + tp_features.hotkey_tablet = 1; 2154 + printk(TPACPI_INFO 2155 + "possible tablet mode switch found; " 2156 + "ThinkPad in %s mode\n", 2157 + (status & TP_HOTKEY_TABLET_MASK)? 2158 + "tablet" : "laptop"); 2159 + res = add_to_attr_set(hotkey_dev_attributes, 2160 + &dev_attr_hotkey_tablet_mode.attr); 2161 + } 2177 2162 2178 - if (!res) 2179 - res = register_attr_set_with_sysfs( 2180 - hotkey_dev_attributes, 2181 - &tpacpi_pdev->dev.kobj); 2182 - if (res) 2183 - return res; 2163 + if (!res) 2164 + res = register_attr_set_with_sysfs( 2165 + hotkey_dev_attributes, 2166 + &tpacpi_pdev->dev.kobj); 2167 + if (res) 2168 + goto err_exit; 2184 2169 2185 - /* Set up key map */ 2170 + /* Set up key map */ 2186 2171 2187 - hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 2188 - GFP_KERNEL); 2189 - if (!hotkey_keycode_map) { 2190 - printk(TPACPI_ERR 2191 - "failed to allocate memory for key map\n"); 2192 - return -ENOMEM; 2193 - } 2172 + hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 2173 + GFP_KERNEL); 2174 + if (!hotkey_keycode_map) { 2175 + printk(TPACPI_ERR 2176 + "failed to allocate memory for key map\n"); 2177 + res = -ENOMEM; 2178 + goto err_exit; 2179 + } 2194 2180 2195 - if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { 2196 - dbg_printk(TPACPI_DBG_INIT, 2197 - "using Lenovo default hot key map\n"); 2198 - memcpy(hotkey_keycode_map, &lenovo_keycode_map, 2199 - TPACPI_HOTKEY_MAP_SIZE); 2181 + if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) { 2182 + dbg_printk(TPACPI_DBG_INIT, 2183 + "using Lenovo default hot key map\n"); 2184 + memcpy(hotkey_keycode_map, &lenovo_keycode_map, 2185 + TPACPI_HOTKEY_MAP_SIZE); 2186 + } else { 2187 + dbg_printk(TPACPI_DBG_INIT, 2188 + "using IBM default hot key map\n"); 2189 + memcpy(hotkey_keycode_map, &ibm_keycode_map, 2190 + TPACPI_HOTKEY_MAP_SIZE); 2191 + } 2192 + 2193 + set_bit(EV_KEY, tpacpi_inputdev->evbit); 2194 + set_bit(EV_MSC, tpacpi_inputdev->evbit); 2195 + set_bit(MSC_SCAN, tpacpi_inputdev->mscbit); 2196 + tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE; 2197 + tpacpi_inputdev->keycodemax = TPACPI_HOTKEY_MAP_LEN; 2198 + tpacpi_inputdev->keycode = hotkey_keycode_map; 2199 + for (i = 0; i < TPACPI_HOTKEY_MAP_LEN; i++) { 2200 + if (hotkey_keycode_map[i] != KEY_RESERVED) { 2201 + set_bit(hotkey_keycode_map[i], 2202 + tpacpi_inputdev->keybit); 2200 2203 } else { 2201 - dbg_printk(TPACPI_DBG_INIT, 2202 - "using IBM default hot key map\n"); 2203 - memcpy(hotkey_keycode_map, &ibm_keycode_map, 2204 - TPACPI_HOTKEY_MAP_SIZE); 2204 + if (i < sizeof(hotkey_reserved_mask)*8) 2205 + hotkey_reserved_mask |= 1 << i; 2205 2206 } 2206 - 2207 - set_bit(EV_KEY, tpacpi_inputdev->evbit); 2208 - set_bit(EV_MSC, tpacpi_inputdev->evbit); 2209 - set_bit(MSC_SCAN, tpacpi_inputdev->mscbit); 2210 - tpacpi_inputdev->keycodesize = TPACPI_HOTKEY_MAP_TYPESIZE; 2211 - tpacpi_inputdev->keycodemax = TPACPI_HOTKEY_MAP_LEN; 2212 - tpacpi_inputdev->keycode = hotkey_keycode_map; 2213 - for (i = 0; i < TPACPI_HOTKEY_MAP_LEN; i++) { 2214 - if (hotkey_keycode_map[i] != KEY_RESERVED) { 2215 - set_bit(hotkey_keycode_map[i], 2216 - tpacpi_inputdev->keybit); 2217 - } else { 2218 - if (i < sizeof(hotkey_reserved_mask)*8) 2219 - hotkey_reserved_mask |= 1 << i; 2220 - } 2221 - } 2222 - 2223 - if (tp_features.hotkey_wlsw) { 2224 - set_bit(EV_SW, tpacpi_inputdev->evbit); 2225 - set_bit(SW_RADIO, tpacpi_inputdev->swbit); 2226 - } 2227 - if (tp_features.hotkey_tablet) { 2228 - set_bit(EV_SW, tpacpi_inputdev->evbit); 2229 - set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit); 2230 - } 2231 - 2232 - /* Do not issue duplicate brightness change events to 2233 - * userspace */ 2234 - if (!tp_features.bright_acpimode) 2235 - /* update bright_acpimode... */ 2236 - tpacpi_check_std_acpi_brightness_support(); 2237 - 2238 - if (tp_features.bright_acpimode) { 2239 - printk(TPACPI_INFO 2240 - "This ThinkPad has standard ACPI backlight " 2241 - "brightness control, supported by the ACPI " 2242 - "video driver\n"); 2243 - printk(TPACPI_NOTICE 2244 - "Disabling thinkpad-acpi brightness events " 2245 - "by default...\n"); 2246 - 2247 - /* The hotkey_reserved_mask change below is not 2248 - * necessary while the keys are at KEY_RESERVED in the 2249 - * default map, but better safe than sorry, leave it 2250 - * here as a marker of what we have to do, especially 2251 - * when we finally become able to set this at runtime 2252 - * on response to X.org requests */ 2253 - hotkey_reserved_mask |= 2254 - (1 << TP_ACPI_HOTKEYSCAN_FNHOME) 2255 - | (1 << TP_ACPI_HOTKEYSCAN_FNEND); 2256 - } 2257 - 2258 - dbg_printk(TPACPI_DBG_INIT, 2259 - "enabling hot key handling\n"); 2260 - res = hotkey_status_set(1); 2261 - if (res) 2262 - return res; 2263 - res = hotkey_mask_set(((hotkey_all_mask | hotkey_source_mask) 2264 - & ~hotkey_reserved_mask) 2265 - | hotkey_orig_mask); 2266 - if (res < 0 && res != -ENXIO) 2267 - return res; 2268 - 2269 - dbg_printk(TPACPI_DBG_INIT, 2270 - "legacy hot key reporting over procfs %s\n", 2271 - (hotkey_report_mode < 2) ? 2272 - "enabled" : "disabled"); 2273 - 2274 - tpacpi_inputdev->open = &hotkey_inputdev_open; 2275 - tpacpi_inputdev->close = &hotkey_inputdev_close; 2276 - 2277 - hotkey_poll_setup_safe(1); 2278 - tpacpi_input_send_radiosw(); 2279 - tpacpi_input_send_tabletsw(); 2280 2207 } 2281 2208 2282 - return (tp_features.hotkey)? 0 : 1; 2283 - } 2284 - 2285 - static void hotkey_exit(void) 2286 - { 2287 - #ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2288 - hotkey_poll_stop_sync(); 2289 - #endif 2290 - 2291 - if (tp_features.hotkey) { 2292 - dbg_printk(TPACPI_DBG_EXIT, 2293 - "restoring original hot key mask\n"); 2294 - /* no short-circuit boolean operator below! */ 2295 - if ((hotkey_mask_set(hotkey_orig_mask) | 2296 - hotkey_status_set(hotkey_orig_status)) != 0) 2297 - printk(TPACPI_ERR 2298 - "failed to restore hot key mask " 2299 - "to BIOS defaults\n"); 2209 + if (tp_features.hotkey_wlsw) { 2210 + set_bit(EV_SW, tpacpi_inputdev->evbit); 2211 + set_bit(SW_RFKILL_ALL, tpacpi_inputdev->swbit); 2212 + } 2213 + if (tp_features.hotkey_tablet) { 2214 + set_bit(EV_SW, tpacpi_inputdev->evbit); 2215 + set_bit(SW_TABLET_MODE, tpacpi_inputdev->swbit); 2300 2216 } 2301 2217 2302 - if (hotkey_dev_attributes) { 2303 - delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj); 2304 - hotkey_dev_attributes = NULL; 2218 + /* Do not issue duplicate brightness change events to 2219 + * userspace */ 2220 + if (!tp_features.bright_acpimode) 2221 + /* update bright_acpimode... */ 2222 + tpacpi_check_std_acpi_brightness_support(); 2223 + 2224 + if (tp_features.bright_acpimode) { 2225 + printk(TPACPI_INFO 2226 + "This ThinkPad has standard ACPI backlight " 2227 + "brightness control, supported by the ACPI " 2228 + "video driver\n"); 2229 + printk(TPACPI_NOTICE 2230 + "Disabling thinkpad-acpi brightness events " 2231 + "by default...\n"); 2232 + 2233 + /* The hotkey_reserved_mask change below is not 2234 + * necessary while the keys are at KEY_RESERVED in the 2235 + * default map, but better safe than sorry, leave it 2236 + * here as a marker of what we have to do, especially 2237 + * when we finally become able to set this at runtime 2238 + * on response to X.org requests */ 2239 + hotkey_reserved_mask |= 2240 + (1 << TP_ACPI_HOTKEYSCAN_FNHOME) 2241 + | (1 << TP_ACPI_HOTKEYSCAN_FNEND); 2305 2242 } 2243 + 2244 + dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); 2245 + res = hotkey_status_set(1); 2246 + if (res) { 2247 + hotkey_exit(); 2248 + return res; 2249 + } 2250 + res = hotkey_mask_set(((hotkey_all_mask | hotkey_source_mask) 2251 + & ~hotkey_reserved_mask) 2252 + | hotkey_orig_mask); 2253 + if (res < 0 && res != -ENXIO) { 2254 + hotkey_exit(); 2255 + return res; 2256 + } 2257 + 2258 + dbg_printk(TPACPI_DBG_INIT, 2259 + "legacy hot key reporting over procfs %s\n", 2260 + (hotkey_report_mode < 2) ? 2261 + "enabled" : "disabled"); 2262 + 2263 + tpacpi_inputdev->open = &hotkey_inputdev_open; 2264 + tpacpi_inputdev->close = &hotkey_inputdev_close; 2265 + 2266 + hotkey_poll_setup_safe(1); 2267 + tpacpi_input_send_radiosw(); 2268 + tpacpi_input_send_tabletsw(); 2269 + 2270 + return 0; 2271 + 2272 + err_exit: 2273 + delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj); 2274 + hotkey_dev_attributes = NULL; 2275 + 2276 + return (res < 0)? res : 1; 2306 2277 } 2307 2278 2308 2279 static void hotkey_notify(struct ibm_struct *ibm, u32 event) ··· 3336 3319 3337 3320 static int __init light_init(struct ibm_init_struct *iibm) 3338 3321 { 3339 - int rc = 0; 3322 + int rc; 3340 3323 3341 3324 vdbg_printk(TPACPI_DBG_INIT, "initializing light subdriver\n"); 3342 3325 ··· 3354 3337 tp_features.light_status = 3355 3338 acpi_evalf(ec_handle, NULL, "KBLT", "qv"); 3356 3339 3357 - vdbg_printk(TPACPI_DBG_INIT, "light is %s\n", 3358 - str_supported(tp_features.light)); 3340 + vdbg_printk(TPACPI_DBG_INIT, "light is %s, light status is %s\n", 3341 + str_supported(tp_features.light), 3342 + str_supported(tp_features.light_status)); 3359 3343 3360 - if (tp_features.light) { 3361 - rc = led_classdev_register(&tpacpi_pdev->dev, 3362 - &tpacpi_led_thinklight.led_classdev); 3363 - } 3344 + if (!tp_features.light) 3345 + return 1; 3346 + 3347 + rc = led_classdev_register(&tpacpi_pdev->dev, 3348 + &tpacpi_led_thinklight.led_classdev); 3364 3349 3365 3350 if (rc < 0) { 3366 3351 tp_features.light = 0; 3367 3352 tp_features.light_status = 0; 3368 - } else { 3369 - rc = (tp_features.light)? 0 : 1; 3353 + } else { 3354 + rc = 0; 3370 3355 } 3356 + 3371 3357 return rc; 3372 3358 } 3373 3359 ··· 3853 3833 "tpacpi::standby", 3854 3834 }; 3855 3835 3856 - static int led_get_status(unsigned int led) 3836 + static int led_get_status(const unsigned int led) 3857 3837 { 3858 3838 int status; 3859 3839 enum led_status_t led_s; ··· 3877 3857 /* not reached */ 3878 3858 } 3879 3859 3880 - static int led_set_status(unsigned int led, enum led_status_t ledstatus) 3860 + static int led_set_status(const unsigned int led, 3861 + const enum led_status_t ledstatus) 3881 3862 { 3882 3863 /* off, on, blink. Index is led_status_t */ 3883 - static const int led_sled_arg1[] = { 0, 1, 3 }; 3884 - static const int led_exp_hlbl[] = { 0, 0, 1 }; /* led# * */ 3885 - static const int led_exp_hlcl[] = { 0, 1, 1 }; /* led# * */ 3886 - static const int led_led_arg1[] = { 0, 0x80, 0xc0 }; 3864 + static const unsigned int led_sled_arg1[] = { 0, 1, 3 }; 3865 + static const unsigned int led_led_arg1[] = { 0, 0x80, 0xc0 }; 3887 3866 3888 3867 int rc = 0; 3889 3868 3890 3869 switch (led_supported) { 3891 3870 case TPACPI_LED_570: 3892 - /* 570 */ 3893 - led = 1 << led; 3894 - if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3895 - led, led_sled_arg1[ledstatus])) 3896 - rc = -EIO; 3897 - break; 3871 + /* 570 */ 3872 + if (led > 7) 3873 + return -EINVAL; 3874 + if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3875 + (1 << led), led_sled_arg1[ledstatus])) 3876 + rc = -EIO; 3877 + break; 3898 3878 case TPACPI_LED_OLD: 3899 - /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ 3900 - led = 1 << led; 3901 - rc = ec_write(TPACPI_LED_EC_HLMS, led); 3902 - if (rc >= 0) 3903 - rc = ec_write(TPACPI_LED_EC_HLBL, 3904 - led * led_exp_hlbl[ledstatus]); 3905 - if (rc >= 0) 3906 - rc = ec_write(TPACPI_LED_EC_HLCL, 3907 - led * led_exp_hlcl[ledstatus]); 3908 - break; 3879 + /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20 */ 3880 + if (led > 7) 3881 + return -EINVAL; 3882 + rc = ec_write(TPACPI_LED_EC_HLMS, (1 << led)); 3883 + if (rc >= 0) 3884 + rc = ec_write(TPACPI_LED_EC_HLBL, 3885 + (ledstatus == TPACPI_LED_BLINK) << led); 3886 + if (rc >= 0) 3887 + rc = ec_write(TPACPI_LED_EC_HLCL, 3888 + (ledstatus != TPACPI_LED_OFF) << led); 3889 + break; 3909 3890 case TPACPI_LED_NEW: 3910 - /* all others */ 3911 - if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3912 - led, led_led_arg1[ledstatus])) 3913 - rc = -EIO; 3914 - break; 3891 + /* all others */ 3892 + if (!acpi_evalf(led_handle, NULL, NULL, "vdd", 3893 + led, led_led_arg1[ledstatus])) 3894 + rc = -EIO; 3895 + break; 3915 3896 default: 3916 3897 rc = -ENXIO; 3917 3898 } ··· 3999 3978 } 4000 3979 4001 3980 kfree(tpacpi_leds); 4002 - tpacpi_leds = NULL; 4003 3981 } 4004 3982 4005 3983 static int __init led_init(struct ibm_init_struct *iibm) ··· 4822 4802 vdbg_printk(TPACPI_DBG_EXIT, 4823 4803 "calling backlight_device_unregister()\n"); 4824 4804 backlight_device_unregister(ibm_backlight_device); 4825 - ibm_backlight_device = NULL; 4826 4805 } 4827 4806 } 4828 4807 ··· 5783 5764 fan_control_access_mode != TPACPI_FAN_WR_NONE) { 5784 5765 rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, 5785 5766 &fan_attr_group); 5786 - if (!(rc < 0)) 5787 - rc = driver_create_file(&tpacpi_hwmon_pdriver.driver, 5788 - &driver_attr_fan_watchdog); 5789 5767 if (rc < 0) 5790 5768 return rc; 5769 + 5770 + rc = driver_create_file(&tpacpi_hwmon_pdriver.driver, 5771 + &driver_attr_fan_watchdog); 5772 + if (rc < 0) { 5773 + sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, 5774 + &fan_attr_group); 5775 + return rc; 5776 + } 5791 5777 return 0; 5792 5778 } else 5793 5779 return 1;
+29 -17
drivers/pnp/pnpacpi/rsparser.c
··· 50 50 flags = IORESOURCE_IRQ_HIGHEDGE; 51 51 } 52 52 53 - if (shareable) 53 + if (shareable == ACPI_SHARED) 54 54 flags |= IORESOURCE_IRQ_SHAREABLE; 55 55 56 56 return flags; 57 57 } 58 58 59 - static void decode_irq_flags(int flag, int *triggering, int *polarity) 59 + static void decode_irq_flags(struct pnp_dev *dev, int flags, int *triggering, 60 + int *polarity, int *shareable) 60 61 { 61 - switch (flag) { 62 + switch (flags & (IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL | 63 + IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE)) { 62 64 case IORESOURCE_IRQ_LOWLEVEL: 63 65 *triggering = ACPI_LEVEL_SENSITIVE; 64 66 *polarity = ACPI_ACTIVE_LOW; ··· 77 75 *triggering = ACPI_EDGE_SENSITIVE; 78 76 *polarity = ACPI_ACTIVE_HIGH; 79 77 break; 78 + default: 79 + dev_err(&dev->dev, "can't encode invalid IRQ mode %#x\n", 80 + flags); 81 + *triggering = ACPI_EDGE_SENSITIVE; 82 + *polarity = ACPI_ACTIVE_HIGH; 83 + break; 80 84 } 85 + 86 + if (flags & IORESOURCE_IRQ_SHAREABLE) 87 + *shareable = ACPI_SHARED; 88 + else 89 + *shareable = ACPI_EXCLUSIVE; 81 90 } 82 91 83 92 static void pnpacpi_parse_allocated_irqresource(struct pnp_dev *dev, ··· 755 742 if (pnpacpi_supported_resource(res)) { 756 743 (*resource)->type = res->type; 757 744 (*resource)->length = sizeof(struct acpi_resource); 745 + if (res->type == ACPI_RESOURCE_TYPE_IRQ) 746 + (*resource)->data.irq.descriptor_length = 747 + res->data.irq.descriptor_length; 758 748 (*resource)++; 759 749 } 760 750 ··· 804 788 struct resource *p) 805 789 { 806 790 struct acpi_resource_irq *irq = &resource->data.irq; 807 - int triggering, polarity; 791 + int triggering, polarity, shareable; 808 792 809 - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); 793 + decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable); 810 794 irq->triggering = triggering; 811 795 irq->polarity = polarity; 812 - if (triggering == ACPI_EDGE_SENSITIVE) 813 - irq->sharable = ACPI_EXCLUSIVE; 814 - else 815 - irq->sharable = ACPI_SHARED; 796 + irq->sharable = shareable; 816 797 irq->interrupt_count = 1; 817 798 irq->interrupts[0] = p->start; 818 799 819 - dev_dbg(&dev->dev, " encode irq %d %s %s %s\n", (int) p->start, 800 + dev_dbg(&dev->dev, " encode irq %d %s %s %s (%d-byte descriptor)\n", 801 + (int) p->start, 820 802 triggering == ACPI_LEVEL_SENSITIVE ? "level" : "edge", 821 803 polarity == ACPI_ACTIVE_LOW ? "low" : "high", 822 - irq->sharable == ACPI_SHARED ? "shared" : "exclusive"); 804 + irq->sharable == ACPI_SHARED ? "shared" : "exclusive", 805 + irq->descriptor_length); 823 806 } 824 807 825 808 static void pnpacpi_encode_ext_irq(struct pnp_dev *dev, ··· 826 811 struct resource *p) 827 812 { 828 813 struct acpi_resource_extended_irq *extended_irq = &resource->data.extended_irq; 829 - int triggering, polarity; 814 + int triggering, polarity, shareable; 830 815 831 - decode_irq_flags(p->flags & IORESOURCE_BITS, &triggering, &polarity); 816 + decode_irq_flags(dev, p->flags, &triggering, &polarity, &shareable); 832 817 extended_irq->producer_consumer = ACPI_CONSUMER; 833 818 extended_irq->triggering = triggering; 834 819 extended_irq->polarity = polarity; 835 - if (triggering == ACPI_EDGE_SENSITIVE) 836 - extended_irq->sharable = ACPI_EXCLUSIVE; 837 - else 838 - extended_irq->sharable = ACPI_SHARED; 820 + extended_irq->sharable = shareable; 839 821 extended_irq->interrupt_count = 1; 840 822 extended_irq->interrupts[0] = p->start; 841 823
+1
include/acpi/processor.h
··· 319 319 #endif /* CONFIG_CPU_FREQ */ 320 320 321 321 /* in processor_throttling.c */ 322 + int acpi_processor_tstate_has_changed(struct acpi_processor *pr); 322 323 int acpi_processor_get_throttling_info(struct acpi_processor *pr); 323 324 extern int acpi_processor_set_throttling(struct acpi_processor *pr, int state); 324 325 extern struct file_operations acpi_processor_throttling_fops;
+1
include/linux/cpuidle.h
··· 82 82 }; 83 83 84 84 struct cpuidle_device { 85 + unsigned int registered:1; 85 86 unsigned int enabled:1; 86 87 unsigned int cpu; 87 88
+3 -3
include/linux/ioport.h
··· 53 53 #define IORESOURCE_AUTO 0x40000000 54 54 #define IORESOURCE_BUSY 0x80000000 /* Driver has marked this resource busy */ 55 55 56 - /* ISA PnP IRQ specific bits (IORESOURCE_BITS) */ 56 + /* PnP IRQ specific bits (IORESOURCE_BITS) */ 57 57 #define IORESOURCE_IRQ_HIGHEDGE (1<<0) 58 58 #define IORESOURCE_IRQ_LOWEDGE (1<<1) 59 59 #define IORESOURCE_IRQ_HIGHLEVEL (1<<2) 60 60 #define IORESOURCE_IRQ_LOWLEVEL (1<<3) 61 61 #define IORESOURCE_IRQ_SHAREABLE (1<<4) 62 62 63 - /* ISA PnP DMA specific bits (IORESOURCE_BITS) */ 63 + /* PnP DMA specific bits (IORESOURCE_BITS) */ 64 64 #define IORESOURCE_DMA_TYPE_MASK (3<<0) 65 65 #define IORESOURCE_DMA_8BIT (0<<0) 66 66 #define IORESOURCE_DMA_8AND16BIT (1<<0) ··· 76 76 #define IORESOURCE_DMA_TYPEB (2<<6) 77 77 #define IORESOURCE_DMA_TYPEF (3<<6) 78 78 79 - /* ISA PnP memory I/O specific bits (IORESOURCE_BITS) */ 79 + /* PnP memory I/O specific bits (IORESOURCE_BITS) */ 80 80 #define IORESOURCE_MEM_WRITEABLE (1<<0) /* dup: IORESOURCE_READONLY */ 81 81 #define IORESOURCE_MEM_CACHEABLE (1<<1) /* dup: IORESOURCE_CACHEABLE */ 82 82 #define IORESOURCE_MEM_RANGELENGTH (1<<2) /* dup: IORESOURCE_RANGELENGTH */