drivers/rtc/rtc-ds3232.c: fix time range difference between linux and RTC chip
commite03abd0eb5bb2864923626abc9ebc78c2372c3ee
authorLei Xu <B33228@freescale.com>
Fri, 25 Feb 2011 22:44:23 +0000 (25 14:44 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 7 Mar 2011 23:05:11 +0000 (7 15:05 -0800)
treeffc68b6af110ef619770b8805678e101af45ff98
parent9d482869ef6414b388d582f498e7eac78bd2bc20
drivers/rtc/rtc-ds3232.c: fix time range difference between linux and RTC chip

commit a2d6d2fa90c0e1d2cc1d59ccb5bbe93bb28b7413 upstream.

In linux rtc_time struct, tm_mon range is 0~11, tm_wday range is 0~6,
while in RTC HW REG, month range is 1~12, day of the week range is 1~7,
this patch adjusts difference of them.

The efect of this bug was that most of month will be operated on as the
next month by the hardware (When in Jan it maybe even worse).  For
example, if in May, software wrote 4 to the hardware, which handled it as
April.  Then the logic would be different between software and hardware,
which would cause weird things to happen.

Signed-off-by: Lei Xu <B33228@freescale.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Jack Lan <jack.lan@freescale.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/rtc/rtc-ds3232.c