From patchwork Tue Jun 20 09:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105971 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1277173qgd; Tue, 20 Jun 2017 02:45:21 -0700 (PDT) X-Received: by 10.98.68.2 with SMTP id r2mr29424037pfa.45.1497951921124; Tue, 20 Jun 2017 02:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951921; cv=none; d=google.com; s=arc-20160816; b=YeHWd+W4rBQvizbtVbDr/Itf1rRux1B7ER4l3jzVU56qbw90+yBeYRe91rsOSPyAiu svPQrLglhzKPm2negkj3VZAKeCKtG1zz7mz0wdrKutkg7zDnjRdIfRV856Ub6bZb4qG7 VFfEqrDTq/qZc1Dak1ZpYbJvxE30GTL/GRUtP3TGT7NaX6hwG0D8ZCBchUEAIYVR9M1b woFYdtq9kPv6BPiQFK5r5kW3DK4vAAeyyEVql1BCyDTnqGY4bcul7djbE/lc2FgNTo3b VEhiaFfV0+WQJ4nnTczTHqQQH+YDlI4tOpxKpDx4OE4XaK1CHlIUN3Wce93RUJxy7E5E zvwg== 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=vEeYG3v1P0dwYUux5WQrW33NB0kgjbSKCc6XzsLl61U=; b=ZDX/JgN0Ayvv1uAZ01CcX8SbQuQOQf3/FBffV6GGKSHlhRHVGtjrJYunqXzdv5K8rp IPH0B4OOfQsm6H6r56RxFmQhbcpMlbSvG0ssp+pNkmhKr+2we+iPfE6n6BNpt4yfYqsC 5lKJ/toubE7kv2+qIqG31R3sqOO8Ps53KnSpgtK+invx1rpGtXK469tUKiALG5j6z4J2 0oGOGEQG2+uvsjjmWVcl8iXUVnmnEPDL0/29cCdcZBpFf2HofT8H1z7G0u0n3Bcpz/RV 0MhRofHiE3Absl80UMyNXdhHiEMjwK4aVI5wbLjIvU/tcQLGaLaOlJiwLaQhjdUuabJW 6K2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=IMNi6Xgo; 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 s129si3023913pgc.348.2017.06.20.02.45.20; Tue, 20 Jun 2017 02:45:21 -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=IMNi6Xgo; 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 S1753138AbdFTJpQ (ORCPT + 25 others); Tue, 20 Jun 2017 05:45:16 -0400 Received: from mail-wr0-f178.google.com ([209.85.128.178]:36078 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752918AbdFTJiU (ORCPT ); Tue, 20 Jun 2017 05:38:20 -0400 Received: by mail-wr0-f178.google.com with SMTP id c11so32958956wrc.3 for ; Tue, 20 Jun 2017 02:38: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=vEeYG3v1P0dwYUux5WQrW33NB0kgjbSKCc6XzsLl61U=; b=IMNi6Xgo6IxKB5bgsLBsTBuLU5H/bUO9YP/WNP4jDt9fhhCKFETdBkRq81fKgICsI3 240FQzcJK6vjzM8xPuGcdkJsA5p+vie6wSnWk2J7qFr77WwfUPN88awqcbbwTFD3o4uI fQ3I13NAZUwAM1wRgbpQZzlgGPR9gWJM3mJfg= 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=vEeYG3v1P0dwYUux5WQrW33NB0kgjbSKCc6XzsLl61U=; b=ks9G92Z7QD5BBGK2MTMTogeBLa++e7+DV04ts4RRQSFu3yNZkgoLVSmYsfGnEAno8/ Y6ce4/c8T8gnXjdGUQ0AvJhhszM/R4/ktXTbHPAJhss7M5DgunvEl8kUApU6bD0CJCbF khTtJhylY53e0YFhSAcWAqxzsiZIQGkRAmKuJBm0+0r9MPeCgKLn2w8hxT0zr6pNtL53 4v+Tgjxd67OxmvDN4kil2UhBuSeJG/JJlYRzO4MoN15SRCwWleuUAwltti7M/d34JrQr YlRWZMdpGNK5D8mDKJky4gxwE1ySbOZcgiw8dmoruVYC/OTvBt9lKorCPBjDoA7QFO7i XCZg== X-Gm-Message-State: AKS2vOwiosVfpbC87MjBTbRb+qBgdofd1RbUu6XbkHHhDDMQAP4/BNBk lJFP0xaTjQlDlFPl X-Received: by 10.223.139.21 with SMTP id n21mr4559966wra.42.1497951499559; Tue, 20 Jun 2017 02:38:19 -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.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:19 -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 37/51] rtc: sa1100: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:45 +0200 Message-Id: <1497951359-13334-38-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-sa1100.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c index c2187bf..8645b9a 100644 --- a/drivers/rtc/rtc-sa1100.c +++ b/drivers/rtc/rtc-sa1100.c @@ -155,20 +155,19 @@ static int sa1100_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct sa1100_rtc *info = dev_get_drvdata(dev); - rtc_time_to_tm(readl_relaxed(info->rcnr), tm); + rtc_time64_to_tm(readl_relaxed(info->rcnr), tm); return 0; } static int sa1100_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct sa1100_rtc *info = dev_get_drvdata(dev); - unsigned long time; - int ret; + unsigned long long time; - ret = rtc_tm_to_time(tm, &time); - if (ret == 0) - writel_relaxed(time, info->rcnr); - return ret; + time = rtc_tm_to_time64(tm); + writel_relaxed(time, info->rcnr); + + return 0; } static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) @@ -185,13 +184,11 @@ static int sa1100_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct sa1100_rtc *info = dev_get_drvdata(dev); - unsigned long time; - int ret; + unsigned long long time; spin_lock_irq(&info->lock); - ret = rtc_tm_to_time(&alrm->time, &time); - if (ret != 0) - goto out; + time = rtc_tm_to_time64(&alrm->time); + writel_relaxed(readl_relaxed(info->rtsr) & (RTSR_HZE | RTSR_ALE | RTSR_AL), info->rtsr); writel_relaxed(time, info->rtar); @@ -199,10 +196,10 @@ static int sa1100_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) writel_relaxed(readl_relaxed(info->rtsr) | RTSR_ALE, info->rtsr); else writel_relaxed(readl_relaxed(info->rtsr) & ~RTSR_ALE, info->rtsr); -out: + spin_unlock_irq(&info->lock); - return ret; + return 0; } static int sa1100_rtc_proc(struct device *dev, struct seq_file *seq)