summaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-05-14 22:39:06 +0200
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2015-06-25 01:13:36 +0200
commit9393996761e23280f259d706133c8f0cd139fd58 (patch)
treedd7ed7e35fe64cd5b51222b67e3750c14a8a307a /drivers/rtc
parent99c14e4df6144bca12dcac657266a7b8216aaa16 (diff)
downloadop-kernel-dev-9393996761e23280f259d706133c8f0cd139fd58.zip
op-kernel-dev-9393996761e23280f259d706133c8f0cd139fd58.tar.gz
rtc: mt6397: fix build on some 32bits platforms
On some !ARM 32bits platforms, the following compilation error happens because of the division on a 64bits value in mtk_rtc_read_time(): drivers/built-in.o: In function `mtk_rtc_read_time': rtc-mt6397.c:(.text+0x265d13f): undefined reference to `__divdi3' rtc-mt6397.c:(.text+0x265d150): undefined reference to `__moddi3' Use div_s64() as done in rtc_time64_to_tm() to solve that. Reported-by: kbuild test robot <fengguang.wu@intel.com> Acked-by: Eddie Huang <eddie.huang@mediatek.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-mt6397.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index 8bed852..c0090b6 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -150,7 +150,7 @@ static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
time64_t time;
struct mt6397_rtc *rtc = dev_get_drvdata(dev);
- int sec, ret;
+ int days, sec, ret;
do {
ret = __mtk_rtc_read_time(rtc, tm, &sec);
@@ -171,7 +171,8 @@ static int mtk_rtc_read_time(struct device *dev, struct rtc_time *tm)
/* rtc_tm_to_time64 covert Gregorian date to seconds since
* 01-01-1970 00:00:00, and this date is Thursday.
*/
- tm->tm_wday = (time / 86400 + 4) % 7;
+ days = div_s64(time, 86400);
+ tm->tm_wday = (days + 4) % 7;
exit:
return ret;
OpenPOWER on IntegriCloud