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)
ACPI: delete acpi_processor_power_verify_c2()
ACPI: allow C3 > 1000usec
ACPI: enable C2 and Turbo-mode on Nehalem notebooks on A/C
ACPI: power_meter: remove double kfree()
ACPI: processor: restrict early _PDC to opt-in platforms
ACPI: Fix unused variable warning in sbs.c
acpi: make ACPI device id constant
sony-laptop - fix using of uninitialized variable
ACPI: Fix section mismatch error for acpi_early_processor_set_pdc()
eeepc-laptop: disable wireless hotplug for 1201N
eeepc-laptop: add hotplug_disable parameter
eeepc-laptop: switch to using sparse keymap library
eeepc-laptop: dmi blacklist to disable pci hotplug code
eeepc-laptop: disable cpu speed control on EeePC 701
ACPI: don't cond_resched if irq is disabled
ACPI: Remove unnecessary cast.
ACPI: Advertise to BIOS in _OSC: _OST on _PPC changes
ACPI: EC: Add wait for irq storm
ACPI: SBS: Move SBS HC callback to faster Notify queue
x86, ACPI: delete acpi_boot_table_init() return value
...

+396 -269
+6 -16
arch/x86/kernel/acpi/boot.c
··· 1529 1529 * if acpi_blacklisted() acpi_disabled = 1; 1530 1530 * acpi_irq_model=... 1531 1531 * ... 1532 - * 1533 - * return value: (currently ignored) 1534 - * 0: success 1535 - * !0: failure 1536 1532 */ 1537 1533 1538 - int __init acpi_boot_table_init(void) 1534 + void __init acpi_boot_table_init(void) 1539 1535 { 1540 - int error; 1541 - 1542 1536 dmi_check_system(acpi_dmi_table); 1543 1537 1544 1538 /* ··· 1540 1546 * One exception: acpi=ht continues far enough to enumerate LAPICs 1541 1547 */ 1542 1548 if (acpi_disabled && !acpi_ht) 1543 - return 1; 1549 + return; 1544 1550 1545 1551 /* 1546 1552 * Initialize the ACPI boot-time table parser. 1547 1553 */ 1548 - error = acpi_table_init(); 1549 - if (error) { 1554 + if (acpi_table_init()) { 1550 1555 disable_acpi(); 1551 - return error; 1556 + return; 1552 1557 } 1553 1558 1554 1559 acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf); ··· 1555 1562 /* 1556 1563 * blacklist may disable ACPI entirely 1557 1564 */ 1558 - error = acpi_blacklisted(); 1559 - if (error) { 1565 + if (acpi_blacklisted()) { 1560 1566 if (acpi_force) { 1561 1567 printk(KERN_WARNING PREFIX "acpi=force override\n"); 1562 1568 } else { 1563 1569 printk(KERN_WARNING PREFIX "Disabling ACPI support\n"); 1564 1570 disable_acpi(); 1565 - return error; 1571 + return; 1566 1572 } 1567 1573 } 1568 - 1569 - return 0; 1570 1574 } 1571 1575 1572 1576 int __init early_acpi_boot_init(void)
+20 -17
drivers/acpi/acpi_pad.c
··· 208 208 * the mechanism only works when all CPUs have RT task running, 209 209 * as if one CPU hasn't RT task, RT task from other CPUs will 210 210 * borrow CPU time from this CPU and cause RT task use > 95% 211 - * CPU time. To make 'avoid staration' work, takes a nap here. 211 + * CPU time. To make 'avoid starvation' work, takes a nap here. 212 212 */ 213 213 if (do_sleep) 214 214 schedule_timeout_killable(HZ * idle_pct / 100); ··· 222 222 static unsigned int ps_tsk_num; 223 223 static int create_power_saving_task(void) 224 224 { 225 + int rc = -ENOMEM; 226 + 225 227 ps_tsks[ps_tsk_num] = kthread_run(power_saving_thread, 226 228 (void *)(unsigned long)ps_tsk_num, 227 229 "power_saving/%d", ps_tsk_num); 228 - if (ps_tsks[ps_tsk_num]) { 230 + rc = IS_ERR(ps_tsks[ps_tsk_num]) ? PTR_ERR(ps_tsks[ps_tsk_num]) : 0; 231 + if (!rc) 229 232 ps_tsk_num++; 230 - return 0; 231 - } 232 - return -EINVAL; 233 + else 234 + ps_tsks[ps_tsk_num] = NULL; 235 + 236 + return rc; 233 237 } 234 238 235 239 static void destroy_power_saving_task(void) ··· 241 237 if (ps_tsk_num > 0) { 242 238 ps_tsk_num--; 243 239 kthread_stop(ps_tsks[ps_tsk_num]); 240 + ps_tsks[ps_tsk_num] = NULL; 244 241 } 245 242 } 246 243 ··· 258 253 } 259 254 } 260 255 261 - static int acpi_pad_idle_cpus(unsigned int num_cpus) 256 + static void acpi_pad_idle_cpus(unsigned int num_cpus) 262 257 { 263 258 get_online_cpus(); 264 259 ··· 266 261 set_power_saving_task_num(num_cpus); 267 262 268 263 put_online_cpus(); 269 - return 0; 270 264 } 271 265 272 266 static uint32_t acpi_pad_idle_cpus_num(void) ··· 373 369 static int acpi_pad_pur(acpi_handle handle, int *num_cpus) 374 370 { 375 371 struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; 376 - acpi_status status; 377 372 union acpi_object *package; 378 373 int rev, num, ret = -EINVAL; 379 374 380 - status = acpi_evaluate_object(handle, "_PUR", NULL, &buffer); 381 - if (ACPI_FAILURE(status)) 375 + if (ACPI_FAILURE(acpi_evaluate_object(handle, "_PUR", NULL, &buffer))) 382 376 return -EINVAL; 377 + 378 + if (!buffer.length || !buffer.pointer) 379 + return -EINVAL; 380 + 383 381 package = buffer.pointer; 384 382 if (package->type != ACPI_TYPE_PACKAGE || package->package.count != 2) 385 383 goto out; 386 384 rev = package->package.elements[0].integer.value; 387 385 num = package->package.elements[1].integer.value; 388 - if (rev != 1) 386 + if (rev != 1 || num < 0) 389 387 goto out; 390 388 *num_cpus = num; 391 389 ret = 0; ··· 416 410 417 411 static void acpi_pad_handle_notify(acpi_handle handle) 418 412 { 419 - int num_cpus, ret; 413 + int num_cpus; 420 414 uint32_t idle_cpus; 421 415 422 416 mutex_lock(&isolated_cpus_lock); ··· 424 418 mutex_unlock(&isolated_cpus_lock); 425 419 return; 426 420 } 427 - ret = acpi_pad_idle_cpus(num_cpus); 421 + acpi_pad_idle_cpus(num_cpus); 428 422 idle_cpus = acpi_pad_idle_cpus_num(); 429 - if (!ret) 430 - acpi_pad_ost(handle, 0, idle_cpus); 431 - else 432 - acpi_pad_ost(handle, 1, 0); 423 + acpi_pad_ost(handle, 0, idle_cpus); 433 424 mutex_unlock(&isolated_cpus_lock); 434 425 } 435 426
+6 -1
drivers/acpi/bus.c
··· 490 490 491 491 capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; 492 492 capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ 493 - #ifdef CONFIG_ACPI_PROCESSOR_AGGREGATOR 493 + #if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\ 494 + defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE) 494 495 capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT; 496 + #endif 497 + 498 + #if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE) 499 + capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT; 495 500 #endif 496 501 if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) 497 502 return;
+80 -46
drivers/acpi/ec.c
··· 201 201 spin_unlock_irqrestore(&ec->curr_lock, flags); 202 202 } 203 203 204 - static void acpi_ec_gpe_query(void *ec_cxt); 204 + static int acpi_ec_sync_query(struct acpi_ec *ec); 205 205 206 - static int ec_check_sci(struct acpi_ec *ec, u8 state) 206 + static int ec_check_sci_sync(struct acpi_ec *ec, u8 state) 207 207 { 208 208 if (state & ACPI_EC_FLAG_SCI) { 209 209 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) 210 - return acpi_os_execute(OSL_EC_BURST_HANDLER, 211 - acpi_ec_gpe_query, ec); 210 + return acpi_ec_sync_query(ec); 212 211 } 213 212 return 0; 214 213 } ··· 248 249 { 249 250 unsigned long tmp; 250 251 int ret = 0; 251 - pr_debug(PREFIX "transaction start\n"); 252 - /* disable GPE during transaction if storm is detected */ 253 - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 254 - acpi_disable_gpe(NULL, ec->gpe); 255 - } 256 252 if (EC_FLAGS_MSI) 257 253 udelay(ACPI_EC_MSI_UDELAY); 258 254 /* start transaction */ ··· 259 265 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); 260 266 spin_unlock_irqrestore(&ec->curr_lock, tmp); 261 267 ret = ec_poll(ec); 262 - pr_debug(PREFIX "transaction end\n"); 263 268 spin_lock_irqsave(&ec->curr_lock, tmp); 264 269 ec->curr = NULL; 265 270 spin_unlock_irqrestore(&ec->curr_lock, tmp); 266 - if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 267 - /* check if we received SCI during transaction */ 268 - ec_check_sci(ec, acpi_ec_read_status(ec)); 269 - /* it is safe to enable GPE outside of transaction */ 270 - acpi_enable_gpe(NULL, ec->gpe); 271 - } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { 272 - pr_info(PREFIX "GPE storm detected, " 273 - "transactions will use polling mode\n"); 274 - set_bit(EC_FLAGS_GPE_STORM, &ec->flags); 275 - } 276 271 return ret; 277 272 } 278 273 ··· 304 321 status = -ETIME; 305 322 goto end; 306 323 } 324 + pr_debug(PREFIX "transaction start\n"); 325 + /* disable GPE during transaction if storm is detected */ 326 + if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 327 + acpi_disable_gpe(NULL, ec->gpe); 328 + } 329 + 307 330 status = acpi_ec_transaction_unlocked(ec, t); 331 + 332 + /* check if we received SCI during transaction */ 333 + ec_check_sci_sync(ec, acpi_ec_read_status(ec)); 334 + if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { 335 + msleep(1); 336 + /* it is safe to enable GPE outside of transaction */ 337 + acpi_enable_gpe(NULL, ec->gpe); 338 + } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) { 339 + pr_info(PREFIX "GPE storm detected, " 340 + "transactions will use polling mode\n"); 341 + set_bit(EC_FLAGS_GPE_STORM, &ec->flags); 342 + } 343 + pr_debug(PREFIX "transaction end\n"); 308 344 end: 309 345 if (ec->global_lock) 310 346 acpi_release_global_lock(glk); ··· 445 443 446 444 EXPORT_SYMBOL(ec_transaction); 447 445 448 - static int acpi_ec_query(struct acpi_ec *ec, u8 * data) 446 + static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data) 449 447 { 450 448 int result; 451 449 u8 d; ··· 454 452 .wlen = 0, .rlen = 1}; 455 453 if (!ec || !data) 456 454 return -EINVAL; 457 - 458 455 /* 459 456 * Query the EC to find out which _Qxx method we need to evaluate. 460 457 * Note that successful completion of the query causes the ACPI_EC_SCI 461 458 * bit to be cleared (and thus clearing the interrupt source). 462 459 */ 463 - 464 - result = acpi_ec_transaction(ec, &t); 460 + result = acpi_ec_transaction_unlocked(ec, &t); 465 461 if (result) 466 462 return result; 467 - 468 463 if (!d) 469 464 return -ENODATA; 470 - 471 465 *data = d; 472 466 return 0; 473 467 } ··· 507 509 508 510 EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler); 509 511 510 - static void acpi_ec_gpe_query(void *ec_cxt) 512 + static void acpi_ec_run(void *cxt) 511 513 { 512 - struct acpi_ec *ec = ec_cxt; 513 - u8 value = 0; 514 - struct acpi_ec_query_handler *handler, copy; 515 - 516 - if (!ec || acpi_ec_query(ec, &value)) 514 + struct acpi_ec_query_handler *handler = cxt; 515 + if (!handler) 517 516 return; 518 - mutex_lock(&ec->lock); 517 + pr_debug(PREFIX "start query execution\n"); 518 + if (handler->func) 519 + handler->func(handler->data); 520 + else if (handler->handle) 521 + acpi_evaluate_object(handler->handle, NULL, NULL, NULL); 522 + pr_debug(PREFIX "stop query execution\n"); 523 + kfree(handler); 524 + } 525 + 526 + static int acpi_ec_sync_query(struct acpi_ec *ec) 527 + { 528 + u8 value = 0; 529 + int status; 530 + struct acpi_ec_query_handler *handler, *copy; 531 + if ((status = acpi_ec_query_unlocked(ec, &value))) 532 + return status; 519 533 list_for_each_entry(handler, &ec->list, node) { 520 534 if (value == handler->query_bit) { 521 535 /* have custom handler for this bit */ 522 - memcpy(&copy, handler, sizeof(copy)); 523 - mutex_unlock(&ec->lock); 524 - if (copy.func) { 525 - copy.func(copy.data); 526 - } else if (copy.handle) { 527 - acpi_evaluate_object(copy.handle, NULL, NULL, NULL); 528 - } 529 - return; 536 + copy = kmalloc(sizeof(*handler), GFP_KERNEL); 537 + if (!copy) 538 + return -ENOMEM; 539 + memcpy(copy, handler, sizeof(*copy)); 540 + pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value); 541 + return acpi_os_execute((copy->func) ? 542 + OSL_NOTIFY_HANDLER : OSL_GPE_HANDLER, 543 + acpi_ec_run, copy); 530 544 } 531 545 } 546 + return 0; 547 + } 548 + 549 + static void acpi_ec_gpe_query(void *ec_cxt) 550 + { 551 + struct acpi_ec *ec = ec_cxt; 552 + if (!ec) 553 + return; 554 + mutex_lock(&ec->lock); 555 + acpi_ec_sync_query(ec); 532 556 mutex_unlock(&ec->lock); 557 + } 558 + 559 + static void acpi_ec_gpe_query(void *ec_cxt); 560 + 561 + static int ec_check_sci(struct acpi_ec *ec, u8 state) 562 + { 563 + if (state & ACPI_EC_FLAG_SCI) { 564 + if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { 565 + pr_debug(PREFIX "push gpe query to the queue\n"); 566 + return acpi_os_execute(OSL_NOTIFY_HANDLER, 567 + acpi_ec_gpe_query, ec); 568 + } 569 + } 570 + return 0; 533 571 } 534 572 535 573 static u32 acpi_ec_gpe_handler(void *data) 536 574 { 537 575 struct acpi_ec *ec = data; 538 - u8 status; 539 576 540 577 pr_debug(PREFIX "~~~> interrupt\n"); 541 - status = acpi_ec_read_status(ec); 542 578 543 - advance_transaction(ec, status); 544 - if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0) 579 + advance_transaction(ec, acpi_ec_read_status(ec)); 580 + if (ec_transaction_done(ec) && 581 + (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) { 545 582 wake_up(&ec->wait); 546 - ec_check_sci(ec, status); 583 + ec_check_sci(ec, acpi_ec_read_status(ec)); 584 + } 547 585 return ACPI_INTERRUPT_HANDLED; 548 586 } 549 587
+1 -1
drivers/acpi/pci_link.c
··· 56 56 static int acpi_pci_link_add(struct acpi_device *device); 57 57 static int acpi_pci_link_remove(struct acpi_device *device, int type); 58 58 59 - static struct acpi_device_id link_device_ids[] = { 59 + static const struct acpi_device_id link_device_ids[] = { 60 60 {"PNP0C0F", 0}, 61 61 {"", 0}, 62 62 };
+1 -1
drivers/acpi/pci_root.c
··· 46 46 static int acpi_pci_root_remove(struct acpi_device *device, int type); 47 47 static int acpi_pci_root_start(struct acpi_device *device); 48 48 49 - static struct acpi_device_id root_device_ids[] = { 49 + static const struct acpi_device_id root_device_ids[] = { 50 50 {"PNP0A03", 0}, 51 51 {"", 0}, 52 52 };
+1 -1
drivers/acpi/power.c
··· 65 65 static int acpi_power_resume(struct acpi_device *device); 66 66 static int acpi_power_open_fs(struct inode *inode, struct file *file); 67 67 68 - static struct acpi_device_id power_device_ids[] = { 68 + static const struct acpi_device_id power_device_ids[] = { 69 69 {ACPI_POWER_HID, 0}, 70 70 {"", 0}, 71 71 };
+2 -2
drivers/acpi/power_meter.c
··· 64 64 return force_cap_on || cap_in_hardware; 65 65 } 66 66 67 - static struct acpi_device_id power_meter_ids[] = { 67 + static const struct acpi_device_id power_meter_ids[] = { 68 68 {"ACPI000D", 0}, 69 69 {"", 0}, 70 70 }; ··· 534 534 535 535 kfree(resource->domain_devices); 536 536 kobject_put(resource->holders_dir); 537 + resource->num_domain_devices = 0; 537 538 } 538 539 539 540 static int read_domain_devices(struct acpi_power_meter_resource *resource) ··· 741 740 742 741 return res; 743 742 error: 744 - remove_domain_devices(resource); 745 743 remove_attrs(resource); 746 744 return res; 747 745 }
+26 -38
drivers/acpi/processor_idle.c
··· 305 305 pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency; 306 306 pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency; 307 307 308 + /* 309 + * FADT specified C2 latency must be less than or equal to 310 + * 100 microseconds. 311 + */ 312 + if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { 313 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, 314 + "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency)); 315 + /* invalidate C2 */ 316 + pr->power.states[ACPI_STATE_C2].address = 0; 317 + } 318 + 319 + /* 320 + * FADT supplied C3 latency must be less than or equal to 321 + * 1000 microseconds. 322 + */ 323 + if (acpi_gbl_FADT.C3latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { 324 + ACPI_DEBUG_PRINT((ACPI_DB_INFO, 325 + "C3 latency too large [%d]\n", acpi_gbl_FADT.C3latency)); 326 + /* invalidate C3 */ 327 + pr->power.states[ACPI_STATE_C3].address = 0; 328 + } 329 + 308 330 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 309 331 "lvl2[0x%08x] lvl3[0x%08x]\n", 310 332 pr->power.states[ACPI_STATE_C2].address, ··· 516 494 return status; 517 495 } 518 496 519 - static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx) 520 - { 521 - 522 - if (!cx->address) 523 - return; 524 - 525 - /* 526 - * C2 latency must be less than or equal to 100 527 - * microseconds. 528 - */ 529 - else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) { 530 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 531 - "latency too large [%d]\n", cx->latency)); 532 - return; 533 - } 534 - 535 - /* 536 - * Otherwise we've met all of our C2 requirements. 537 - * Normalize the C2 latency to expidite policy 538 - */ 539 - cx->valid = 1; 540 - 541 - cx->latency_ticks = cx->latency; 542 - 543 - return; 544 - } 545 - 546 497 static void acpi_processor_power_verify_c3(struct acpi_processor *pr, 547 498 struct acpi_processor_cx *cx) 548 499 { ··· 525 530 526 531 if (!cx->address) 527 532 return; 528 - 529 - /* 530 - * C3 latency must be less than or equal to 1000 531 - * microseconds. 532 - */ 533 - else if (cx->latency > ACPI_PROCESSOR_MAX_C3_LATENCY) { 534 - ACPI_DEBUG_PRINT((ACPI_DB_INFO, 535 - "latency too large [%d]\n", cx->latency)); 536 - return; 537 - } 538 533 539 534 /* 540 535 * PIIX4 Erratum #18: We don't support C3 when Type-F (fast) ··· 614 629 break; 615 630 616 631 case ACPI_STATE_C2: 617 - acpi_processor_power_verify_c2(cx); 632 + if (!cx->address) 633 + break; 634 + cx->valid = 1; 635 + cx->latency_ticks = cx->latency; /* Normalize latency */ 618 636 break; 619 637 620 638 case ACPI_STATE_C3:
+31 -1
drivers/acpi/processor_pdc.c
··· 144 144 } 145 145 EXPORT_SYMBOL_GPL(acpi_processor_set_pdc); 146 146 147 + static int early_pdc_optin; 148 + static int set_early_pdc_optin(const struct dmi_system_id *id) 149 + { 150 + early_pdc_optin = 1; 151 + return 0; 152 + } 153 + 154 + static struct dmi_system_id __cpuinitdata early_pdc_optin_table[] = { 155 + { 156 + set_early_pdc_optin, "HP Envy", { 157 + DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), 158 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Envy") }, NULL}, 159 + { 160 + set_early_pdc_optin, "HP Pavilion dv6", { 161 + DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), 162 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv6") }, NULL}, 163 + { 164 + set_early_pdc_optin, "HP Pavilion dv7", { 165 + DMI_MATCH(DMI_BIOS_VENDOR, "Hewlett-Packard"), 166 + DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv7") }, NULL}, 167 + {}, 168 + }; 169 + 147 170 static acpi_status 148 171 early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) 149 172 { ··· 174 151 return AE_OK; 175 152 } 176 153 177 - void acpi_early_processor_set_pdc(void) 154 + void __init acpi_early_processor_set_pdc(void) 178 155 { 179 156 /* 180 157 * Check whether the system is DMI table. If yes, OSPM 181 158 * should not use mwait for CPU-states. 182 159 */ 183 160 dmi_check_system(processor_idle_dmi_table); 161 + 162 + /* 163 + * Allow systems to opt-in to early _PDC evaluation. 164 + */ 165 + dmi_check_system(early_pdc_optin_table); 166 + if (!early_pdc_optin) 167 + return; 184 168 185 169 acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, 186 170 ACPI_UINT32_MAX,
+1 -2
drivers/acpi/processor_thermal.c
··· 443 443 #ifdef CONFIG_ACPI_PROCFS 444 444 static int acpi_processor_limit_seq_show(struct seq_file *seq, void *offset) 445 445 { 446 - struct acpi_processor *pr = (struct acpi_processor *)seq->private; 447 - 446 + struct acpi_processor *pr = seq->private; 448 447 449 448 if (!pr) 450 449 goto end;
+3
drivers/acpi/sbs.c
··· 822 822 823 823 static void acpi_battery_remove(struct acpi_sbs *sbs, int id) 824 824 { 825 + #if defined(CONFIG_ACPI_SYSFS_POWER) || defined(CONFIG_ACPI_PROCFS_POWER) 825 826 struct acpi_battery *battery = &sbs->battery[id]; 827 + #endif 828 + 826 829 #ifdef CONFIG_ACPI_SYSFS_POWER 827 830 if (battery->bat.dev) { 828 831 if (battery->have_sysfs_alarm)
+1 -1
drivers/acpi/sbshc.c
··· 242 242 case ACPI_SBS_CHARGER: 243 243 case ACPI_SBS_MANAGER: 244 244 case ACPI_SBS_BATTERY: 245 - acpi_os_execute(OSL_GPE_HANDLER, 245 + acpi_os_execute(OSL_NOTIFY_HANDLER, 246 246 acpi_smbus_callback, hc); 247 247 default:; 248 248 }
+43
drivers/acpi/video.c
··· 78 78 static int brightness_switch_enabled = 1; 79 79 module_param(brightness_switch_enabled, bool, 0644); 80 80 81 + /* 82 + * By default, we don't allow duplicate ACPI video bus devices 83 + * under the same VGA controller 84 + */ 85 + static int allow_duplicates; 86 + module_param(allow_duplicates, bool, 0644); 87 + 81 88 static int register_count = 0; 82 89 static int acpi_video_bus_add(struct acpi_device *device); 83 90 static int acpi_video_bus_remove(struct acpi_device *device, int type); ··· 2246 2239 return AE_OK; 2247 2240 } 2248 2241 2242 + static acpi_status 2243 + acpi_video_bus_match(acpi_handle handle, u32 level, void *context, 2244 + void **return_value) 2245 + { 2246 + struct acpi_device *device = context; 2247 + struct acpi_device *sibling; 2248 + int result; 2249 + 2250 + if (handle == device->handle) 2251 + return AE_CTRL_TERMINATE; 2252 + 2253 + result = acpi_bus_get_device(handle, &sibling); 2254 + if (result) 2255 + return AE_OK; 2256 + 2257 + if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME)) 2258 + return AE_ALREADY_EXISTS; 2259 + 2260 + return AE_OK; 2261 + } 2262 + 2249 2263 static int acpi_video_bus_add(struct acpi_device *device) 2250 2264 { 2251 2265 struct acpi_video_bus *video; 2252 2266 struct input_dev *input; 2253 2267 int error; 2268 + acpi_status status; 2269 + 2270 + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, 2271 + device->parent->handle, 1, 2272 + acpi_video_bus_match, NULL, 2273 + device, NULL); 2274 + if (status == AE_ALREADY_EXISTS) { 2275 + printk(KERN_WARNING FW_BUG 2276 + "Duplicate ACPI video bus devices for the" 2277 + " same VGA controller, please try module " 2278 + "parameter \"video.allow_duplicates=1\"" 2279 + "if the current driver doesn't work.\n"); 2280 + if (!allow_duplicates) 2281 + return -ENODEV; 2282 + } 2254 2283 2255 2284 video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); 2256 2285 if (!video)
+1
drivers/platform/x86/Kconfig
··· 364 364 select HWMON 365 365 select LEDS_CLASS 366 366 select NEW_LEDS 367 + select INPUT_SPARSEKMAP 367 368 ---help--- 368 369 This driver supports the Fn-Fx keys on Eee PC laptops. 369 370
+163 -135
drivers/platform/x86/eeepc-laptop.c
··· 31 31 #include <acpi/acpi_bus.h> 32 32 #include <linux/uaccess.h> 33 33 #include <linux/input.h> 34 + #include <linux/input/sparse-keymap.h> 34 35 #include <linux/rfkill.h> 35 36 #include <linux/pci.h> 36 37 #include <linux/pci_hotplug.h> 37 38 #include <linux/leds.h> 39 + #include <linux/dmi.h> 38 40 39 41 #define EEEPC_LAPTOP_VERSION "0.1" 40 42 #define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver" ··· 49 47 MODULE_AUTHOR("Corentin Chary, Eric Cooper"); 50 48 MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME); 51 49 MODULE_LICENSE("GPL"); 50 + 51 + static bool hotplug_disabled; 52 + 53 + module_param(hotplug_disabled, bool, 0644); 54 + MODULE_PARM_DESC(hotplug_disabled, 55 + "Disable hotplug for wireless device. " 56 + "If your laptop need that, please report to " 57 + "acpi4asus-user@lists.sourceforge.net."); 52 58 53 59 /* 54 60 * Definitions for Asus EeePC ··· 130 120 NULL, NULL, "PBPS", "TPDS" 131 121 }; 132 122 133 - struct key_entry { 134 - char type; 135 - u8 code; 136 - u16 keycode; 137 - }; 138 - 139 - enum { KE_KEY, KE_END }; 140 - 141 123 static const struct key_entry eeepc_keymap[] = { 142 - /* Sleep already handled via generic ACPI code */ 143 - {KE_KEY, 0x10, KEY_WLAN }, 144 - {KE_KEY, 0x11, KEY_WLAN }, 145 - {KE_KEY, 0x12, KEY_PROG1 }, 146 - {KE_KEY, 0x13, KEY_MUTE }, 147 - {KE_KEY, 0x14, KEY_VOLUMEDOWN }, 148 - {KE_KEY, 0x15, KEY_VOLUMEUP }, 149 - {KE_KEY, 0x16, KEY_DISPLAY_OFF }, 150 - {KE_KEY, 0x1a, KEY_COFFEE }, 151 - {KE_KEY, 0x1b, KEY_ZOOM }, 152 - {KE_KEY, 0x1c, KEY_PROG2 }, 153 - {KE_KEY, 0x1d, KEY_PROG3 }, 154 - {KE_KEY, NOTIFY_BRN_MIN, KEY_BRIGHTNESSDOWN }, 155 - {KE_KEY, NOTIFY_BRN_MAX, KEY_BRIGHTNESSUP }, 156 - {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, 157 - {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, 158 - {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, 159 - {KE_KEY, 0x37, KEY_F13 }, /* Disable Touchpad */ 160 - {KE_KEY, 0x38, KEY_F14 }, 161 - {KE_END, 0}, 124 + { KE_KEY, 0x10, { KEY_WLAN } }, 125 + { KE_KEY, 0x11, { KEY_WLAN } }, 126 + { KE_KEY, 0x12, { KEY_PROG1 } }, 127 + { KE_KEY, 0x13, { KEY_MUTE } }, 128 + { KE_KEY, 0x14, { KEY_VOLUMEDOWN } }, 129 + { KE_KEY, 0x15, { KEY_VOLUMEUP } }, 130 + { KE_KEY, 0x16, { KEY_DISPLAY_OFF } }, 131 + { KE_KEY, 0x1a, { KEY_COFFEE } }, 132 + { KE_KEY, 0x1b, { KEY_ZOOM } }, 133 + { KE_KEY, 0x1c, { KEY_PROG2 } }, 134 + { KE_KEY, 0x1d, { KEY_PROG3 } }, 135 + { KE_KEY, NOTIFY_BRN_MIN, { KEY_BRIGHTNESSDOWN } }, 136 + { KE_KEY, NOTIFY_BRN_MAX, { KEY_BRIGHTNESSUP } }, 137 + { KE_KEY, 0x30, { KEY_SWITCHVIDEOMODE } }, 138 + { KE_KEY, 0x31, { KEY_SWITCHVIDEOMODE } }, 139 + { KE_KEY, 0x32, { KEY_SWITCHVIDEOMODE } }, 140 + { KE_KEY, 0x37, { KEY_F13 } }, /* Disable Touchpad */ 141 + { KE_KEY, 0x38, { KEY_F14 } }, 142 + { KE_END, 0 }, 162 143 }; 163 - 164 144 165 145 /* 166 146 * This is the main structure, we can use it to store useful information ··· 159 159 acpi_handle handle; /* the handle of the acpi device */ 160 160 u32 cm_supported; /* the control methods supported 161 161 by this BIOS */ 162 + bool cpufv_disabled; 163 + bool hotplug_disabled; 162 164 u16 event_count[128]; /* count for each event */ 163 165 164 166 struct platform_device *platform_device; ··· 380 378 struct eeepc_cpufv c; 381 379 int rv, value; 382 380 381 + if (eeepc->cpufv_disabled) 382 + return -EPERM; 383 383 if (get_cpufv(eeepc, &c)) 384 384 return -ENODEV; 385 385 rv = parse_arg(buf, count, &value); ··· 392 388 set_acpi(eeepc, CM_ASL_CPUFV, value); 393 389 return rv; 394 390 } 391 + 392 + static ssize_t show_cpufv_disabled(struct device *dev, 393 + struct device_attribute *attr, 394 + char *buf) 395 + { 396 + struct eeepc_laptop *eeepc = dev_get_drvdata(dev); 397 + 398 + return sprintf(buf, "%d\n", eeepc->cpufv_disabled); 399 + } 400 + 401 + static ssize_t store_cpufv_disabled(struct device *dev, 402 + struct device_attribute *attr, 403 + const char *buf, size_t count) 404 + { 405 + struct eeepc_laptop *eeepc = dev_get_drvdata(dev); 406 + int rv, value; 407 + 408 + rv = parse_arg(buf, count, &value); 409 + if (rv < 0) 410 + return rv; 411 + 412 + switch (value) { 413 + case 0: 414 + if (eeepc->cpufv_disabled) 415 + pr_warning("cpufv enabled (not officially supported " 416 + "on this model)\n"); 417 + eeepc->cpufv_disabled = false; 418 + return rv; 419 + case 1: 420 + return -EPERM; 421 + default: 422 + return -EINVAL; 423 + } 424 + } 425 + 395 426 396 427 static struct device_attribute dev_attr_cpufv = { 397 428 .attr = { ··· 443 404 .show = show_available_cpufv 444 405 }; 445 406 407 + static struct device_attribute dev_attr_cpufv_disabled = { 408 + .attr = { 409 + .name = "cpufv_disabled", 410 + .mode = 0644 }, 411 + .show = show_cpufv_disabled, 412 + .store = store_cpufv_disabled 413 + }; 414 + 415 + 446 416 static struct attribute *platform_attributes[] = { 447 417 &dev_attr_camera.attr, 448 418 &dev_attr_cardr.attr, 449 419 &dev_attr_disp.attr, 450 420 &dev_attr_cpufv.attr, 451 421 &dev_attr_available_cpufv.attr, 422 + &dev_attr_cpufv_disabled.attr, 452 423 NULL 453 424 }; 454 425 ··· 845 796 if (result && result != -ENODEV) 846 797 goto exit; 847 798 799 + if (eeepc->hotplug_disabled) 800 + return 0; 801 + 848 802 result = eeepc_setup_pci_hotplug(eeepc); 849 803 /* 850 804 * If we get -EBUSY then something else is handling the PCI hotplug - ··· 1142 1090 /* 1143 1091 * Input device (i.e. hotkeys) 1144 1092 */ 1145 - static struct key_entry *eeepc_get_entry_by_scancode( 1146 - struct eeepc_laptop *eeepc, 1147 - int code) 1148 - { 1149 - struct key_entry *key; 1150 - 1151 - for (key = eeepc->keymap; key->type != KE_END; key++) 1152 - if (code == key->code) 1153 - return key; 1154 - 1155 - return NULL; 1156 - } 1157 - 1158 - static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) 1159 - { 1160 - static struct key_entry *key; 1161 - 1162 - key = eeepc_get_entry_by_scancode(eeepc, event); 1163 - if (key) { 1164 - switch (key->type) { 1165 - case KE_KEY: 1166 - input_report_key(eeepc->inputdev, key->keycode, 1167 - 1); 1168 - input_sync(eeepc->inputdev); 1169 - input_report_key(eeepc->inputdev, key->keycode, 1170 - 0); 1171 - input_sync(eeepc->inputdev); 1172 - break; 1173 - } 1174 - } 1175 - } 1176 - 1177 - static struct key_entry *eeepc_get_entry_by_keycode( 1178 - struct eeepc_laptop *eeepc, int code) 1179 - { 1180 - struct key_entry *key; 1181 - 1182 - for (key = eeepc->keymap; key->type != KE_END; key++) 1183 - if (code == key->keycode && key->type == KE_KEY) 1184 - return key; 1185 - 1186 - return NULL; 1187 - } 1188 - 1189 - static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode) 1190 - { 1191 - struct eeepc_laptop *eeepc = input_get_drvdata(dev); 1192 - struct key_entry *key = eeepc_get_entry_by_scancode(eeepc, scancode); 1193 - 1194 - if (key && key->type == KE_KEY) { 1195 - *keycode = key->keycode; 1196 - return 0; 1197 - } 1198 - 1199 - return -EINVAL; 1200 - } 1201 - 1202 - static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) 1203 - { 1204 - struct eeepc_laptop *eeepc = input_get_drvdata(dev); 1205 - struct key_entry *key; 1206 - int old_keycode; 1207 - 1208 - if (keycode < 0 || keycode > KEY_MAX) 1209 - return -EINVAL; 1210 - 1211 - key = eeepc_get_entry_by_scancode(eeepc, scancode); 1212 - if (key && key->type == KE_KEY) { 1213 - old_keycode = key->keycode; 1214 - key->keycode = keycode; 1215 - set_bit(keycode, dev->keybit); 1216 - if (!eeepc_get_entry_by_keycode(eeepc, old_keycode)) 1217 - clear_bit(old_keycode, dev->keybit); 1218 - return 0; 1219 - } 1220 - 1221 - return -EINVAL; 1222 - } 1223 - 1224 1093 static int eeepc_input_init(struct eeepc_laptop *eeepc) 1225 1094 { 1226 - const struct key_entry *key; 1227 - int result; 1095 + struct input_dev *input; 1096 + int error; 1228 1097 1229 - eeepc->inputdev = input_allocate_device(); 1230 - if (!eeepc->inputdev) { 1098 + input = input_allocate_device(); 1099 + if (!input) { 1231 1100 pr_info("Unable to allocate input device\n"); 1232 1101 return -ENOMEM; 1233 1102 } 1234 - eeepc->inputdev->name = "Asus EeePC extra buttons"; 1235 - eeepc->inputdev->dev.parent = &eeepc->platform_device->dev; 1236 - eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0"; 1237 - eeepc->inputdev->id.bustype = BUS_HOST; 1238 - eeepc->inputdev->getkeycode = eeepc_getkeycode; 1239 - eeepc->inputdev->setkeycode = eeepc_setkeycode; 1240 - input_set_drvdata(eeepc->inputdev, eeepc); 1241 1103 1242 - eeepc->keymap = kmemdup(eeepc_keymap, sizeof(eeepc_keymap), 1243 - GFP_KERNEL); 1244 - for (key = eeepc_keymap; key->type != KE_END; key++) { 1245 - switch (key->type) { 1246 - case KE_KEY: 1247 - set_bit(EV_KEY, eeepc->inputdev->evbit); 1248 - set_bit(key->keycode, eeepc->inputdev->keybit); 1249 - break; 1250 - } 1104 + input->name = "Asus EeePC extra buttons"; 1105 + input->phys = EEEPC_LAPTOP_FILE "/input0"; 1106 + input->id.bustype = BUS_HOST; 1107 + input->dev.parent = &eeepc->platform_device->dev; 1108 + 1109 + error = sparse_keymap_setup(input, eeepc_keymap, NULL); 1110 + if (error) { 1111 + pr_err("Unable to setup input device keymap\n"); 1112 + goto err_free_dev; 1251 1113 } 1252 - result = input_register_device(eeepc->inputdev); 1253 - if (result) { 1254 - pr_info("Unable to register input device\n"); 1255 - input_free_device(eeepc->inputdev); 1256 - return result; 1114 + 1115 + error = input_register_device(input); 1116 + if (error) { 1117 + pr_err("Unable to register input device\n"); 1118 + goto err_free_keymap; 1257 1119 } 1120 + 1121 + eeepc->inputdev = input; 1258 1122 return 0; 1123 + 1124 + err_free_keymap: 1125 + sparse_keymap_free(input); 1126 + err_free_dev: 1127 + input_free_device(input); 1128 + return error; 1259 1129 } 1260 1130 1261 1131 static void eeepc_input_exit(struct eeepc_laptop *eeepc) ··· 1227 1253 * event will be desired value (or else ignored) 1228 1254 */ 1229 1255 } 1230 - eeepc_input_notify(eeepc, event); 1256 + sparse_keymap_report_event(eeepc->inputdev, event, 1257 + 1, true); 1231 1258 } 1232 1259 } else { 1233 1260 /* Everything else is a bona-fide keypress event */ 1234 - eeepc_input_notify(eeepc, event); 1261 + sparse_keymap_report_event(eeepc->inputdev, event, 1, true); 1262 + } 1263 + } 1264 + 1265 + static void eeepc_dmi_check(struct eeepc_laptop *eeepc) 1266 + { 1267 + const char *model; 1268 + 1269 + model = dmi_get_system_info(DMI_PRODUCT_NAME); 1270 + if (!model) 1271 + return; 1272 + 1273 + /* 1274 + * Blacklist for setting cpufv (cpu speed). 1275 + * 1276 + * EeePC 4G ("701") implements CFVS, but it is not supported 1277 + * by the pre-installed OS, and the original option to change it 1278 + * in the BIOS setup screen was removed in later versions. 1279 + * 1280 + * Judging by the lack of "Super Hybrid Engine" on Asus product pages, 1281 + * this applies to all "701" models (4G/4G Surf/2G Surf). 1282 + * 1283 + * So Asus made a deliberate decision not to support it on this model. 1284 + * We have several reports that using it can cause the system to hang 1285 + * 1286 + * The hang has also been reported on a "702" (Model name "8G"?). 1287 + * 1288 + * We avoid dmi_check_system() / dmi_match(), because they use 1289 + * substring matching. We don't want to affect the "701SD" 1290 + * and "701SDX" models, because they do support S.H.E. 1291 + */ 1292 + if (strcmp(model, "701") == 0 || strcmp(model, "702") == 0) { 1293 + eeepc->cpufv_disabled = true; 1294 + pr_info("model %s does not officially support setting cpu " 1295 + "speed\n", model); 1296 + pr_info("cpufv disabled to avoid instability\n"); 1297 + } 1298 + 1299 + /* 1300 + * Blacklist for wlan hotplug 1301 + * 1302 + * Eeepc 1005HA doesn't work like others models and don't need the 1303 + * hotplug code. In fact, current hotplug code seems to unplug another 1304 + * device... 1305 + */ 1306 + if (strcmp(model, "1005HA") == 0 || strcmp(model, "1201N") == 0) { 1307 + eeepc->hotplug_disabled = true; 1308 + pr_info("wlan hotplug disabled\n"); 1235 1309 } 1236 1310 } 1237 1311 ··· 1363 1341 strcpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME); 1364 1342 strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS); 1365 1343 device->driver_data = eeepc; 1344 + 1345 + eeepc->hotplug_disabled = hotplug_disabled; 1346 + 1347 + eeepc_dmi_check(eeepc); 1366 1348 1367 1349 result = eeepc_acpi_init(eeepc, device); 1368 1350 if (result) ··· 1478 1452 result = acpi_bus_register_driver(&eeepc_acpi_driver); 1479 1453 if (result < 0) 1480 1454 goto fail_acpi_driver; 1455 + 1481 1456 if (!eeepc_device_present) { 1482 1457 result = -ENODEV; 1483 1458 goto fail_no_device; 1484 1459 } 1460 + 1485 1461 return 0; 1486 1462 1487 1463 fail_no_device:
+6 -3
drivers/platform/x86/sony-laptop.c
··· 1201 1201 /* the buffer is filled with magic numbers describing the devices 1202 1202 * available, 0xff terminates the enumeration 1203 1203 */ 1204 - while ((dev_code = *(device_enum->buffer.pointer + i)) != 0xff && 1205 - i < device_enum->buffer.length) { 1206 - i++; 1204 + for (i = 0; i < device_enum->buffer.length; i++) { 1205 + 1206 + dev_code = *(device_enum->buffer.pointer + i); 1207 + if (dev_code == 0xff) 1208 + break; 1209 + 1207 1210 dprintk("Radio devices, looking at 0x%.2x\n", dev_code); 1208 1211 1209 1212 if (dev_code == 0 && !sony_rfkill_devices[SONY_WIFI])
+1 -1
include/acpi/platform/aclinux.h
··· 152 152 #include <linux/hardirq.h> 153 153 #define ACPI_PREEMPTION_POINT() \ 154 154 do { \ 155 - if (!in_atomic_preempt_off()) \ 155 + if (!in_atomic_preempt_off() && !irqs_disabled()) \ 156 156 cond_resched(); \ 157 157 } while (0) 158 158
+3 -3
include/linux/acpi.h
··· 80 80 void __acpi_unmap_table(char *map, unsigned long size); 81 81 int early_acpi_boot_init(void); 82 82 int acpi_boot_init (void); 83 - int acpi_boot_table_init (void); 83 + void acpi_boot_table_init (void); 84 84 int acpi_mps_check (void); 85 85 int acpi_numa_init (void); 86 86 ··· 321 321 return 0; 322 322 } 323 323 324 - static inline int acpi_boot_table_init(void) 324 + static inline void acpi_boot_table_init(void) 325 325 { 326 - return 0; 326 + return; 327 327 } 328 328 329 329 static inline int acpi_mps_check(void)