patch-2.4.2 linux/drivers/acpi/hardware/hwtimer.c

Next file: linux/drivers/acpi/include/accommon.h
Previous file: linux/drivers/acpi/hardware/hwsleep.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/drivers/acpi/hardware/hwtimer.c linux/drivers/acpi/hardware/hwtimer.c
@@ -2,7 +2,7 @@
 /******************************************************************************
  *
  * Name: hwtimer.c - ACPI Power Management Timer Interface
- *              $Revision: 4 $
+ *              $Revision: 5 $
  *
  *****************************************************************************/
 
@@ -133,7 +133,7 @@
 	/*
 	 * Compute Tick Delta:
 	 * -------------------
-	 * Handle timer rollovers on 24- versus 32-bit timers.
+	 * Handle (max one) timer rollovers on 24- versus 32-bit timers.
 	 */
 	if (start_ticks < end_ticks) {
 		delta_ticks = end_ticks - start_ticks;
@@ -141,12 +141,16 @@
 	else if (start_ticks > end_ticks) {
 		/* 24-bit Timer */
 		if (0 == acpi_gbl_FADT->tmr_val_ext) {
-			delta_ticks = (0x00FFFFFF - start_ticks) + end_ticks;
+			delta_ticks = (((0x00FFFFFF - start_ticks) + end_ticks) & 0x00FFFFFF);
 		}
 		/* 32-bit Timer */
 		else {
 			delta_ticks = (0xFFFFFFFF - start_ticks) + end_ticks;
 		}
+	}
+	else {
+		*time_elapsed = 0;
+		return (AE_OK);
 	}
 
 	/*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)