---

 linux-2.6.13-rc5-root/drivers/acpi/processor_idle.c |   27 +++++++++++---------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff -puN drivers/acpi/processor_idle.c~change-pm-idle drivers/acpi/processor_idle.c
--- linux-2.6.13-rc5/drivers/acpi/processor_idle.c~change-pm-idle	2005-08-05 10:31:53.150506896 +0800
+++ linux-2.6.13-rc5-root/drivers/acpi/processor_idle.c	2005-08-05 11:17:38.952081608 +0800
@@ -625,9 +625,11 @@ static int acpi_processor_get_power_info
 		union acpi_object *element;
 		union acpi_object *obj;
 		struct acpi_power_register *reg;
-		struct acpi_processor_cx cx;
+		struct acpi_processor_cx *cx;
 
-		memset(&cx, 0, sizeof(cx));
+		cx = &pr->power.states[pr->power.count + 1];
+
+		memset(cx, 0, sizeof(*cx));
 
 		element = (union acpi_object *) &(cst->package.elements[i]);
 		if (element->type != ACPI_TYPE_PACKAGE)
@@ -647,7 +649,7 @@ static int acpi_processor_get_power_info
 			(reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))
 			continue;
 
-		cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
+		cx->address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?
 			0 : reg->address;
 
 		/* There should be an easy way to extract an integer... */
@@ -655,31 +657,34 @@ static int acpi_processor_get_power_info
 		if (obj->type != ACPI_TYPE_INTEGER)
 			continue;
 
-		cx.type = obj->integer.value;
+		cx->type = obj->integer.value;
 
-		if ((cx.type != ACPI_STATE_C1) &&
+		if ((cx->type != ACPI_STATE_C1) &&
 		    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))
 			continue;
 
-		if ((cx.type < ACPI_STATE_C1) ||
-		    (cx.type > ACPI_STATE_C3))
+		if ((cx->type < ACPI_STATE_C1) ||
+		    (cx->type > ACPI_STATE_C3))
 			continue;
 
 		obj = (union acpi_object *) &(element->package.elements[2]);
 		if (obj->type != ACPI_TYPE_INTEGER)
 			continue;
 
-		cx.latency = obj->integer.value;
+		cx->latency = obj->integer.value;
 
 		obj = (union acpi_object *) &(element->package.elements[3]);
 		if (obj->type != ACPI_TYPE_INTEGER)
 			continue;
 
-		cx.power = obj->integer.value;
+		cx->power = obj->integer.value;
 
 		(pr->power.count)++;
-		memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx));
 	}
+	/* we might touch one more state, clean it */
+	if (pr->power.count < count)
+		memset(&pr->power.states[pr->power.count + 1], 0,
+		       sizeof(struct acpi_processor_cx));
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n", pr->power.count));
 
@@ -893,7 +898,7 @@ int acpi_processor_cst_has_changed (stru
 
 	/* Fall back to the default idle loop */
 	pm_idle = pm_idle_save;
-	synchronize_sched();  /* Relies on interrupts forcing exit from idle. */
+	cpu_idle_wait();
 
 	pr->flags.power = 0;
 	result = acpi_processor_get_power_info(pr);
_