From patchwork Tue Jun 20 09:35:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105945 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1274623qgd; Tue, 20 Jun 2017 02:37:22 -0700 (PDT) X-Received: by 10.98.156.1 with SMTP id f1mr29870100pfe.192.1497951442874; Tue, 20 Jun 2017 02:37:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951442; cv=none; d=google.com; s=arc-20160816; b=WdBtwjstAYcWuwccr/ktjOKHzRlnh+/dpjw/cvDpQ+LxR9uYm+e1Lw5SuqGJnufGAJ gqa2Bd8e6xdH4RlAtl53DKhSrJMU95RVri9sCffhqufCiZcLatctzM3KtSO+JRYhZpoT nGk67ooqt+JYhlN2MGseA+2FImpZVlbyoGFO0Qz35Cp61ZngF6iSFxQNeUomgAQKkPOF EXG1cxu0hs3c/X3AwduxthAHo3ngjBDqgghlJ9jKc2fheYrDkHgWEoXNzPZrsyqCF7sT yiGV0/4hGiIWQ75mMYwj7w5r64LAdYZrpPqVKFHkFMLbruBchk1wJU4rsgwR1gnJG1ET t+zA== 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=bFTuFR+tNkK6chLQ2LzA7wtAK8aEbC5w6pSLisuAMOg=; b=xhhBi1iPkynB+ZAVIGrE63MzsVoJPtYQhodo9WjkxpviP0j9zk3VshtUdsioEy2nlM rCG2o91AcwnHcAljQUB5q+DHMrt0+7P/27l6ov1S4irXLVSJLbKVYCcNp4MFfe+k88xO kTl6kvy743C8wyg+feUHzduk4g2kI4ib+qBJGgqHpeuy976X+ceciOULusTaWw/F5S5M 8+LZoa0LGbx8keunwoN+HEOguVfr5tZXIiBf9j7dol9KUm46C0c3v1MU0Bq6qGscyej4 t1sUH9iMXNY7GDsU7bU680exJATjI8cRa3Df3r1StTNWxJP/Z+V1tKQfr0WmPP17fg3+ CEJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=BLOFmzHU; 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 e22si11613529plj.251.2017.06.20.02.37.22; Tue, 20 Jun 2017 02:37:22 -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=BLOFmzHU; 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 S1752630AbdFTJhS (ORCPT + 25 others); Tue, 20 Jun 2017 05:37:18 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34897 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbdFTJhO (ORCPT ); Tue, 20 Jun 2017 05:37:14 -0400 Received: by mail-wm0-f46.google.com with SMTP id x70so16013310wme.0 for ; Tue, 20 Jun 2017 02:37:13 -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=bFTuFR+tNkK6chLQ2LzA7wtAK8aEbC5w6pSLisuAMOg=; b=BLOFmzHU46zGhwVzxrbA2gjA7oGfIHb+nc6qu0VDwh6J4dwZeLsreS98B3kldACcyB /KBwUcRuKuQpI63JLov0Ny1BvHeRmE4T77dh1uWY1iQwDW/RkRJdwADbWnIEmOVLmIxF peb8wpE0g/WsPJBPjr7y4QE50rr//1xo2to0M= 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=bFTuFR+tNkK6chLQ2LzA7wtAK8aEbC5w6pSLisuAMOg=; b=VZ9qXUroL4GJWCyMfR9fm1XXR53BDiNWc6R6RhPuIXEkchuxklmjWYJGQB2HT2EfVs ReyMb3tYEnZVKwvXjMRzSX10Az3gr9CM2bSgKA6dmOqif8lsQX69oAkFY/vfpHdkbrd2 A2bon/HIe65HvFrM9EPib9M3Q6aV++d6Ie8BNiugYsma2ByqChZ7d3+8I250tb3YF2fy 3kaujfn+ibg8LQusqX9ZKDU2isBFQJ/2autRAAByTmJWZh8dOCz758ZMC2oQsz708LoI dCuiHCR5yvLz7xK+LIEtQldIHjZFBETrVidDYhwQ9UXPubaWzBb3uv56PaSmStpNCtwo IMXQ== X-Gm-Message-State: AKS2vOxSE5xDUKzfFfPIxrODxzUAZ/zUrQJY6oxdtDgexvONbVI1TtOk oItjVas4f3tSUj4b X-Received: by 10.28.234.193 with SMTP id g62mr1455361wmi.24.1497951432551; Tue, 20 Jun 2017 02:37:12 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:37:12 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Jason Cooper , Gregory Clement , Sebastian Hesselbarth , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH 08/51] rtc: armada38x: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:16 +0200 Message-Id: <1497951359-13334-9-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: Jason Cooper CC: Gregory Clement CC: Sebastian Hesselbarth CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org --- drivers/rtc/rtc-armada38x.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 21f355c..752ebf4 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c @@ -213,13 +213,14 @@ static void armada8k_unmask_interrupt(struct armada38x_rtc *rtc) static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - unsigned long time, flags; + unsigned long long time; + unsigned long flags; spin_lock_irqsave(&rtc->lock, flags); time = rtc->data->read_rtc_reg(rtc, RTC_TIME); spin_unlock_irqrestore(&rtc->lock, flags); - rtc_time_to_tm(time, tm); + rtc_time64_to_tm(time, tm); return 0; } @@ -227,26 +228,23 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - int ret = 0; - unsigned long time, flags; - - ret = rtc_tm_to_time(tm, &time); + unsigned long long time; + unsigned long flags; - if (ret) - goto out; + time = rtc_tm_to_time64(tm); spin_lock_irqsave(&rtc->lock, flags); rtc_delayed_write(time, rtc, RTC_TIME); spin_unlock_irqrestore(&rtc->lock, flags); -out: - return ret; + return 0; } static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - unsigned long time, flags; + unsigned long long time; + unsigned long flags; u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm); u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm); u32 val; @@ -259,7 +257,7 @@ static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) spin_unlock_irqrestore(&rtc->lock, flags); alrm->enabled = val ? 1 : 0; - rtc_time_to_tm(time, &alrm->time); + rtc_time64_to_tm(time, &alrm->time); return 0; } @@ -269,13 +267,10 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) struct armada38x_rtc *rtc = dev_get_drvdata(dev); u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm); u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm); - unsigned long time, flags; - int ret = 0; - - ret = rtc_tm_to_time(&alrm->time, &time); + unsigned long long time; + unsigned long flags; - if (ret) - goto out; + time = rtc_tm_to_time64(&alrm->time); spin_lock_irqsave(&rtc->lock, flags); @@ -288,8 +283,7 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) spin_unlock_irqrestore(&rtc->lock, flags); -out: - return ret; + return 0; } static int armada38x_rtc_alarm_irq_enable(struct device *dev,