From patchwork Tue Jun 20 09:35:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105960 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1275671qgd; Tue, 20 Jun 2017 02:40:35 -0700 (PDT) X-Received: by 10.99.43.5 with SMTP id r5mr30167386pgr.135.1497951634957; Tue, 20 Jun 2017 02:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951634; cv=none; d=google.com; s=arc-20160816; b=VJiSSWOqAKyN/b25YH3wA9tXcM7z5BOFEVPlDpNdqdXJjQ3gZrMDlNHXdi8Fl5C0iK FW2vm6HGtbqrlnXWLT0ARsD53BAIIspSv8yntVA2tv5HZ+Kol1SfBErHNoVKOqlC8SFd XqBtxEReZyCb3j6yxv6eCFoPLQjcp3bQVYkANtZMRYHEUSelgqFplwf8Ot+e2k6V3A2L E1I0MhSkh3+DRr2PIeTv7eC2E4x7BXz2LFbnmBteXV9qawHZhk18LtWClxQfIN6ztClZ q5ogvG7VcA1kW00HB9iZe2EJ1v9xnb9zDG1izNmXqlz54Gh8UF1JSTXaT1llEQC1uHZK M2LQ== 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=ADEuBqQGCjqkPkRH5eMD7WRJK1k/+jVp5dnpZhHeNVI=; b=zZOX3Efq/pDkeavDuf0X8zlN96pJgW1tMtzvrfsml2+kyWoQ9sUHNimOkQPCvvQV22 +5uMXwfEl7/h5vDs6aPz0ZZso1hUi70QMwdetp4RunenwC1/gciUSnAhWAcUyv4zixdF 8fG9JoPfBuzYq/u+YTvZTD4hXotHTKcHw5OR16rayd8iHbpD1AIiFV0+RMT8wM6hURaQ CXPk7AzpHbTszmU4KyDEV70CuGFZo0V/zFhBhHDeBjXaWdFEaOPJ4iVdvJYBXpMOu8fb soZe14iVVyKEUeyk8bDLKqhRt8jpRZpiQ+SFQmVW/gQbVhmTrYs1jVVnFsV8LHnaqBpe QG7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=HH7CVvMT; 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 h1si10909193pld.476.2017.06.20.02.40.34; Tue, 20 Jun 2017 02:40:34 -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=HH7CVvMT; 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 S1752631AbdFTJkU (ORCPT + 25 others); Tue, 20 Jun 2017 05:40:20 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35792 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753116AbdFTJil (ORCPT ); Tue, 20 Jun 2017 05:38:41 -0400 Received: by mail-wm0-f48.google.com with SMTP id x70so16049885wme.0 for ; Tue, 20 Jun 2017 02:38:40 -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=ADEuBqQGCjqkPkRH5eMD7WRJK1k/+jVp5dnpZhHeNVI=; b=HH7CVvMT08PZw7AJAgfUR47JcAxl+p/LvQ7q1pP6JwZclGgmGxzRV24XaSnpbSnsnq w5VkoQweIqeimeQpbC7NyKKMwHJoW6fXbvadLP/QzWGV3ZvruFL6AIKEek9eM2Icn//A k/sKtFRjoziq9xBQJPz3BtcZ2yebxSmZhSE40= 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=ADEuBqQGCjqkPkRH5eMD7WRJK1k/+jVp5dnpZhHeNVI=; b=UW2fVrnF89d5+5uaUfjDOb9dmpe0l1PMelkIhR2apXIKzs2uxjK1DjHavJBOVwp0m1 j8sGFg5wrnqerM9Ceo+SB9XQPSlezbDt2Qx+vf2ygJR84JnV3bpd/3M4r0qtSxxd4Met QplkIVyoE4oapPB52Zo/SmQpC7ab8ynpywy1DwLf9GdH+bwPLArDL/BYvILOVXkIi7dd dSeoUSDDELmivG8PUyFru715e4nZZI0T16yRuQJSq9KuPPvDJSz0Bd4HyMGRg6tnpftp 5Sql7hd3+RMySiZFyTrZTrIAXESJlvNTIDB+FVr3xRPdGBAPRxTJ9+/LcaCmkyORNNAc 6grw== X-Gm-Message-State: AKS2vOwe2/gueu5ugetQf4b3JFg6HYWg57UCJNysjogh4/T6wW5QcDb3 LX1abBOpqTYpksk9 X-Received: by 10.28.229.6 with SMTP id c6mr1945043wmh.49.1497951519964; Tue, 20 Jun 2017 02:38:39 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:39 -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, patches@opensource.wolfsonmicro.com Subject: [PATCH 49/51] rtc: wm831x: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:57 +0200 Message-Id: <1497951359-13334-50-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: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: patches@opensource.wolfsonmicro.com --- drivers/rtc/rtc-wm831x.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-wm831x.c b/drivers/rtc/rtc-wm831x.c index 75aea4c..e42b07c 100644 --- a/drivers/rtc/rtc-wm831x.c +++ b/drivers/rtc/rtc-wm831x.c @@ -153,9 +153,9 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm) continue; if (memcmp(time1, time2, sizeof(time1)) == 0) { - u32 time = (time1[0] << 16) | time1[1]; + u64 time = (time1[0] << 16) | time1[1]; - rtc_time_to_tm(time, tm); + rtc_time64_to_tm(time, tm); return rtc_valid_tm(tm); } @@ -169,12 +169,12 @@ static int wm831x_rtc_readtime(struct device *dev, struct rtc_time *tm) /* * Set current time and date in RTC */ -static int wm831x_rtc_set_mmss(struct device *dev, unsigned long time) +static int wm831x_rtc_set_mmss64(struct device *dev, time64_t time) { struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev); struct wm831x *wm831x = wm831x_rtc->wm831x; struct rtc_time new_tm; - unsigned long new_time; + unsigned long long new_time; int ret; int count = 0; @@ -215,11 +215,7 @@ static int wm831x_rtc_set_mmss(struct device *dev, unsigned long time) if (ret < 0) return ret; - ret = rtc_tm_to_time(&new_tm, &new_time); - if (ret < 0) { - dev_err(dev, "Failed to convert time: %d\n", ret); - return ret; - } + new_time = rtc_tm_to_time64(&new_tm); /* Allow a second of change in case of tick */ if (new_time - time > 1) { @@ -238,7 +234,7 @@ static int wm831x_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev); int ret; u16 data[2]; - u32 time; + u64 time; ret = wm831x_bulk_read(wm831x_rtc->wm831x, WM831X_RTC_ALARM_1, 2, data); @@ -249,7 +245,7 @@ static int wm831x_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) time = (data[0] << 16) | data[1]; - rtc_time_to_tm(time, &alrm->time); + rtc_time64_to_tm(time, &alrm->time); ret = wm831x_reg_read(wm831x_rtc->wm831x, WM831X_RTC_CONTROL); if (ret < 0) { @@ -286,13 +282,9 @@ static int wm831x_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) struct wm831x_rtc *wm831x_rtc = dev_get_drvdata(dev); struct wm831x *wm831x = wm831x_rtc->wm831x; int ret; - unsigned long time; + unsigned long long time; - ret = rtc_tm_to_time(&alrm->time, &time); - if (ret < 0) { - dev_err(dev, "Failed to convert time: %d\n", ret); - return ret; - } + time = rtc_tm_to_time64(&alrm->time); ret = wm831x_rtc_stop_alarm(wm831x_rtc); if (ret < 0) { @@ -346,7 +338,7 @@ static irqreturn_t wm831x_alm_irq(int irq, void *data) static const struct rtc_class_ops wm831x_rtc_ops = { .read_time = wm831x_rtc_readtime, - .set_mmss = wm831x_rtc_set_mmss, + .set_mmss64 = wm831x_rtc_set_mmss64, .read_alarm = wm831x_rtc_readalarm, .set_alarm = wm831x_rtc_setalarm, .alarm_irq_enable = wm831x_rtc_alarm_irq_enable,