mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
0e36a9a4a7
Fix readback of RTC alarms on platforms which return -1 in non-hardware-supported RTC alarm fields. To fill in the missing (-1) values, we grab an RTC timestamp along with the RTC alarm value, and use the timestamp fields to populate the missing alarm fields. To counter field-wrap races (since the timestamp and alarm are not read together atomically), we read the RTC timestamp both before and after reading the RTC alarm value, and then check for wrapped fields --> if any have wrapped, we know we have a possible inconsistency, so we loop and reread the timestamp and alarm again. Wrapped fields in the RTC timestamps are an issue because rtc-cmos.c, for example, also gets/uses an RTC timestamp internally while fetching the RTC alarm. If our timestamp here wasn't the same (minutes and higher) as what was used internally there, then we might end up populating the -1 fields with inconsistent values. This fixes readbacks from /sys/class/rtc/rtc?/wakealarm, as well as other code paths which call rtc_read_alarm(). Signed-off-by: Mark Lord <mlord@pobox.com> Cc: David Brownell <david-b@pacbell.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
||
---|---|---|
.. | ||
class.c | ||
hctosys.c | ||
interface.c | ||
Kconfig | ||
Makefile | ||
rtc-at32ap700x.c | ||
rtc-at91rm9200.c | ||
rtc-bfin.c | ||
rtc-cmos.c | ||
rtc-core.h | ||
rtc-dev.c | ||
rtc-ds1216.c | ||
rtc-ds1307.c | ||
rtc-ds1374.c | ||
rtc-ds1553.c | ||
rtc-ds1672.c | ||
rtc-ds1742.c | ||
rtc-ep93xx.c | ||
rtc-isl1208.c | ||
rtc-lib.c | ||
rtc-m41t80.c | ||
rtc-m48t59.c | ||
rtc-m48t86.c | ||
rtc-max6900.c | ||
rtc-max6902.c | ||
rtc-omap.c | ||
rtc-pcf8563.c | ||
rtc-pcf8583.c | ||
rtc-pl031.c | ||
rtc-proc.c | ||
rtc-rs5c313.c | ||
rtc-rs5c348.c | ||
rtc-rs5c372.c | ||
rtc-s3c.c | ||
rtc-sa1100.c | ||
rtc-sh.c | ||
rtc-stk17ta8.c | ||
rtc-sysfs.c | ||
rtc-test.c | ||
rtc-v3020.c | ||
rtc-vr41xx.c | ||
rtc-x1205.c |