From patchwork Tue Jun 20 09:35:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9799229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 303E460329 for ; Tue, 20 Jun 2017 10:49:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F44828464 for ; Tue, 20 Jun 2017 10:49:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124EF2847A; Tue, 20 Jun 2017 10:49:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9ED4B28464 for ; Tue, 20 Jun 2017 10:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PiMxtbc9LbrpxdKRJ+giv/dqKhl2u0ip3XJSL/UNXwc=; b=AdRGO24pVDQBPkla86vpyuti+/ yz/q6J9/xkreQr2ymhaBbEfeygN164P77SxsaTUGfk8kKlgU4Hc2+V3c+CJlHUGZLlbRT8tFRJQ0C ouzfoLTh6gO7GNUza+qD6yKN3FndWy+NzU3P+NOZAGmsdZ/T3NCceiNGx/8elDLBcTOli+i6I9s21 mfXhEZfoY3+XqOV+dAlNTa6PWLXsgu2urTwvIRhW35cGj3pKIJ5mxTM6rxPkyLkz205d40v4U/5o4 J54VX8J9GBr4/Po5+k5gq0YrcYJzo9zW289OlVh+uyzHjQzKKt/QKJJnXGRSQL2tLHgmS7o7Bsl9N q4J/H/1Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dNGiv-0003TV-8W; Tue, 20 Jun 2017 10:49:29 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNGih-0003C2-2Z for linux-arm-kernel@bombadil.infradead.org; Tue, 20 Jun 2017 10:49:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=H+LdICScUW70SfoWe/kq1C9GzjpLyFXbcqFkQNfFB6E=; b=odbCuPdhATfFR78kWkrwQS750 B6pOfmgVcRlknxMkEFqYjdkTEy+3ze1eufnaI81LikxcHtsuZ5UoD+rD9RrTM036EzGjPR31sKiI6 4NwlKKBwPi6RioSY8iHc4OhHMSNwlB3SJuGdvZjuMT3zitc0VgotCP/9WkDbP1MxXYOSIxh4E3rUx 6NLlKpv7aftpO8wX5O0H2Ul8N+/8K7kvPh2yHIzb00h4mq+K8yVNMY/fOINyT/RPxfCC/aWkmy3pw CRRcWkfuiNbeQCeZ6ByrqgrLX9BssXOGj6KlPij/2hDRYUfZIJemSiDZOu4BEP/iCmc43L56nHwtY xrdISwxBg==; Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNFcF-0002LI-Du for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2017 09:38:33 +0000 Received: by mail-wm0-x230.google.com with SMTP id m125so16109038wmm.1 for ; Tue, 20 Jun 2017 02:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H+LdICScUW70SfoWe/kq1C9GzjpLyFXbcqFkQNfFB6E=; b=ehW9HCi/XLfvPJNezgg4ETtmnjcGDUnl5j115ugDRe1bHAR0ygAVWlRHuYtoXc7TVp JjtVwcNcCW8mHdFqmKWCtnEO2RndIbRNkCN/YG4ixvOjQVvK2iXKL2QTubXxGxKo9NYn rQYIWU/Ke8Kn0ngUDhm8pfbW5FoeyYRNt9yH8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H+LdICScUW70SfoWe/kq1C9GzjpLyFXbcqFkQNfFB6E=; b=F+zrcv3F/FE+bPMcVox4xd974F2wR4+Iwfho1jmsZucAEpVwhd8W/mrHJplCIBHuOR 0bI7dAa4oqtU1MyVtjRkHomR+LBwiweNGHVQXWWpe46m4S5tCsYHwtn9a5YzipCCaTxo u33KrEy/EBnNLh24GHRogOdCNvg3O6h+vbJgrdKpbdNbrMoT+jAIA1ocz6OSgw9npEbV 2lrskJ5wVOsCySpNnOAhBeA3ZBnpFBHIJjh2HZS911BDz8VjdaNtDqdNDhinaqbq+iYS CmcqyEdJO2GqKrTG9/MSgskYYbp4bt6sioPwP5Nu47dU0mmLqRN9kGo3pnQv+/b9n89y l93A== X-Gm-Message-State: AKS2vOzg36uYX3hxwSijb+L0Qz/NUzdQrw8c+uvt8UQJ2bmyOroS89KP 3s08PWOGUj5jyAfK X-Received: by 10.28.230.85 with SMTP id d82mr2161619wmh.87.1497951485515; Tue, 20 Jun 2017 02:38:05 -0700 (PDT) Received: from lmenx321.st.com. ([80.215.93.217]) by smtp.gmail.com with ESMTPSA id e24sm4482318wrc.35.2017.06.20.02.38.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:05 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Subject: [PATCH 29/51] rtc: lpc32xx: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:37 +0200 Message-Id: <1497951359-13334-30-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> References: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alessandro Zummo , linaro-kernel@lists.linaro.org, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, Vladimir Zapolskiy , Alexandre Belloni , Sylvain Lemieux , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they rely on 32bits variables and that will make rtc break in y2038/2016. Stop using those two functions to safer 64bits ones. For the same reasons use set_mmss64 callback instead of set_mmss Signed-off-by: Benjamin Gaignard CC: Vladimir Zapolskiy CC: Sylvain Lemieux CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org --- drivers/rtc/rtc-lpc32xx.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/rtc/rtc-lpc32xx.c b/drivers/rtc/rtc-lpc32xx.c index 887871c..a3f5233 100644 --- a/drivers/rtc/rtc-lpc32xx.c +++ b/drivers/rtc/rtc-lpc32xx.c @@ -64,16 +64,16 @@ struct lpc32xx_rtc { static int lpc32xx_rtc_read_time(struct device *dev, struct rtc_time *time) { - unsigned long elapsed_sec; + unsigned long long elapsed_sec; struct lpc32xx_rtc *rtc = dev_get_drvdata(dev); elapsed_sec = rtc_readl(rtc, LPC32XX_RTC_UCOUNT); - rtc_time_to_tm(elapsed_sec, time); + rtc_time64_to_tm(elapsed_sec, time); return rtc_valid_tm(time); } -static int lpc32xx_rtc_set_mmss(struct device *dev, unsigned long secs) +static int lpc32xx_rtc_set_mmss64(struct device *dev, time64_t secs) { struct lpc32xx_rtc *rtc = dev_get_drvdata(dev); u32 tmp; @@ -97,7 +97,7 @@ static int lpc32xx_rtc_read_alarm(struct device *dev, { struct lpc32xx_rtc *rtc = dev_get_drvdata(dev); - rtc_time_to_tm(rtc_readl(rtc, LPC32XX_RTC_MATCH0), &wkalrm->time); + rtc_time64_to_tm(rtc_readl(rtc, LPC32XX_RTC_MATCH0), &wkalrm->time); wkalrm->enabled = rtc->alarm_enabled; wkalrm->pending = !!(rtc_readl(rtc, LPC32XX_RTC_INTSTAT) & LPC32XX_RTC_INTSTAT_MATCH0); @@ -109,15 +109,10 @@ static int lpc32xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) { struct lpc32xx_rtc *rtc = dev_get_drvdata(dev); - unsigned long alarmsecs; + unsigned long long alarmsecs; u32 tmp; - int ret; - ret = rtc_tm_to_time(&wkalrm->time, &alarmsecs); - if (ret < 0) { - dev_warn(dev, "Failed to convert time: %d\n", ret); - return ret; - } + alarmsecs = rtc_tm_to_time64(&wkalrm->time); spin_lock_irq(&rtc->lock); @@ -191,7 +186,7 @@ static irqreturn_t lpc32xx_rtc_alarm_interrupt(int irq, void *dev) static const struct rtc_class_ops lpc32xx_rtc_ops = { .read_time = lpc32xx_rtc_read_time, - .set_mmss = lpc32xx_rtc_set_mmss, + .set_mmss64 = lpc32xx_rtc_set_mmss64, .read_alarm = lpc32xx_rtc_read_alarm, .set_alarm = lpc32xx_rtc_set_alarm, .alarm_irq_enable = lpc32xx_rtc_alarm_irq_enable,