From patchwork Tue Jun 20 09:35:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9799041 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 6B49360329 for ; Tue, 20 Jun 2017 09:37:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E82326B41 for ; Tue, 20 Jun 2017 09:37:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53534283AF; Tue, 20 Jun 2017 09:37:42 +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=ham 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 BF59C26B41 for ; Tue, 20 Jun 2017 09:37:41 +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=qRJFydjiklFhDAr8HszBy4Q+v/K4peTxXG3uv7hbAt4=; b=SogFLHR4fLoyn+1fsM0O//tLzj xwBIimNp+vxRj1Z2LRjOtt7DH9eeKW2fFfXRYDgsIdZzkKKM9i7WiAqjxBa2ar/O/NPYAjJaqo3wr wiZzz+J1apwh+ChgAnH/2IBM1ZokeRuaTOH9QMu8NMdsewsDl59c9z/yo6FlYVX3kAaLnD+oWUz/q 8LZKK9fN0PohYKayXIuxI9OkalmlYAHUmJw5jN1FiqrIJb2NExjoafm5mX7+xcw/gIdCYFOgwMEjf 93TBF4bXcbfleFhm+3cwkD8CUgvYycRI7UDXrItor/ULdkXvw3336g85hVcdRTe6KOqJ6yR5XLCEy qk4oEi0Q==; 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 1dNFbP-0003kR-7Z; Tue, 20 Jun 2017 09:37:39 +0000 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dNFbI-0003Pt-QS for linux-arm-kernel@lists.infradead.org; Tue, 20 Jun 2017 09:37:35 +0000 Received: by mail-wr0-x22c.google.com with SMTP id 77so88363895wrb.1 for ; Tue, 20 Jun 2017 02:37:11 -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=Jz2pCBy13xkUveB1TbUsAmXEtIb1+iLByJ/+0x7ulys=; b=Y9SrSnvK0GyNZF5hTNJSO195YSfjwfHKlsFP9r3mLglZS0qVfKUllon/1iS/E8dEG2 3hz5FKd8RnaPt3b9JZRNdzQcd4vbb4u+hsyp0kUh3aO4+9/AbpjpANW7DnBAIY9fT/Pj ns1aReGawQ0ozMBkmQSx0kBb1k69X1p4C2CQI= 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=Jz2pCBy13xkUveB1TbUsAmXEtIb1+iLByJ/+0x7ulys=; b=bw1aLwVQvkxsNkavKKuiXuGNeY8EOFdxfeRDuUr2ny12G+vO9lEGJxwwwjshmSlQaL 9p0uINI8G5A4cYyc8pDp4DTMzXd0rywgHHR4eB/EPIb7gQoWj+ZG3Il63j8ZGGdncfL3 oxtiftdSKtBLhTmZ5/95Hd9t6VupQLC/1pCLQM3P3UR0U5L+JVdcMog119AyJIdzwRX8 QJvjxh724z7Pi2YPIzAdBLGG/yi+4lEVUq0/STZxRpFTYHr7RFu/YROGIOThHjnc1TJ4 5mc3SAte2buRg/OFfjEZpWfHUE208DrwFqG2ry4GNpglKx2IyKvlg45BT4PdLtoJoYxp 5Qrw== X-Gm-Message-State: AKS2vOxb3ORWoQzbD4JnuXszE4v5pYxU9Zr6OmnTijIJ5oDPVqvl9xsd 0eLQh5hfvDzsefry X-Received: by 10.223.146.161 with SMTP id 30mr22117042wrn.164.1497951430508; Tue, 20 Jun 2017 02:37:10 -0700 (PDT) Received: from lmenx321.st.com. ([80.215.93.217]) by smtp.gmail.com with ESMTPSA id e24sm4482318wrc.35.2017.06.20.02.37.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:37:10 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Subject: [PATCH 07/51] rtc: ab8500: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:15 +0200 Message-Id: <1497951359-13334-8-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170620_023733_135182_D36E2AB9 X-CRM114-Status: GOOD ( 16.71 ) 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, Linus Walleij , linux-kernel@vger.kernel.org, Alexandre Belloni , 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. Signed-off-by: Benjamin Gaignard CC: Linus Walleij CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: linux-arm-kernel@lists.infradead.org Acked-by: Linus Walleij --- drivers/rtc/rtc-ab8500.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 24a0af6..ac131bd 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c @@ -71,7 +71,7 @@ /* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */ static unsigned long get_elapsed_seconds(int year) { - unsigned long secs; + unsigned long long secs; struct rtc_time tm = { .tm_year = year - 1900, .tm_mday = 1, @@ -81,7 +81,7 @@ static unsigned long get_elapsed_seconds(int year) * This function calculates secs from 1970 and not from * 1900, even if we supply the offset from year 1900. */ - rtc_tm_to_time(&tm, &secs); + secs = rtc_tm_to_time64(&tm); return secs; } @@ -89,7 +89,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) { unsigned long timeout = jiffies + HZ; int retval, i; - unsigned long mins, secs; + unsigned long long mins, secs; unsigned char buf[ARRAY_SIZE(ab8500_rtc_time_regs)]; u8 value; @@ -130,7 +130,7 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) /* Add back the initially subtracted number of seconds */ secs += get_elapsed_seconds(AB8500_RTC_EPOCH); - rtc_time_to_tm(secs, tm); + rtc_time64_to_tm(secs, tm); return rtc_valid_tm(tm); } @@ -138,7 +138,7 @@ static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm) { int retval, i; unsigned char buf[ARRAY_SIZE(ab8500_rtc_time_regs)]; - unsigned long no_secs, no_mins, secs = 0; + unsigned long long no_secs, no_mins, secs = 0; if (tm->tm_year < (AB8500_RTC_EPOCH - 1900)) { dev_dbg(dev, "year should be equal to or greater than %d\n", @@ -147,7 +147,7 @@ static int ab8500_rtc_set_time(struct device *dev, struct rtc_time *tm) } /* Get the number of seconds since 1970 */ - rtc_tm_to_time(tm, &secs); + secs = rtc_tm_to_time64(tm); /* * Convert it to the number of seconds since 01-01-2000 00:00:00, since @@ -185,7 +185,7 @@ static int ab8500_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) int retval, i; u8 rtc_ctrl, value; unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)]; - unsigned long secs, mins; + unsigned long long secs, mins; /* Check if the alarm is enabled or not */ retval = abx500_get_register_interruptible(dev, AB8500_RTC, @@ -214,7 +214,7 @@ static int ab8500_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) /* Add back the initially subtracted number of seconds */ secs += get_elapsed_seconds(AB8500_RTC_EPOCH); - rtc_time_to_tm(secs, &alarm->time); + rtc_time64_to_tm(secs, &alarm->time); return rtc_valid_tm(&alarm->time); } @@ -230,7 +230,7 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) { int retval, i; unsigned char buf[ARRAY_SIZE(ab8500_rtc_alarm_regs)]; - unsigned long mins, secs = 0, cursec = 0; + unsigned long long mins, secs = 0, cursec = 0; struct rtc_time curtm; if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) { @@ -240,7 +240,7 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) } /* Get the number of seconds since 1970 */ - rtc_tm_to_time(&alarm->time, &secs); + secs = rtc_tm_to_time64(&alarm->time); /* * Check whether alarm is set less than 1min. @@ -248,7 +248,7 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) * return -EINVAL, so UIE EMUL can take it up, incase of UIE_ON */ ab8500_rtc_read_time(dev, &curtm); /* Read current time */ - rtc_tm_to_time(&curtm, &cursec); + cursec = rtc_tm_to_time64(&curtm); if ((secs - cursec) < 59) { dev_dbg(dev, "Alarm less than 1 minute not supported\r\n"); return -EINVAL; @@ -281,7 +281,7 @@ static int ab8540_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) { int retval, i; unsigned char buf[ARRAY_SIZE(ab8540_rtc_alarm_regs)]; - unsigned long mins, secs = 0; + unsigned long long mins, secs = 0; if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) { dev_dbg(dev, "year should be equal to or greater than %d\n", @@ -290,7 +290,7 @@ static int ab8540_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) } /* Get the number of seconds since 1970 */ - rtc_tm_to_time(&alarm->time, &secs); + secs = rtc_tm_to_time64(&alarm->time); /* * Convert it to the number of seconds since 01-01-2000 00:00:00