From patchwork Tue Jun 20 09:35:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105956 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1275126qgd; Tue, 20 Jun 2017 02:38:58 -0700 (PDT) X-Received: by 10.84.196.129 with SMTP id l1mr34906622pld.109.1497951538073; Tue, 20 Jun 2017 02:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951538; cv=none; d=google.com; s=arc-20160816; b=pfwkAItp2uiQrIUBUgVl1EKEz7t4tKaXyC1B19pFb9d+XD8g/nWOGq1jSSEEH568uq Pstu6g0sBzXW7AyN+OpyWKi1PXj2ohpVIkZmq0KqYkdl5z93peZ1YKieV2uqJhS7WelM UmRxQ0FpfzX8x/d4MShSuAB0HGBNNMi/DsWsOmMgtGBPRLkfjFYwVJJJlbn0Hlyi+O5j 25bHejNNkQ7issm8AQavmFOEbPotTLHYeh2doh5zMJF7GghTFXs4zjUmddYrH4p3xzYu tdPPthGC2livPXzbtQGCci4M2njBhwQ2h5zx9n7ZCSKCLSZAsri+bJ6W+YRKFzqVAN2c Vv5A== 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=nXSvKHZC0uw7fNls4d/gmz382B6CA2g17RyXA6IvGFg=; b=jZztdIGW4zfdiYt2jAIeF89dIh/EIqz1u6bvbOBO2S6uIiplXPQoI+hajsM1czaLqy O7Sa4j7gpNo1nLC9UvM3ltFSeQqTU/YK81mUnF/863nxqkb8So8qy+R6XYeHyHQs5S2j SfDlxVtKYvChSSOrjPc7lgztB3f3EgNRQ+UufrKN2Xne10yILqzwrXPOsV7Bz0I2hzc3 atkkfYcDJDTyGdL5kX0aAXUGNlJNQjtZ4EhwMNtNcGzAOunIELNLL+0iewWVr2WKrprt D+Hqjx+PDJI41JAOlI72bHvQ6N6FsPkYKTN8ZNilbRByVLKLMwUzFs1PQUd6Vk0Pdbfd RqnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=F5EFrc/l; 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 h12si11629511pln.256.2017.06.20.02.38.57; Tue, 20 Jun 2017 02:38:58 -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=F5EFrc/l; 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 S1752550AbdFTJiq (ORCPT + 25 others); Tue, 20 Jun 2017 05:38:46 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35708 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753127AbdFTJim (ORCPT ); Tue, 20 Jun 2017 05:38:42 -0400 Received: by mail-wm0-f41.google.com with SMTP id x70so16046426wme.0 for ; Tue, 20 Jun 2017 02:38:37 -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=nXSvKHZC0uw7fNls4d/gmz382B6CA2g17RyXA6IvGFg=; b=F5EFrc/l7Z2z1eWh5Jc6+zksBDs38309BWNRJHsuBUOvklhx1sfEsJuz6Y1S/l/tB4 decPySmhbn9oRcIILZrFgNWGurMtRTSvKi1qGqlXUJChXRT+6eZhsmNSi32SKRqkOLrB rWXCiWEiqB5gk1SgbCA02TdF+mK3+w/r2TMMk= 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=nXSvKHZC0uw7fNls4d/gmz382B6CA2g17RyXA6IvGFg=; b=dMJWmPM351357sB1v2/GQFu6Ctpx46navNc3Aqns2aWV2Qz6IA8ViEZTO6MibxniAk 1nlAuMqPTabt5dNl5QppHKQGOkKXBjrFJSlK96+ytQElOl/B3iAqhkAN3Ge72bvIoEhd y7AWzbGMbNygbd6JUL8HgAZfRMPSiQwD0OpBbJ8jNu3MF3Qt1wAb/zXYeDTXWc5KPan5 484kfhqLyAuxTXXj74WIfsOzBsMXBsKwlRsLXVSeOisAaYLB6tHXglJnGfJ3NAMYYB4J ITJ7ELmu8dWr72iEBlr/c6U2NP8xJQDuceuSP/Bz4XnmGG6iitcItpi5zSXolijw7GiQ Soxw== X-Gm-Message-State: AKS2vOwbBSPHxo+ULR8xdK7MYe3a+UCWb7WIQhJono4ozjK4HIfmkXRf qDZ5QUy5vimtVpAM X-Received: by 10.28.18.201 with SMTP id 192mr2045219wms.2.1497951511243; Tue, 20 Jun 2017 02:38:31 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:30 -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 44/51] rtc: sysfs: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:52 +0200 Message-Id: <1497951359-13334-45-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-sysfs.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-sysfs.c b/drivers/rtc/rtc-sysfs.c index e364550..8b97def 100644 --- a/drivers/rtc/rtc-sysfs.c +++ b/drivers/rtc/rtc-sysfs.c @@ -72,9 +72,10 @@ retval = rtc_read_time(to_rtc_device(dev), &tm); if (retval == 0) { - unsigned long time; - rtc_tm_to_time(&tm, &time); - retval = sprintf(buf, "%lu\n", time); + unsigned long long time; + + time = rtc_tm_to_time64(&tm); + retval = sprintf(buf, "%llu\n", time); } return retval; @@ -132,7 +133,7 @@ wakealarm_show(struct device *dev, struct device_attribute *attr, char *buf) { ssize_t retval; - unsigned long alarm; + unsigned long long alarm; struct rtc_wkalrm alm; /* Don't show disabled alarms. For uniformity, RTC alarms are @@ -145,8 +146,8 @@ */ retval = rtc_read_alarm(to_rtc_device(dev), &alm); if (retval == 0 && alm.enabled) { - rtc_tm_to_time(&alm.time, &alarm); - retval = sprintf(buf, "%lu\n", alarm); + alarm = rtc_tm_to_time64(&alm.time); + retval = sprintf(buf, "%llu\n", alarm); } return retval; @@ -157,8 +158,8 @@ const char *buf, size_t n) { ssize_t retval; - unsigned long now, alarm; - unsigned long push = 0; + unsigned long long now, alarm; + unsigned long long push = 0; struct rtc_wkalrm alm; struct rtc_device *rtc = to_rtc_device(dev); const char *buf_ptr; @@ -170,7 +171,7 @@ retval = rtc_read_time(rtc, &alm.time); if (retval < 0) return retval; - rtc_tm_to_time(&alm.time, &now); + now = rtc_tm_to_time64(&alm.time); buf_ptr = buf; if (*buf_ptr == '+') { @@ -181,7 +182,7 @@ } else adjust = 1; } - retval = kstrtoul(buf_ptr, 0, &alarm); + retval = kstrtoull(buf_ptr, 0, &alarm); if (retval) return retval; if (adjust) { @@ -197,7 +198,7 @@ return retval; if (alm.enabled) { if (push) { - rtc_tm_to_time(&alm.time, &push); + push = rtc_tm_to_time64(&alm.time); alarm += push; } else return -EBUSY; @@ -212,7 +213,7 @@ */ alarm = now + 300; } - rtc_time_to_tm(alarm, &alm.time); + rtc_time64_to_tm(alarm, &alm.time); retval = rtc_set_alarm(rtc, &alm); return (retval < 0) ? retval : n;