From: Tony Prisk Date: Mon, 4 Feb 2013 22:28:44 +0000 (-0800) Subject: drivers/rtc/rtc-vt8500.c: fix year field in vt8500_rtc_set_time() X-Git-Tag: v3.8-rc7~16^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bdf8cd3226fe11f26ce32bbb4c5e381cf807c89;p=profile%2Fivi%2Fkernel-x86-ivi.git drivers/rtc/rtc-vt8500.c: fix year field in vt8500_rtc_set_time() The year field is incorrectly masked when setting the date. If the year is beyond 2099, the year field will be incorrectly updated in hardware. This patch masks the year field correctly. Signed-off-by: Edgar Toernig Signed-off-by: Tony Prisk Cc: Alessandro Zummo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index 00c930f4b6f..2730533e2d2 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c @@ -137,7 +137,7 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) return -EINVAL; } - writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) + writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S) | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) | (bin2bcd(tm->tm_mday)) | ((tm->tm_year >= 200) << DATE_CENTURY_S),