From patchwork Tue Jun 20 09:35:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105969 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1277052qgd; Tue, 20 Jun 2017 02:45:02 -0700 (PDT) X-Received: by 10.84.132.42 with SMTP id 39mr34246300ple.226.1497951902389; Tue, 20 Jun 2017 02:45:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951902; cv=none; d=google.com; s=arc-20160816; b=hhsORrBYYEzgBGIFaw9mXQV4MluF2jT4kDCk+D6s6BUypAjFxSCY/8VSY0WamsxPH1 sifLzMkqRUFmFXt7azmEkVo2+/H98JzCntbIvPAdLbGWEdPyhFG7MOFVJI5oeje+8HzT /PzgdN2VbQ4VNt1xkiUuelsPitBrUr4Qq1Pv2mCD+AemzkjoVt1RJiV01fxHIzVXkYEF VNzFrWBDMbCCUf7Gw+uMzNKZ/fjIcXy2YJ7tj/miOTitNQtKwI49bJl+fKe5GnDuOf/v zhiNQOGH6eSFn1H8e62R5u1YpcQk/jAVWABzLLbW60rHpRodNi1aNQkTL3YKJlJkL4NL C4lA== 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=2+VrQinv8y8IjhpmSE6ShuyuOYFwnl8rbzbhn72pOvE=; b=NI4Sg7GrB1KHv7iOMTpVQ25sLlVUlYaovKQvXcAdsrtFWsxQQuiAKdqGNVgJn8srjI 34+BVosi55iQs1CPRuA9i5jrVFSdMRV8KbWWva8gvn5lhmmVE2Wuu6a+mpH6sqrtAUyl tS+/Slhj0mNGX0T9+n+sbVl0w5gPOJVck8xbrhEoX3QSXzqIaVSRnTLoCN96otoxDb7V zlFgoXAjCGVtw2EcXZWDmA1Ng3b8Q/CZ19IqRUCRrN70ak9w48PBIDnQjv9QIWS4emlw n5JcCfb4Nn0uaZl1Dx//1Odr5rDgPTmulrVscrs89rllNahM3JW+6mkt2M+6keb7UTmz 7BFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=eVAt8hRF; 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 z74si10117679pfa.159.2017.06.20.02.45.01; Tue, 20 Jun 2017 02:45:02 -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=eVAt8hRF; 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 S1753196AbdFTJos (ORCPT + 25 others); Tue, 20 Jun 2017 05:44:48 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37138 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752973AbdFTJiV (ORCPT ); Tue, 20 Jun 2017 05:38:21 -0400 Received: by mail-wm0-f42.google.com with SMTP id d73so14638891wma.0 for ; Tue, 20 Jun 2017 02:38:15 -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=2+VrQinv8y8IjhpmSE6ShuyuOYFwnl8rbzbhn72pOvE=; b=eVAt8hRFU7DAVl5tJovu0k0iJ+kXYuYwZ+RLUlp3i0JOFNCOPTTcF64VZpwlPjP7Vm YYTMgZ+R01fS1jpgcPHthuX/+FvTWe++vv1J+Rrc4MJ0uX5gIVpPXPV7RO/Ik22dPJGs 8jp2gaIcFAURLs0Oh+NDkiwzrQJX/euzSIncY= 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=2+VrQinv8y8IjhpmSE6ShuyuOYFwnl8rbzbhn72pOvE=; b=rnTYBjND+R7K5JDSB6f+eq5CFm2hy1dStSl5eNEv7YUUm9BHmT/0XrwyDDMAvXN1lS qdUbNVfshGo67F3ZgUytnQl2GFh5igAOV4Gdhzq7KLDb0GtRaQLgWeCo5tc4fyoSjpQa x15aXmh1X90tGUAaapYNZhC4gWGLKvW0PG1EgHNmqr4BgiYeZtZSRx3wZwM9jmO+6kRq ctgJYoG/lOVH22aJG4WD5imarK9748JTTythXYGVOLlmuZ3yuO5ao96lD6kiBmRXTxu5 QZJ4f3D7PUOtxxkrB1QShVj8Zu32tCinVNj+wAtdd3/jlvIPwjsZhwxHydyK5nyG9i1u Ygvw== X-Gm-Message-State: AKS2vOzO4AJPytVOQP7whvdgc1pDpUADXoWv+jQC/5/5aP4rgxIaPyDe Wwga5CjtGTNesYAx X-Received: by 10.28.101.213 with SMTP id z204mr2154228wmb.106.1497951494866; Tue, 20 Jun 2017 02:38: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.38.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:14 -0700 (PDT) From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Linus Walleij , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 34/51] rtc: pl031: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:42 +0200 Message-Id: <1497951359-13334-35-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: Linus Walleij 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-pl031.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) -- 1.9.1 Acked-by: Linus Walleij diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index e1687e1..07f72b3 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -127,11 +127,11 @@ static int pl031_stv2_tm_to_time(struct device *dev, return -EINVAL; } else if (wday == -1) { /* wday is not provided, calculate it here */ - unsigned long time; + unsigned long long time; struct rtc_time calc_tm; - rtc_tm_to_time(tm, &time); - rtc_time_to_tm(time, &calc_tm); + time = rtc_tm_to_time64(tm); + rtc_time64_to_tm(time, &calc_tm); wday = calc_tm.tm_wday; } @@ -252,30 +252,27 @@ static int pl031_read_time(struct device *dev, struct rtc_time *tm) { struct pl031_local *ldata = dev_get_drvdata(dev); - rtc_time_to_tm(readl(ldata->base + RTC_DR), tm); + rtc_time64_to_tm(readl(ldata->base + RTC_DR), tm); return 0; } static int pl031_set_time(struct device *dev, struct rtc_time *tm) { - unsigned long time; + unsigned long long time; struct pl031_local *ldata = dev_get_drvdata(dev); - int ret; - - ret = rtc_tm_to_time(tm, &time); - if (ret == 0) - writel(time, ldata->base + RTC_LR); + time = rtc_tm_to_time64(tm); + writel(time, ldata->base + RTC_LR); - return ret; + return 0; } static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct pl031_local *ldata = dev_get_drvdata(dev); - rtc_time_to_tm(readl(ldata->base + RTC_MR), &alarm->time); + rtc_time64_to_tm(readl(ldata->base + RTC_MR), &alarm->time); alarm->pending = readl(ldata->base + RTC_RIS) & RTC_BIT_AI; alarm->enabled = readl(ldata->base + RTC_IMSC) & RTC_BIT_AI; @@ -286,17 +283,15 @@ static int pl031_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) static int pl031_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct pl031_local *ldata = dev_get_drvdata(dev); - unsigned long time; + unsigned long long time; int ret; /* At the moment, we can only deal with non-wildcarded alarm times. */ ret = rtc_valid_tm(&alarm->time); if (ret == 0) { - ret = rtc_tm_to_time(&alarm->time, &time); - if (ret == 0) { - writel(time, ldata->base + RTC_MR); - pl031_alarm_irq_enable(dev, alarm->enabled); - } + time = rtc_tm_to_time64(&alarm->time); + writel(time, ldata->base + RTC_MR); + pl031_alarm_irq_enable(dev, alarm->enabled); } return ret;