Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[ARM] 3616/1: fix timer handler wrap logic for a number of platforms

Patch from Lennert Buytenhek

A couple of platforms aren't using the right comparison type in their
timer interrupt handlers (as we're comparing two wrapping timestamps,
we need a bmi/bpl-type comparison, not an unsigned comparison) -- this
patch fixes them up.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Lennert Buytenhek and committed by
Russell King
f869afab 84b61f6d

+9 -6
+2 -1
arch/arm/mach-ep93xx/core.c
··· 103 103 write_seqlock(&xtime_lock); 104 104 105 105 __raw_writel(1, EP93XX_TIMER1_CLEAR); 106 - while (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time 106 + while ((signed long) 107 + (__raw_readl(EP93XX_TIMER4_VALUE_LOW) - last_jiffy_time) 107 108 >= TIMER4_TICKS_PER_JIFFY) { 108 109 last_jiffy_time += TIMER4_TICKS_PER_JIFFY; 109 110 timer_tick(regs);
+2 -1
arch/arm/mach-ixp2000/core.c
··· 211 211 /* clear timer 1 */ 212 212 ixp2000_reg_wrb(IXP2000_T1_CLR, 1); 213 213 214 - while ((next_jiffy_time - *missing_jiffy_timer_csr) > ticks_per_jiffy) { 214 + while ((signed long)(next_jiffy_time - *missing_jiffy_timer_csr) 215 + >= ticks_per_jiffy) { 215 216 timer_tick(regs); 216 217 next_jiffy_time -= ticks_per_jiffy; 217 218 }
+2 -2
arch/arm/mach-ixp23xx/core.c
··· 334 334 /************************************************************************* 335 335 * Timer-tick functions for IXP23xx 336 336 *************************************************************************/ 337 - #define CLOCK_TICKS_PER_USEC CLOCK_TICK_RATE / (USEC_PER_SEC) 337 + #define CLOCK_TICKS_PER_USEC (CLOCK_TICK_RATE / USEC_PER_SEC) 338 338 339 339 static unsigned long next_jiffy_time; 340 340 ··· 353 353 { 354 354 /* Clear Pending Interrupt by writing '1' to it */ 355 355 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND; 356 - while ((*IXP23XX_TIMER_CONT - next_jiffy_time) > LATCH) { 356 + while ((signed long)(*IXP23XX_TIMER_CONT - next_jiffy_time) >= LATCH) { 357 357 timer_tick(regs); 358 358 next_jiffy_time += LATCH; 359 359 }
+1 -1
arch/arm/mach-ixp4xx/common.c
··· 276 276 /* 277 277 * Catch up with the real idea of time 278 278 */ 279 - while ((*IXP4XX_OSTS - last_jiffy_time) > LATCH) { 279 + while ((signed long)(*IXP4XX_OSTS - last_jiffy_time) >= LATCH) { 280 280 timer_tick(regs); 281 281 last_jiffy_time += LATCH; 282 282 }
+2 -1
arch/arm/plat-omap/timer32k.c
··· 210 210 211 211 now = omap_32k_sync_timer_read(); 212 212 213 - while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) { 213 + while ((signed long)(now - omap_32k_last_tick) 214 + >= OMAP_32K_TICKS_PER_HZ) { 214 215 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ; 215 216 timer_tick(regs); 216 217 }