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: 105953 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1275016qgd; Tue, 20 Jun 2017 02:38:38 -0700 (PDT) X-Received: by 10.101.91.143 with SMTP id i15mr4752458pgr.168.1497951517990; Tue, 20 Jun 2017 02:38:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951517; cv=none; d=google.com; s=arc-20160816; b=Iff+RQjARq+hVvee35ANiiDzAx9tBFmqlb17CHoYB/4t3UkSxNljc0b8yTNuK4DD4D YiydiX1sxBWLxCLP2S9/izThUHm8LvpLpaOh+QhCE0p4AeDcmpu9AIS2TO6u2cv4svJq Ls+dz2nopOUSAYNINdyxcIp48pEw2hQrBA6EotgnFLjBXzIQ0nmaWhbCRh/uhjBoMSqx +hh+A9s3kOqpmHOl49qjfk+m9fO2suB9N4WxxUaPb8MRl8dKQH/3ZNHkADJCi1hlT9nU 6nW/SeaAxpq9BHf461nJhvJ+o6OiiK4d/jIHDyx4mFGlxpzCf/K34NLSEyFWGrBRwMlJ b2DA== 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=H+LdICScUW70SfoWe/kq1C9GzjpLyFXbcqFkQNfFB6E=; b=ZSji8HU3BxkE7irO60XVBLNLre2guO1BtlTV7ycEOcguGtGCJumvY2ZCEI2QGqoq7z X12qPT0nN2xDQopLLpa6gK3FwTIwapR1xEuVpbdetZHCC5E0fmMPDamtZZcZQBRcV5um skeSdp+mU6VYXzNdkv32g3k1y4Is6u24CYVnBPTTU5VvEvwhULrznb1irLkfRndGQ7L1 iuYhwiSEjafvtJX1oUkwDK4v7fDD3M5c4FzW21j5ExxSWk2KQnXMH3I5MzkD7sKFq45p QXiLN/E48w9SlK92MmdkERvm0WXM9hDTIJdLXXhHF+1ZK8DMlZKMZCe5AgsCOAir8o6M tE5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=ehW9HCi/; 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 o12si11120496plg.593.2017.06.20.02.38.37; Tue, 20 Jun 2017 02:38:37 -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=ehW9HCi/; 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 S1753042AbdFTJiZ (ORCPT + 25 others); Tue, 20 Jun 2017 05:38:25 -0400 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38831 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752967AbdFTJiR (ORCPT ); Tue, 20 Jun 2017 05:38:17 -0400 Received: by mail-wm0-f51.google.com with SMTP id u195so14576054wmd.1 for ; Tue, 20 Jun 2017 02:38: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=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=FOJgsgOWpJZqcRWqZV+dUyGPWvf/DIhYSW3t0L+uAatsjUAJXK8VqTdWiq6k3YWCNS wgscQiZ4/2dpjIirgZrAnL763d9YdF5JyJaKz0giyffA5aaDQ+cSmGvMRGp3+2TTVpaF p2yDMSiUapcomNLVD6XGQmSOLbYapdeM2qo8M16QZKSK/YqDj3XD2OkoETfWwkBofaHZ aLr5Fng0MDGDDdeAgFMbdReYLC3oYuO6z+FMP65lcAvD7VW47+HyzU4AVb9eK/Ig3SWV VIHXMJcUYCM3L72gzcVGaWPalqCVhR82DB8TqOYmgsUOBs6RmT5meyZxJYvay83v8j5w s4kw== X-Gm-Message-State: AKS2vOwtNFUoGXZJ/DQjXFDRARxS5/tDJDYRQvkTQPm10V9bCnVGdcsx gblsXENfeI2UEQ6G 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 Cc: linaro-kernel@lists.linaro.org, Vladimir Zapolskiy , Sylvain Lemieux , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.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> 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. 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(-) -- 1.9.1 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,