From patchwork Thu May 14 20:51:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 6409651 Return-Path: X-Original-To: patchwork-linux-mediatek@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5940D9F1C1 for ; Thu, 14 May 2015 20:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A19220480 for ; Thu, 14 May 2015 20:52:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A70132047B for ; Thu, 14 May 2015 20:52:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yt070-0007z2-6V; Thu, 14 May 2015 20:52:10 +0000 Received: from down.free-electrons.com ([37.187.137.238] helo=mail.free-electrons.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yt06h-0007p3-7R; Thu, 14 May 2015 20:51:51 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id E2A33C78; Thu, 14 May 2015 22:51:26 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (128-79-216-6.hfc.dyn.abo.bbox.fr [128.79.216.6]) by mail.free-electrons.com (Postfix) with ESMTPSA id 84A843D7; Thu, 14 May 2015 22:51:26 +0200 (CEST) From: Alexandre Belloni To: Eddie Huang Subject: [PATCH] rtc: mt6397: fix build on some 32bits platforms Date: Thu, 14 May 2015 22:51:18 +0200 Message-Id: <1431636678-29525-1-git-send-email-alexandre.belloni@free-electrons.com> X-Mailer: git-send-email 2.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150514_135151_446993_EDC1D265 X-CRM114-Status: UNSURE ( 9.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) Cc: Alexandre Belloni , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Alexandre Belloni Acked-by: Eddie Huang --- drivers/rtc/rtc-mt6397.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c index 8bed852e4961..c0090b698ff3 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;