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: 105989 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1280862qgd; Tue, 20 Jun 2017 02:57:12 -0700 (PDT) X-Received: by 10.99.185.67 with SMTP id v3mr30102263pgo.189.1497952632557; Tue, 20 Jun 2017 02:57:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497952632; cv=none; d=google.com; s=arc-20160816; b=jVka9iFKf1Cv4aaEX1TfFlhpa2esfJ9BSpCQ6dwurZgX7p+DckeejwYvPX3FDktJkP LgsHQBYFptGdv1gO/s27mpMinfIOFGW55sBibATvqV3sGDsA8ChCX3+9YCRdVZ5p1z48 k7GQt6V4ATDQ7crJomdjgIe0DlMBkLKPVJfHDGv+l6ahmlBM2ovcGocdaHEGH9uFKo8h HJDrhfEClYiPrjyGqJ6ld+tVhWblyfNjiZuJ6pA9N3DFmvKRL0aLL8LWmY6+b+nedxMI ixG8/PfQJldREBCVrAHI8ygtDN2/kgQQUuqPhCKTYMzXbuyDxdtZvanOAyEn8dC4CdQw 7zWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Jz2pCBy13xkUveB1TbUsAmXEtIb1+iLByJ/+0x7ulys=; b=uEPX+sUoXPlnjSO0MsvZEy4cqil5kTjo0DtOikKKvFjjGrGUvtiowTwtN08uRNw1Mg mEgHreoFhRIxkFbRDnSBQhdPdnXZ0YG7mmTjcTU/FonqGpyzzw3clOWLYBS42gHnijlQ Qz1VVx2/PUVpBU9C9yi+mTLGV2Qo20M4ApbJKiub72BGXps6gyVzAgI8h4/TcyWl39dl +bld2u4zdHhR4dSPK6S5xiKE657trY2qqLvil4NBx+/zCGmueXGQJA4ccrsMz/+lsAxm Mi0rIL723c0FamtkKGeyUFvbPDLXST8BXiowtyW8G3KUKxCsKNTa4ax/SKuMLSEtCRCb 7E7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=Y9SrSnvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w23si11448190plk.118.2017.06.20.02.57.12; Tue, 20 Jun 2017 02:57:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.b=Y9SrSnvK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752068AbdFTJ5K (ORCPT + 25 others); Tue, 20 Jun 2017 05:57:10 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:33879 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbdFTJhR (ORCPT ); Tue, 20 Jun 2017 05:37:17 -0400 Received: by mail-wr0-f177.google.com with SMTP id 77so88363896wrb.1 for ; Tue, 20 Jun 2017 02:37:16 -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=tXk9xbUK6XdUZI3XSpFsPeZEF41p0zlV5gXVZBx4mNsh6uDDbGRx2echgrE/YaIdSO /wqa6YiHsDtZOnPcKnl5HgoqlvQCSo0iFoCXVgdRYeoobs3ErgiWdeQ1xMZXv2B6bycG VUz6QeihCN6Ey4C/AZEukK5vSkBos0nCCmd44+b9lhPVbjdAHAefW4744vEUW6qB8Zrk DDOqolEFORFpUDMOQbqqcurnV653xIll7OAEYkCEfCXc35r7z7A7MXOd2THdvEMFvZb2 MygBpoCsN2BEgubGhiGAxoF0vHm40xT6yMMP8mPBQf0PlJ2sprlU5OIqhgW53iQOTGza lB/Q== X-Gm-Message-State: AKS2vOwWUfUUQ1yAJ/PLtYnZF7lfrud0BucVvE45JEaKjzdozUqhAhiw fvrJU2XNMDi8iiG1 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 Cc: linaro-kernel@lists.linaro.org, Linus Walleij , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/rtc/rtc-ab8500.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 1.9.1 Acked-by: Linus Walleij 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