diff options
author | Paul Mackerras <paulus@samba.org> | 2006-12-03 23:59:07 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-03 23:59:07 -0500 |
commit | 79acbb3ff2d8095b692e1502b9eb2ccec348de26 (patch) | |
tree | 6ab773e5a8f9de2cd6443362b21d0d6fffe3b35e /drivers/acpi | |
parent | 19a79859e168640f8e16d7b216d211c1c52b687a (diff) | |
parent | 2b5f6dcce5bf94b9b119e9ed8d537098ec61c3d2 (diff) |
Merge branch 'linux-2.6' into for-linus
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 14 | ||||
-rw-r--r-- | drivers/acpi/glue.c | 20 | ||||
-rw-r--r-- | drivers/acpi/osl.c | 34 | ||||
-rw-r--r-- | drivers/acpi/processor_idle.c | 8 | ||||
-rw-r--r-- | drivers/acpi/processor_perflib.c | 4 |
5 files changed, 53 insertions, 27 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 98099de59b45..6bcd9e8e7bcb 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -85,6 +85,8 @@ struct acpi_memory_device { | |||
85 | struct list_head res_list; | 85 | struct list_head res_list; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static int acpi_hotmem_initialized; | ||
89 | |||
88 | static acpi_status | 90 | static acpi_status |
89 | acpi_memory_get_resource(struct acpi_resource *resource, void *context) | 91 | acpi_memory_get_resource(struct acpi_resource *resource, void *context) |
90 | { | 92 | { |
@@ -414,7 +416,7 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
414 | /* Set the device state */ | 416 | /* Set the device state */ |
415 | mem_device->state = MEMORY_POWER_ON_STATE; | 417 | mem_device->state = MEMORY_POWER_ON_STATE; |
416 | 418 | ||
417 | printk(KERN_INFO "%s \n", acpi_device_name(device)); | 419 | printk(KERN_DEBUG "%s \n", acpi_device_name(device)); |
418 | 420 | ||
419 | return result; | 421 | return result; |
420 | } | 422 | } |
@@ -438,6 +440,15 @@ static int acpi_memory_device_start (struct acpi_device *device) | |||
438 | struct acpi_memory_device *mem_device; | 440 | struct acpi_memory_device *mem_device; |
439 | int result = 0; | 441 | int result = 0; |
440 | 442 | ||
443 | /* | ||
444 | * Early boot code has recognized memory area by EFI/E820. | ||
445 | * If DSDT shows these memory devices on boot, hotplug is not necessary | ||
446 | * for them. So, it just returns until completion of this driver's | ||
447 | * start up. | ||
448 | */ | ||
449 | if (!acpi_hotmem_initialized) | ||
450 | return 0; | ||
451 | |||
441 | mem_device = acpi_driver_data(device); | 452 | mem_device = acpi_driver_data(device); |
442 | 453 | ||
443 | if (!acpi_memory_check_device(mem_device)) { | 454 | if (!acpi_memory_check_device(mem_device)) { |
@@ -537,6 +548,7 @@ static int __init acpi_memory_device_init(void) | |||
537 | return -ENODEV; | 548 | return -ENODEV; |
538 | } | 549 | } |
539 | 550 | ||
551 | acpi_hotmem_initialized = 1; | ||
540 | return 0; | 552 | return 0; |
541 | } | 553 | } |
542 | 554 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 10f160dc75b1..a2f46d587d55 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -267,9 +267,9 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
267 | { | 267 | { |
268 | acpi_status status; | 268 | acpi_status status; |
269 | 269 | ||
270 | if (dev->firmware_data) { | 270 | if (dev->archdata.acpi_handle) { |
271 | printk(KERN_WARNING PREFIX | 271 | printk(KERN_WARNING PREFIX |
272 | "Drivers changed 'firmware_data' for %s\n", dev->bus_id); | 272 | "Drivers changed 'acpi_handle' for %s\n", dev->bus_id); |
273 | return -EINVAL; | 273 | return -EINVAL; |
274 | } | 274 | } |
275 | get_device(dev); | 275 | get_device(dev); |
@@ -278,25 +278,26 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
278 | put_device(dev); | 278 | put_device(dev); |
279 | return -EINVAL; | 279 | return -EINVAL; |
280 | } | 280 | } |
281 | dev->firmware_data = handle; | 281 | dev->archdata.acpi_handle = handle; |
282 | 282 | ||
283 | return 0; | 283 | return 0; |
284 | } | 284 | } |
285 | 285 | ||
286 | static int acpi_unbind_one(struct device *dev) | 286 | static int acpi_unbind_one(struct device *dev) |
287 | { | 287 | { |
288 | if (!dev->firmware_data) | 288 | if (!dev->archdata.acpi_handle) |
289 | return 0; | 289 | return 0; |
290 | if (dev == acpi_get_physical_device(dev->firmware_data)) { | 290 | if (dev == acpi_get_physical_device(dev->archdata.acpi_handle)) { |
291 | /* acpi_get_physical_device increase refcnt by one */ | 291 | /* acpi_get_physical_device increase refcnt by one */ |
292 | put_device(dev); | 292 | put_device(dev); |
293 | acpi_detach_data(dev->firmware_data, acpi_glue_data_handler); | 293 | acpi_detach_data(dev->archdata.acpi_handle, |
294 | dev->firmware_data = NULL; | 294 | acpi_glue_data_handler); |
295 | dev->archdata.acpi_handle = NULL; | ||
295 | /* acpi_bind_one increase refcnt by one */ | 296 | /* acpi_bind_one increase refcnt by one */ |
296 | put_device(dev); | 297 | put_device(dev); |
297 | } else { | 298 | } else { |
298 | printk(KERN_ERR PREFIX | 299 | printk(KERN_ERR PREFIX |
299 | "Oops, 'firmware_data' corrupt for %s\n", dev->bus_id); | 300 | "Oops, 'acpi_handle' corrupt for %s\n", dev->bus_id); |
300 | } | 301 | } |
301 | return 0; | 302 | return 0; |
302 | } | 303 | } |
@@ -328,7 +329,8 @@ static int acpi_platform_notify(struct device *dev) | |||
328 | if (!ret) { | 329 | if (!ret) { |
329 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 330 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
330 | 331 | ||
331 | acpi_get_name(dev->firmware_data, ACPI_FULL_PATHNAME, &buffer); | 332 | acpi_get_name(dev->archdata.acpi_handle, |
333 | ACPI_FULL_PATHNAME, &buffer); | ||
332 | DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); | 334 | DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer); |
333 | kfree(buffer.pointer); | 335 | kfree(buffer.pointer); |
334 | } else | 336 | } else |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index c84286cbbe25..068fe4f100b0 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -73,7 +73,6 @@ static unsigned int acpi_irq_irq; | |||
73 | static acpi_osd_handler acpi_irq_handler; | 73 | static acpi_osd_handler acpi_irq_handler; |
74 | static void *acpi_irq_context; | 74 | static void *acpi_irq_context; |
75 | static struct workqueue_struct *kacpid_wq; | 75 | static struct workqueue_struct *kacpid_wq; |
76 | static struct workqueue_struct *kacpi_notify_wq; | ||
77 | 76 | ||
78 | acpi_status acpi_os_initialize(void) | 77 | acpi_status acpi_os_initialize(void) |
79 | { | 78 | { |
@@ -92,9 +91,8 @@ acpi_status acpi_os_initialize1(void) | |||
92 | return AE_NULL_ENTRY; | 91 | return AE_NULL_ENTRY; |
93 | } | 92 | } |
94 | kacpid_wq = create_singlethread_workqueue("kacpid"); | 93 | kacpid_wq = create_singlethread_workqueue("kacpid"); |
95 | kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify"); | ||
96 | BUG_ON(!kacpid_wq); | 94 | BUG_ON(!kacpid_wq); |
97 | BUG_ON(!kacpi_notify_wq); | 95 | |
98 | return AE_OK; | 96 | return AE_OK; |
99 | } | 97 | } |
100 | 98 | ||
@@ -106,7 +104,6 @@ acpi_status acpi_os_terminate(void) | |||
106 | } | 104 | } |
107 | 105 | ||
108 | destroy_workqueue(kacpid_wq); | 106 | destroy_workqueue(kacpid_wq); |
109 | destroy_workqueue(kacpi_notify_wq); | ||
110 | 107 | ||
111 | return AE_OK; | 108 | return AE_OK; |
112 | } | 109 | } |
@@ -569,7 +566,10 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */ | |||
569 | 566 | ||
570 | static void acpi_os_execute_deferred(void *context) | 567 | static void acpi_os_execute_deferred(void *context) |
571 | { | 568 | { |
572 | struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context; | 569 | struct acpi_os_dpc *dpc = NULL; |
570 | |||
571 | |||
572 | dpc = (struct acpi_os_dpc *)context; | ||
573 | if (!dpc) { | 573 | if (!dpc) { |
574 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); | 574 | printk(KERN_ERR PREFIX "Invalid (NULL) context\n"); |
575 | return; | 575 | return; |
@@ -604,12 +604,14 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
604 | struct acpi_os_dpc *dpc; | 604 | struct acpi_os_dpc *dpc; |
605 | struct work_struct *task; | 605 | struct work_struct *task; |
606 | 606 | ||
607 | ACPI_FUNCTION_TRACE("os_queue_for_execution"); | ||
608 | |||
607 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | 609 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
608 | "Scheduling function [%p(%p)] for deferred execution.\n", | 610 | "Scheduling function [%p(%p)] for deferred execution.\n", |
609 | function, context)); | 611 | function, context)); |
610 | 612 | ||
611 | if (!function) | 613 | if (!function) |
612 | return AE_BAD_PARAMETER; | 614 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
613 | 615 | ||
614 | /* | 616 | /* |
615 | * Allocate/initialize DPC structure. Note that this memory will be | 617 | * Allocate/initialize DPC structure. Note that this memory will be |
@@ -622,20 +624,26 @@ acpi_status acpi_os_execute(acpi_execute_type type, | |||
622 | * from the same memory. | 624 | * from the same memory. |
623 | */ | 625 | */ |
624 | 626 | ||
625 | dpc = kmalloc(sizeof(struct acpi_os_dpc) + | 627 | dpc = |
626 | sizeof(struct work_struct), GFP_ATOMIC); | 628 | kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct), |
629 | GFP_ATOMIC); | ||
627 | if (!dpc) | 630 | if (!dpc) |
628 | return AE_NO_MEMORY; | 631 | return_ACPI_STATUS(AE_NO_MEMORY); |
632 | |||
629 | dpc->function = function; | 633 | dpc->function = function; |
630 | dpc->context = context; | 634 | dpc->context = context; |
635 | |||
631 | task = (void *)(dpc + 1); | 636 | task = (void *)(dpc + 1); |
632 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); | 637 | INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc); |
633 | if (!queue_work((type == OSL_NOTIFY_HANDLER)? | 638 | |
634 | kacpi_notify_wq : kacpid_wq, task)) { | 639 | if (!queue_work(kacpid_wq, task)) { |
635 | status = AE_ERROR; | 640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
641 | "Call to queue_work() failed.\n")); | ||
636 | kfree(dpc); | 642 | kfree(dpc); |
643 | status = AE_ERROR; | ||
637 | } | 644 | } |
638 | return status; | 645 | |
646 | return_ACPI_STATUS(status); | ||
639 | } | 647 | } |
640 | 648 | ||
641 | EXPORT_SYMBOL(acpi_os_execute); | 649 | EXPORT_SYMBOL(acpi_os_execute); |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 526387dc3799..65b3f056ad89 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -962,7 +962,7 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) | |||
962 | 962 | ||
963 | result = acpi_processor_get_power_info_cst(pr); | 963 | result = acpi_processor_get_power_info_cst(pr); |
964 | if (result == -ENODEV) | 964 | if (result == -ENODEV) |
965 | acpi_processor_get_power_info_fadt(pr); | 965 | result = acpi_processor_get_power_info_fadt(pr); |
966 | 966 | ||
967 | if (result) | 967 | if (result) |
968 | return result; | 968 | return result; |
@@ -1108,6 +1108,7 @@ static const struct file_operations acpi_processor_power_fops = { | |||
1108 | .release = single_release, | 1108 | .release = single_release, |
1109 | }; | 1109 | }; |
1110 | 1110 | ||
1111 | #ifdef CONFIG_SMP | ||
1111 | static void smp_callback(void *v) | 1112 | static void smp_callback(void *v) |
1112 | { | 1113 | { |
1113 | /* we already woke the CPU up, nothing more to do */ | 1114 | /* we already woke the CPU up, nothing more to do */ |
@@ -1129,6 +1130,7 @@ static int acpi_processor_latency_notify(struct notifier_block *b, | |||
1129 | static struct notifier_block acpi_processor_latency_notifier = { | 1130 | static struct notifier_block acpi_processor_latency_notifier = { |
1130 | .notifier_call = acpi_processor_latency_notify, | 1131 | .notifier_call = acpi_processor_latency_notify, |
1131 | }; | 1132 | }; |
1133 | #endif | ||
1132 | 1134 | ||
1133 | int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | 1135 | int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, |
1134 | struct acpi_device *device) | 1136 | struct acpi_device *device) |
@@ -1146,7 +1148,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1146 | "ACPI: processor limited to max C-state %d\n", | 1148 | "ACPI: processor limited to max C-state %d\n", |
1147 | max_cstate); | 1149 | max_cstate); |
1148 | first_run++; | 1150 | first_run++; |
1151 | #ifdef CONFIG_SMP | ||
1149 | register_latency_notifier(&acpi_processor_latency_notifier); | 1152 | register_latency_notifier(&acpi_processor_latency_notifier); |
1153 | #endif | ||
1150 | } | 1154 | } |
1151 | 1155 | ||
1152 | if (!pr) | 1156 | if (!pr) |
@@ -1218,7 +1222,9 @@ int acpi_processor_power_exit(struct acpi_processor *pr, | |||
1218 | * copies of pm_idle before proceeding. | 1222 | * copies of pm_idle before proceeding. |
1219 | */ | 1223 | */ |
1220 | cpu_idle_wait(); | 1224 | cpu_idle_wait(); |
1225 | #ifdef CONFIG_SMP | ||
1221 | unregister_latency_notifier(&acpi_processor_latency_notifier); | 1226 | unregister_latency_notifier(&acpi_processor_latency_notifier); |
1227 | #endif | ||
1222 | } | 1228 | } |
1223 | 1229 | ||
1224 | return 0; | 1230 | return 0; |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 7ba5e49ab302..6fd174a37149 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -83,10 +83,8 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
83 | goto out; | 83 | goto out; |
84 | 84 | ||
85 | ppc = (unsigned int)pr->performance_platform_limit; | 85 | ppc = (unsigned int)pr->performance_platform_limit; |
86 | if (!ppc) | ||
87 | goto out; | ||
88 | 86 | ||
89 | if (ppc > pr->performance->state_count) | 87 | if (ppc >= pr->performance->state_count) |
90 | goto out; | 88 | goto out; |
91 | 89 | ||
92 | cpufreq_verify_within_limits(policy, 0, | 90 | cpufreq_verify_within_limits(policy, 0, |