From patchwork Tue Jun 20 09:35:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105987 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1280531qgd; Tue, 20 Jun 2017 02:56:08 -0700 (PDT) X-Received: by 10.98.245.136 with SMTP id b8mr30098741pfm.113.1497952567956; Tue, 20 Jun 2017 02:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497952567; cv=none; d=google.com; s=arc-20160816; b=ICbkzetVbZs5zJsNe4ThsrrJIeS562qgn7kJoB0ivoQ0njFhtlbnJdapxML9gwTilm 629edX+IrsQS/fd+5F88sxZAfnz/d8TnGSXQ08oN7YlA31s5Uwop2QCv3jC0zuM6nyqF xwSc2SGxFfkTmv1VDnGjAkKOBWD7jEVz4YOj6Y4GT7mUeeYVCHIOF3QQ28ZoVSEKhJJB 3gGTF+oDZwkn0hvqB6fCLeDju6hxiRE5B9YONg+trcLghSWt+DsvVid6H/rIIfqkfeH7 e/seXlB3S4zJxyde1KyMgXeX6PfZ5lv5XrtZ++zLoTvA/MzdFoOwpFks1ZB2tbhm65Oo kbHQ== 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=gvliszPk80GdUUt6yYCZEcsPqjuikT0yMvqtUuGW62s=; b=zUCidMgIbIaq2E+n/J1O6LUEN7jntQu597NIVrCc+WN5nJXHNtpHDXoLlReihLJELE d0vi0Nb5cbZflzW81ynzpV1QwSmS4cabaP5PDaVUZHjcV9II6gPgeBuZ9kuoMOamE1u4 0h8Xl+eA/ALgYHO6dLcFRh8btK5lw25IRH1oWtOePr/GTsy4GUZzuwUHjsGKwFUgaHXg hp63js2EbdZTJf1NY1v2QdAyRVQTFJYlQ2OoWvic7kElN6BDKtPOro5QQESuzdeRMBiB 8Uoptja5SmF/v+ruqslqP2KgqglQeMg+HaQZ4cAkYoNpHW2JJ9kiCm1oky4AyEXSVw2F SJyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=aONjZL2n; 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 j76si10014645pfe.26.2017.06.20.02.56.07; Tue, 20 Jun 2017 02:56:07 -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=aONjZL2n; 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 S1752559AbdFTJzv (ORCPT + 25 others); Tue, 20 Jun 2017 05:55:51 -0400 Received: from mail-wr0-f182.google.com ([209.85.128.182]:33501 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751098AbdFTJh1 (ORCPT ); Tue, 20 Jun 2017 05:37:27 -0400 Received: by mail-wr0-f182.google.com with SMTP id r103so88490109wrb.0 for ; Tue, 20 Jun 2017 02:37:26 -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=gvliszPk80GdUUt6yYCZEcsPqjuikT0yMvqtUuGW62s=; b=aONjZL2nVQ/nYMq5FA30hNhctnUr6sZNI9Bjm/beOVbwNxIUr+UpFHJiW4yxBstimm jAhIgM2JYb+aR76UYX5rsTZhXlodmMmD2tN1NbA1+0UwOIiENAcA7sQPkyMyADgSjOrh e0UDVe4VCiTzBvzFaO6oejhZ5FeDPhdBDD300= 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=gvliszPk80GdUUt6yYCZEcsPqjuikT0yMvqtUuGW62s=; b=P384+DnlWPJpjByQCK0kZLy+PBBlpbLHSapf4z4fsd6cqvwtYVhfGLRae3hUkV404T ir52OpYxz6Ng+rbpn3obJvmefWB+zGeBdrdGOyKwsZzt4tlpnigHewzYDUIKntoSPhhn vWU0CBnv9TquzTQarN6DMhLZgQkvoAea5K836A7FNC1qF4gBhlgVIdrWM1p/8ygMPTop CqM3OKWdUOEPjQeyC7VtEtEI/0Ic3PyQSTdFZ191lKOc6MBFde4AfxzSihzp1Hdkxc3S dikVMxQY/6+9RglS2iybkQL/iSu5LESSEXoMAwQlGVV6dpuMI3MdxnGKlE7eHEJVJ37k Kf0A== X-Gm-Message-State: AKS2vOyWzhaxbWJPPKufwa58R1DKfjTQIChEW3V18Cg7iboZayGordT3 HhKkXuJVD1mvjZQM X-Received: by 10.223.131.166 with SMTP id 35mr19706229wre.161.1497951435947; Tue, 20 Jun 2017 02:37:15 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:37:15 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH 10/51] rtc: at91sam9: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:18 +0200 Message-Id: <1497951359-13334-11-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: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org --- drivers/rtc/rtc-at91sam9.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 7418a76..be1f37e 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -122,7 +122,7 @@ static int at91_rtc_readtime(struct device *dev, struct rtc_time *tm) if (secs != secs2) secs = rtt_readl(rtc, VR); - rtc_time_to_tm(offset + secs, tm); + rtc_time64_to_tm((u64)(offset + secs), tm); dev_dbg(dev, "%s: %4d-%02d-%02d %02d:%02d:%02d\n", "readtime", 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, @@ -137,17 +137,14 @@ static int at91_rtc_readtime(struct device *dev, struct rtc_time *tm) static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) { struct sam9_rtc *rtc = dev_get_drvdata(dev); - int err; u32 offset, alarm, mr; - unsigned long secs; + unsigned long long secs; dev_dbg(dev, "%s: %4d-%02d-%02d %02d:%02d:%02d\n", "settime", 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); - err = rtc_tm_to_time(tm, &secs); - if (err != 0) - return err; + secs = rtc_tm_to_time64(tm); mr = rtt_readl(rtc, MR); @@ -197,7 +194,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) memset(alrm, 0, sizeof(*alrm)); if (alarm != ALARM_DISABLED && offset != 0) { - rtc_time_to_tm(offset + alarm, tm); + rtc_time64_to_tm((u64)(offset + alarm), tm); dev_dbg(dev, "%s: %4d-%02d-%02d %02d:%02d:%02d\n", "readalarm", 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, @@ -214,14 +211,11 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) { struct sam9_rtc *rtc = dev_get_drvdata(dev); struct rtc_time *tm = &alrm->time; - unsigned long secs; + unsigned long long secs; u32 offset; u32 mr; - int err; - err = rtc_tm_to_time(tm, &secs); - if (err != 0) - return err; + secs = rtc_tm_to_time64(tm); offset = gpbr_readl(rtc); if (offset == 0) {