]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
rtc: Fix some bugs that allowed accumulating time drift in suspend/resume
authorArve Hjønnevåg <arve@android.com>
Wed, 23 Nov 2011 02:24:51 +0000 (18:24 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Dec 2011 16:55:51 +0000 (08:55 -0800)
commitdf9490f1a5f1019ebf36bd7820ff405ddc06bfa9
treece8c565e77f96dbf8bc196a21b1056d494b29c23
parent0cbc008c56f7b4a11ba6fe80e196d7ab322baabf
rtc: Fix some bugs that allowed accumulating time drift in suspend/resume

commit 6a8943d9ec2567572fca25cf69ad45844d0141a3 upstream.

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@android.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/rtc/class.c