summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/hdaps.c
diff options
context:
space:
mode:
authorMark Lord <lkml@rtr.ca>2007-10-16 01:28:21 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:43:13 -0700
commit0e36a9a4a788e4e92407774df76c545910810d35 (patch)
treea235d316c46a1951498d09d78719476b5c47470a /drivers/hwmon/hdaps.c
parentbf4994d781c69cc15844d63122320e46ddde6464 (diff)
downloadkernel-crypto-0e36a9a4a788e4e92407774df76c545910810d35.tar.gz
kernel-crypto-0e36a9a4a788e4e92407774df76c545910810d35.tar.xz
kernel-crypto-0e36a9a4a788e4e92407774df76c545910810d35.zip
rtc: fix readback from /sys/class/rtc/rtc?/wakealarm
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>
Diffstat (limited to 'drivers/hwmon/hdaps.c')
0 files changed, 0 insertions, 0 deletions