From patchwork Tue Jun 20 09:35:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105988 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1280677qgd; Tue, 20 Jun 2017 02:56:36 -0700 (PDT) X-Received: by 10.98.197.130 with SMTP id j124mr29870498pfg.239.1497952595996; Tue, 20 Jun 2017 02:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497952595; cv=none; d=google.com; s=arc-20160816; b=KunqEeqjKAgq0dETmb8Zw12EvWFSWxKdIZLO3nsDWjggYrzv/leIG1Fv9F1nBVHmOU gqOuh7OOojmNpJIS1nmk7vUZ7bStTLRYEMve0nbBt5v+OFsq6tae9GTAaTX2OU1XwMO+ jqAtQkLgz7H9aOsDBjCYgJ1HZ6oZWVR7Ld7CdLMe/yOg5WpAbs7Zo58sxz/KdADSbDRI G/526Ysr226IsmnCG+hzeJ//tQdLxFAXbyXMrnOukKKBh/9q7ZHsTeEAl/ufnwnY3EE8 R8dUDtUdOKuSd6vm7dYdnOMawfGiQI58WU6Mk/dn3w6V5bGUqoEt/vc/QRWdVZ9r4m9t zzJg== 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=z5XvP8vgaYR3uGdKV3t2tq0dbW8dP5rTTTSzYNub3gM=; b=J3WesUicy5N082qL6qpmGmrFkTWxsXCUtCHAUc0YNk8Ws87tvSl7t2KJOpPq5353/u ui4LYk6oF7R3I7xylslpFeGk9eDVGkRtpCJzvW56pvd6QYXES6Xs5LoDCTIekMzDj/6O R88n/ym927YxfVEflX/qnkN+Ul4l/p4Gb8wzKGeCQN1Cr6w5P9A1Rh+rMKHs8lUUfUne IYO35wEGfqrnzhxL6Vq1OOy73hDObOA5r2AR6ixdCq4WpeMyqVACF1T1dJi6cQlmPbEZ C14+6VlTecfihbj2PoyY2kLIHtj3ypBBn5Eph+9OtQ/bng+1PGcmMTbVRG6VbBYXiV1w QITw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=dDMspI4U; 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.56.35; Tue, 20 Jun 2017 02:56:35 -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=dDMspI4U; 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 S1751998AbdFTJ4c (ORCPT + 25 others); Tue, 20 Jun 2017 05:56:32 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38317 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbdFTJhU (ORCPT ); Tue, 20 Jun 2017 05:37:20 -0400 Received: by mail-wm0-f54.google.com with SMTP id u195so14554745wmd.1 for ; Tue, 20 Jun 2017 02:37:20 -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=z5XvP8vgaYR3uGdKV3t2tq0dbW8dP5rTTTSzYNub3gM=; b=dDMspI4Uho51GbJ3SN3wIEhO7jo2245Dod+vApBpPvWS86JFI+Tx1aN44Hn6zlPfyW 5OGxmys7eI5CNcy099aF4RydogMN0D+jytGY1Zi2eHpGF2+wennONLtgpkitC57lSBWm tdv4l6LjejXKcNx2JlROeERQOTfxyZhXu7Jbg= 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=z5XvP8vgaYR3uGdKV3t2tq0dbW8dP5rTTTSzYNub3gM=; b=dmqe9reCD4gixMD7PgPV9mOPHnowAl7Y5ddAX5Qc4iE/spuG/ne1ldRXAWyJlf+0cH Xdk6BHk2u7ocne/XRSsQt8kxZz8At6zXv/vHjNIK9aUnOz/bwUzuZfe4QQk4vc8MWymC uYt4zNoxP0lNg0KZerGMCFZRukJf7DVdB/oo9jqwMvbpcpnNAMplhFtHWeDPfl/ugweu HPPwIa77vDwemLLDL03okhZpUUaYzo8+mvGip0uLqKpDk0/hhawyEFvv9TvS73XW27G6 7731xiBVa6kQEx1+gMAc8zGfDgj8u+BoMPjvzqhguk4XI3MQj5N/og4QJl/5TZAT8PDY /PPA== X-Gm-Message-State: AKS2vOzW68KrLbc9QBbuLmvic2YpX46IVw5hQBPJn4YnlZA9JewHzQOK h9NNvGyriZtdwz3O X-Received: by 10.28.40.198 with SMTP id o189mr1996865wmo.102.1497951434330; Tue, 20 Jun 2017 02:37:14 -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.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:37:13 -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 09/51] rtc: at32ap700x: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:17 +0200 Message-Id: <1497951359-13334-10-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-at32ap700x.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c index de8bf56..db58cf5 100644 --- a/drivers/rtc/rtc-at32ap700x.c +++ b/drivers/rtc/rtc-at32ap700x.c @@ -61,7 +61,7 @@ struct rtc_at32ap700x { struct rtc_device *rtc; void __iomem *regs; - unsigned long alarm_time; + unsigned long long alarm_time; unsigned long irq; /* Protect against concurrent register access. */ spinlock_t lock; @@ -70,10 +70,10 @@ struct rtc_at32ap700x { static int at32_rtc_readtime(struct device *dev, struct rtc_time *tm) { struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); - unsigned long now; + unsigned long long now; now = rtc_readl(rtc, VAL); - rtc_time_to_tm(now, tm); + rtc_time64_to_tm(now, tm); return 0; } @@ -81,14 +81,12 @@ static int at32_rtc_readtime(struct device *dev, struct rtc_time *tm) static int at32_rtc_settime(struct device *dev, struct rtc_time *tm) { struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); - unsigned long now; - int ret; + unsigned long long now; - ret = rtc_tm_to_time(tm, &now); - if (ret == 0) - rtc_writel(rtc, VAL, now); + now = rtc_tm_to_time64(tm); + rtc_writel(rtc, VAL, now); - return ret; + return 0; } static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) @@ -96,7 +94,7 @@ static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); spin_lock_irq(&rtc->lock); - rtc_time_to_tm(rtc->alarm_time, &alrm->time); + rtc_time64_to_tm(rtc->alarm_time, &alrm->time); alrm->enabled = rtc_readl(rtc, IMR) & RTC_BIT(IMR_TOPI) ? 1 : 0; alrm->pending = rtc_readl(rtc, ISR) & RTC_BIT(ISR_TOPI) ? 1 : 0; spin_unlock_irq(&rtc->lock); @@ -107,15 +105,12 @@ static int at32_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) { struct rtc_at32ap700x *rtc = dev_get_drvdata(dev); - unsigned long rtc_unix_time; - unsigned long alarm_unix_time; - int ret; + unsigned long long rtc_unix_time; + unsigned long long alarm_unix_time; rtc_unix_time = rtc_readl(rtc, VAL); - ret = rtc_tm_to_time(&alrm->time, &alarm_unix_time); - if (ret) - return ret; + alarm_unix_time = rtc_tm_to_time64(&alrm->time); if (alarm_unix_time < rtc_unix_time) return -EINVAL; @@ -131,7 +126,7 @@ static int at32_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) & ~RTC_BIT(CTRL_TOPEN)); spin_unlock_irq(&rtc->lock); - return ret; + return 0; } static int at32_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)