From patchwork Tue Jun 20 09:35:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105968 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1276841qgd; Tue, 20 Jun 2017 02:44:23 -0700 (PDT) X-Received: by 10.98.73.18 with SMTP id w18mr29607392pfa.61.1497951863560; Tue, 20 Jun 2017 02:44:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951863; cv=none; d=google.com; s=arc-20160816; b=cyuimK5Pto24KkdvnXor3WbPpOMLkgE0xsgm2qoJGwKJE42OQog4tKHksBMz07UZF5 WT6PhVFXDyYkxe25KROxCOExcnZ2Yw2cUtLXc8jsCRPF839k4tpXAI80KiuJvWSOXc1Q Q7dwI5EVyrlz9TSeBelFLiwbnVRxEEJf7bEHTkxWky+yMoBt0AWVBCvzrNaBq3TqirFT UuAx7Clplqqnqhyo2Zqb2Ppxo24VdQqyr6ZkUTthbD0UIsKOocOBKV81O6gcKpASCV1S mz61VjFn/2yqDCDhGFfsU3OkcSFC82VrobFK6wvLEh/qwCORXojHNW9dKj5p1ZQvsost V1og== 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=y5W0OWQ80OCmzZ4NmZMAcK7UhjsQqIZhusYJ7ypelwU=; b=ios3tAlRvxqMAHCzluwlwyRwggJb3yCxH93fww1XdYVBCVXjVS5uObxT5AYegU6Vib /XD6NxU2iqXU2bVL5Fh7/lPtpO1jVjyQlvuCCEj5ag9RTGGfiUYfVUJ3G+zWzzJAE7uq prCl9SkyyjK1ZnAtQgHautQ7P5wJPWswWuRwIU1Mk1cYsjtHc9F76rqS7aZe2vyQvRNv 05xK2MYK8OD+YJ9ilMyzGHd+QU/aTW2EmA1abqSZvHLD8GZskwGrnK3MgZy8CESanjW2 L2/WTeO7kAKJJ13Uuo4CGDqET6IXCAHWcbjkcmXc1BcHP3dUDpeeJ8Tca4cYYsDDszNe 25yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=L/DernBQ; 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 f8si11201780pli.377.2017.06.20.02.44.23; Tue, 20 Jun 2017 02:44:23 -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=L/DernBQ; 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 S1753026AbdFTJiW (ORCPT + 25 others); Tue, 20 Jun 2017 05:38:22 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37918 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752984AbdFTJiR (ORCPT ); Tue, 20 Jun 2017 05:38:17 -0400 Received: by mail-wm0-f42.google.com with SMTP id u195so14580501wmd.1 for ; Tue, 20 Jun 2017 02:38:17 -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=y5W0OWQ80OCmzZ4NmZMAcK7UhjsQqIZhusYJ7ypelwU=; b=L/DernBQ5XtpjUbz+uWOb9HBeakpRc3+gxG2MStYBf/LwzYvMT+Tm+ev4sHbtRnpWQ pAlozUh0p4fXXcx9gBc0d/iWEw7mDpB+KslIfxiszI8a1Ks4rt4yGuKAv487Ul2xeZCy dDI9r18NmotgWc8ajlBvR0zYMi2PYwL8eP0pc= 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=y5W0OWQ80OCmzZ4NmZMAcK7UhjsQqIZhusYJ7ypelwU=; b=a1+1p92O7nj+d7XE/Poh44ZlmoV8xzhUt1c63WVQUc2yt6+dqThMKuqrlYdDzsbXF3 /bwJZWJEf2d0209uFDHsUqYHZDS2syfTiqUx7XSXaEInygU/iUIrxVR7nVRvCInMnPeD qBDWW5JAvbse4ufJdQriPXQUjoltg02zitVG4Oj9Y+EJ9oqk+fVlYuzCvyKw8L6m8coW 7/UAXk+eRwP7adGZTnm2PJbjlsjMaHXEO7Vhm7CBM8+IdcfXDncjBOZMKvjijcl1uzQ9 p4ceSSzYU5aGuNJmMGllM4A9WaArF/mwOKhET+rv9uUqM84I6G7oK1peOG4zrVYqaTwL Y7Ow== X-Gm-Message-State: AKS2vOz0NxpL7LrXJxe1RhUhArM6D6MlLkLR4PZCKCdnS57obE7W0QHB Y6ryu/DQjJpdl62i X-Received: by 10.28.216.20 with SMTP id p20mr2121589wmg.29.1497951496464; Tue, 20 Jun 2017 02:38:16 -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.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:16 -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 35/51] rtc: pm8xxx: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:43 +0200 Message-Id: <1497951359-13334-36-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-pm8xxx.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index fac8355..e6b52bd 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -81,7 +81,8 @@ struct pm8xxx_rtc { static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) { int rc, i; - unsigned long secs, irq_flags; + unsigned long long secs; + unsigned long irq_flags; u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0; unsigned int ctrl_reg; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); @@ -90,14 +91,14 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) if (!rtc_dd->allow_set_time) return -EACCES; - rtc_tm_to_time(tm, &secs); + secs = rtc_tm_to_time64(tm); for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) { value[i] = secs & 0xFF; secs >>= 8; } - dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); + dev_dbg(dev, "Seconds value to be written to RTC = %llu\n", secs); spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); @@ -156,7 +157,7 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) { int rc; u8 value[NUM_8_BIT_RTC_REGS]; - unsigned long secs; + unsigned long long secs; unsigned int reg; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; @@ -188,7 +189,7 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); - rtc_time_to_tm(secs, tm); + rtc_time64_to_tm(secs, tm); rc = rtc_valid_tm(tm); if (rc < 0) { @@ -196,7 +197,7 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) return rc; } - dev_dbg(dev, "secs = %lu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n", + dev_dbg(dev, "secs = %llu, h:m:s == %d:%d:%d, d/m/y = %d/%d/%d\n", secs, tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_mday, tm->tm_mon, tm->tm_year); @@ -208,11 +209,12 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) int rc, i; u8 value[NUM_8_BIT_RTC_REGS]; unsigned int ctrl_reg; - unsigned long secs, irq_flags; + unsigned long long secs; + unsigned long irq_flags; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; - rtc_tm_to_time(&alarm->time, &secs); + secs = rtc_tm_to_time64(&alarm->time); for (i = 0; i < NUM_8_BIT_RTC_REGS; i++) { value[i] = secs & 0xFF; @@ -256,7 +258,7 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) { int rc; u8 value[NUM_8_BIT_RTC_REGS]; - unsigned long secs; + unsigned long long secs; struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; @@ -269,7 +271,7 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) secs = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24); - rtc_time_to_tm(secs, &alarm->time); + rtc_time64_to_tm(secs, &alarm->time); rc = rtc_valid_tm(&alarm->time); if (rc < 0) {