--- linux/drivers/acpi/processor.c.original	Sat May  4 12:34:28 2002
+++ linux/drivers/acpi/processor.c	Sat May  4 13:13:29 2002
@@ -404,22 +404,52 @@
 {
 	struct acpi_processor	*pr = NULL;
 	struct acpi_processor_cx *cx = NULL;
-	int			next_state = 0;
-	int			sleep_ticks = 0;
+	static u32		sleep_ticks = 0xFFFFFFFF;
 	u32			t1, t2 = 0;
 
 	pr = processors[smp_processor_id()];
 	if (!pr)
 		return;
 
+	cx = &(pr->power.states[pr->power.state]);
+
+	/*
+	 * Promotion?
+	 * ----------
+	 * Track the number of longs (time asleep is greater than threshold)
+	 * and promote when the count threshold is reached.  Note that bus
+	 * mastering activity may prevent promotions.
+	 */
+	if (cx->promotion.state && 
+	   (sleep_ticks > cx->promotion.threshold.ticks)) {
+		cx->promotion.count++;
+		cx->demotion.count = 0;
+		if (cx->promotion.count >= cx->promotion.threshold.count &&
+		     (!pr->flags.bm_check || 
+		     (!(pr->power.bm_activity & cx->promotion.threshold.bm))))
+			acpi_processor_power_activate(pr, cx->promotion.state);
+	}
+
+	/*
+	 * Demotion?
+	 * ---------
+	 * Track the number of shorts (time asleep is less than time threshold)
+	 * and demote when the usage threshold is reached.
+	 */
+	if (cx->demotion.state &&
+	   (sleep_ticks < cx->demotion.threshold.ticks)) {
+		cx->demotion.count++;
+		cx->promotion.count = 0;
+		if (cx->demotion.count >= cx->demotion.threshold.count)
+			acpi_processor_power_activate(pr, cx->demotion.state);
+	}
+
 	/*
 	 * Interrupts must be disabled during bus mastering calculations and
 	 * for C2/C3 transitions.
 	 */
 	__cli();
 
-	cx = &(pr->power.states[pr->power.state]);
-
 	/*
 	 * Check BM Activity
 	 * -----------------
@@ -462,8 +492,8 @@
 		 */
 		if (pr->power.bm_activity & cx->demotion.threshold.bm) {
 			__sti();
-			next_state = cx->demotion.state;
-			goto end;
+			acpi_processor_power_activate(pr, cx->demotion.state);
+			return;
 		}
 	}
 
@@ -525,61 +555,6 @@
 		__sti();
 		return;
 	}
-
-	next_state = pr->power.state;
-
-	/*
-	 * Promotion?
-	 * ----------
-	 * Track the number of longs (time asleep is greater than threshold)
-	 * and promote when the count threshold is reached.  Note that bus
-	 * mastering activity may prevent promotions.
-	 */
-	if (cx->promotion.state) {
-		if (sleep_ticks > cx->promotion.threshold.ticks) {
-			cx->promotion.count++;
- 			cx->demotion.count = 0;
-			if (cx->promotion.count >= cx->promotion.threshold.count) {
-				if (pr->flags.bm_check) {
-					if (!(pr->power.bm_activity & cx->promotion.threshold.bm)) {
-						next_state = cx->promotion.state;
-						goto end;
-					}
-				}
-				else {
-					next_state = cx->promotion.state;
-					goto end;
-				}
-			}
-		}
-	}
-
-	/*
-	 * Demotion?
-	 * ---------
-	 * Track the number of shorts (time asleep is less than time threshold)
-	 * and demote when the usage threshold is reached.
-	 */
-	if (cx->demotion.state) {
-		if (sleep_ticks < cx->demotion.threshold.ticks) {
-			cx->demotion.count++;
-			cx->promotion.count = 0;
-			if (cx->demotion.count >= cx->demotion.threshold.count) {
-				next_state = cx->demotion.state;
-				goto end;
-			}
-		}
-	}
-
-end:
-	/*
-	 * New Cx State?
-	 * -------------
-	 * If we're going to start using a new Cx state we must clean up
-	 * from the previous and prepare to use the new.
-	 */
-	if (next_state != pr->power.state)
-		acpi_processor_power_activate(pr, next_state);
 
 	return;
 }

