From patchwork Tue Jun 20 09:35:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 105955 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp1275123qgd; Tue, 20 Jun 2017 02:38:57 -0700 (PDT) X-Received: by 10.99.96.204 with SMTP id u195mr14647963pgb.125.1497951537705; Tue, 20 Jun 2017 02:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497951537; cv=none; d=google.com; s=arc-20160816; b=IY/3uwIo1TVet9idIXWSfFC/9i2MM7VM9kP8EWVh/4aw7rJ/FS1RB1AAkN8rL9PEQ6 /hacAlhI0fxycUt4HUAP5CAYdquUvzjmkq1u92OT0/3hP7UPfe9owss0mCLYJ5Q6LNxB cYt3+78bLryTWwvwouHHd/k6ADV2U0B5dP2Niy+7ZTd7yHme2FZpw8tSfYjkj5gLO3KL UDfk4qAQzQvM2MkICfn50jBllGw1KC4Gb9X9HWO1/iktcwVLnGZ1ts313feJRU3fXwi/ WleH/eMbqQeRvHwwto+ZPQhdKYQTh6wO2rgOT3QzV4uaSVZxFrUFbq9v1lllkdNofKDi rC1w== 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=mZVfXw+bISpOHkaT9tQ/HKREYLInxA8TdPg+P0ikR50=; b=XUG4f1cbXH3mvk35kD7cYRmUODH7DJ0XW6d90FPJQEbV9+UaSx4zNEMgcNxlmjE1kg 9Rbp5E04ea20SZeK4VaccaC3FAWA2lW2cOvwNiJgR4IaWhnn1u7BC6xkcvNXkDBr9ZLB abgWK9zfZ0UDDXc8sMyb27dviWbIC5pHgfhsTd0bjmHa/MF5rSSjVN1cOA8nXuaGuzew uKeuL5W7TQhiJmD9Fr7X7wmwgAa8p+P0xQc9/G6a9c8zu4em++Z62l5vFA27fh1DWTKd VdIiKrzLknFIh1W+aADyQQ/UHaqx6MUN85nQBI8baP8/ZZ3l3T6i2x2PStTr+i5CYHCr ESBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=bQiBQZtH; 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:57 -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=bQiBQZtH; 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 S1753132AbdFTJim (ORCPT + 25 others); Tue, 20 Jun 2017 05:38:42 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:34866 "EHLO mail-wr0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753105AbdFTJii (ORCPT ); Tue, 20 Jun 2017 05:38:38 -0400 Received: by mail-wr0-f175.google.com with SMTP id y25so49140070wrd.2 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=mZVfXw+bISpOHkaT9tQ/HKREYLInxA8TdPg+P0ikR50=; b=bQiBQZtHXWnQZ9euMtY5TnpXXeK5AYo7NLfHQZ5IkFFroZbn53EoDbHxyOYosiRlCW Lz6p1qe2DGiFvWOgNyMPhmJTumXAdje5AnESK5rmjQ1CEA81fJTqn8kFgupVu9ZhzLNv bDbfEBuWUf/o9gIWsy6uU3HBRIXSNF6SfAcDU= 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=mZVfXw+bISpOHkaT9tQ/HKREYLInxA8TdPg+P0ikR50=; b=oMsmjoQhxtKoPnJS4P7t0PCjDkjCeu9WkwQZfs4KHSlyukotdfsgiH3G+E0t0nBmyE Ywzh3mnqKhVIX3al9urFPFpTz3j1WB5pvomPTlomo1IAp+RmmzX6PbCtDyK/A1XU7In9 UBymy2giQWsjDY0RlU9Gmt2f+PtZ4uDtkygd6hKO4/AXBQsVf3tADeSCc219pZdlUvrh nsQH5FBdHnnbqOVhfgVEDU+PWgVZjC2t6gv/NbRvcQN8styjLfg6F4WHrnRhst0lDBos xRRhU7eSSiVd102/2pW1u8PXzdJFPTIWpUkdePx7H9/tclGpCezq8CZPJ3qP59oXiAJq zufw== X-Gm-Message-State: AKS2vOyI03C7EJxyyuhR/vfHEq/Ft6LbjTuQLL0vrkUHn24WkS3mXczP qFXpG3+gNCABBm8z X-Received: by 10.223.151.213 with SMTP id t21mr6032253wrb.20.1497951516550; Tue, 20 Jun 2017 02:38:36 -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.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 02:38:36 -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 47/51] rtc: tps6586: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:55 +0200 Message-Id: <1497951359-13334-48-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-tps6586x.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) -- 1.9.1 diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c index a3418a8..2383636 100644 --- a/drivers/rtc/rtc-tps6586x.c +++ b/drivers/rtc/rtc-tps6586x.c @@ -71,7 +71,7 @@ static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm) struct tps6586x_rtc *rtc = dev_get_drvdata(dev); struct device *tps_dev = to_tps6586x_dev(dev); unsigned long long ticks = 0; - unsigned long seconds; + unsigned long long seconds; u8 buff[6]; int ret; int i; @@ -89,7 +89,7 @@ static int tps6586x_rtc_read_time(struct device *dev, struct rtc_time *tm) seconds = ticks >> 10; seconds += rtc->epoch_start; - rtc_time_to_tm(seconds, tm); + rtc_time64_to_tm(seconds, tm); return rtc_valid_tm(tm); } @@ -98,18 +98,18 @@ static int tps6586x_rtc_set_time(struct device *dev, struct rtc_time *tm) struct tps6586x_rtc *rtc = dev_get_drvdata(dev); struct device *tps_dev = to_tps6586x_dev(dev); unsigned long long ticks; - unsigned long seconds; + unsigned long long seconds; u8 buff[5]; int ret; - rtc_tm_to_time(tm, &seconds); + seconds = rtc_tm_to_time64(tm); if (seconds < rtc->epoch_start) { dev_err(dev, "requested time unsupported\n"); return -EINVAL; } seconds -= rtc->epoch_start; - ticks = (unsigned long long)seconds << 10; + ticks = seconds << 10; buff[0] = (ticks >> 32) & 0xff; buff[1] = (ticks >> 24) & 0xff; buff[2] = (ticks >> 16) & 0xff; @@ -157,16 +157,16 @@ static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct tps6586x_rtc *rtc = dev_get_drvdata(dev); struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long seconds; - unsigned long ticks; - unsigned long rtc_current_time; + unsigned long long seconds; + unsigned long long ticks; + unsigned long long rtc_current_time; unsigned long long rticks = 0; u8 buff[3]; u8 rbuff[6]; int ret; int i; - rtc_tm_to_time(&alrm->time, &seconds); + seconds = rtc_tm_to_time64(&alrm->time); if (alrm->enabled && (seconds < rtc->epoch_start)) { dev_err(dev, "can't set alarm to requested time\n"); @@ -196,7 +196,7 @@ static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) if ((seconds - rtc_current_time) > ALM1_VALID_RANGE_IN_SEC) seconds = rtc_current_time - 1; - ticks = (unsigned long long)seconds << 10; + ticks = seconds << 10; buff[0] = (ticks >> 16) & 0xff; buff[1] = (ticks >> 8) & 0xff; buff[2] = ticks & 0xff; @@ -212,8 +212,8 @@ static int tps6586x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct tps6586x_rtc *rtc = dev_get_drvdata(dev); struct device *tps_dev = to_tps6586x_dev(dev); - unsigned long ticks; - unsigned long seconds; + unsigned long long ticks; + unsigned long long seconds; u8 buff[3]; int ret; @@ -227,7 +227,7 @@ static int tps6586x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) seconds = ticks >> 10; seconds += rtc->epoch_start; - rtc_time_to_tm(seconds, &alrm->time); + rtc_time64_to_tm(seconds, &alrm->time); return 0; }