diff options
author | Lowell Dennis <ldennis@nvidia.com> | 2010-12-01 21:32:23 -0600 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2010-12-02 22:27:14 -0800 |
commit | 348e13ea50dd34d041fbf7cd4c32bcd262731c20 (patch) | |
tree | 24104b75ed6cf1ac4564515374682a5e591067a3 /drivers/rtc | |
parent | 0f821a8558811e7469683d47a916e19cebaabcdc (diff) |
ARM: tegra: rtc: Fix error in RTC tick calculations.
In the TPS6586x PMU/PMIC RTC support code, when
converting from seconds to ticks using a shift
operator, the most significant bits were being lost
due to seconds being a 32-bit value and ticks being
a 64-bit value. A hard cast was added to avoid this
loss.
Fixes: NVBug 754198 and 751811
Change-Id: I91c3dbd8474c11b3a11f1d3a13eacd213e80cd1a
Reviewed-on: http://git-master/r/11845
Reviewed-by: Lowell Dennis <ldennis@nvidia.com>
Tested-by: Lowell Dennis <ldennis@nvidia.com>
Reviewed-by: Jonathan Mayo <jmayo@nvidia.com>
Reviewed-by: Peter Zu <pzu@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-tps6586x.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c index 9ab93cb9de0e..ca6138bbda4b 100644 --- a/drivers/rtc/rtc-tps6586x.c +++ b/drivers/rtc/rtc-tps6586x.c @@ -95,7 +95,7 @@ static int tps6586x_rtc_set_time(struct device *dev, struct rtc_time *tm) seconds -= rtc->epoch_start; - ticks = seconds << 10; + ticks = (unsigned long long)seconds << 10; buff[0] = (ticks >> 32) & 0xff; buff[1] = (ticks >> 24) & 0xff; buff[2] = (ticks >> 16) & 0xff; @@ -148,7 +148,7 @@ static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) } seconds -= rtc->epoch_start; - ticks = (seconds << 10) & 0xffffff; + ticks = (unsigned long long)seconds << 10; buff[0] = (ticks >> 16) & 0xff; buff[1] = (ticks >> 8) & 0xff; |