Re: [PATCH] rtc: Fix some bugs that allowed accumulating time driftin suspend/resume

From: John Stultz
Date: Tue Nov 22 2011 - 21:49:46 EST


On Tue, 2011-11-22 at 18:24 -0800, Arve HjÃnnevÃg wrote:
> The current code checks if abs(delta_delta.tv_sec) is greater or
> equal to two before it discards the old delta value, but this can
> trigger at close to -1 seconds since -1.000000001 seconds is stored
> as tv_sec -2 and tv_nsec 999999999 in a normalized timespec.
>
> rtc_resume had an early return check if the rtc value had not changed
> since rtc_suspend. This effectivly stops time for the duration of the
> short sleep. Check if sleep_time is positive after all the adjustments
> have been applied instead since this allows the old_system adjustment
> in rtc_suspend to have an effect even for short sleep cycles.
>
> Signed-off-by: Arve HjÃnnevÃg <arve@xxxxxxxxxxx>

Looks good to me! Thanks for fixing and sending this in!
I'll queue it for upstream.

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/