From patchwork Wed Oct 16 20:12:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 1178141 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 46tk450KMdz9sPk for ; Thu, 17 Oct 2019 07:12:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394651AbfJPUM3 (ORCPT ); Wed, 16 Oct 2019 16:12:29 -0400 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:47299 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389651AbfJPUM3 (ORCPT ); Wed, 16 Oct 2019 16:12:29 -0400 X-Originating-IP: 86.202.229.42 Received: from localhost (lfbn-lyo-1-146-42.w86-202.abo.wanadoo.fr [86.202.229.42]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id AE056240003; Wed, 16 Oct 2019 20:12:27 +0000 (UTC) From: Alexandre Belloni To: linux-rtc@vger.kernel.org Cc: Biwen Li , Li Yang , linux-kernel@vger.kernel.org, Alexandre Belloni Subject: [PATCH 3/4] rtc: fsl-ftm-alarm: switch to rtc_time64_to_tm/rtc_tm_to_time64 Date: Wed, 16 Oct 2019 22:12:22 +0200 Message-Id: <20191016201223.30568-3-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191016201223.30568-1-alexandre.belloni@bootlin.com> References: <20191016201223.30568-1-alexandre.belloni@bootlin.com> MIME-Version: 1.0 Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org Call the 64bit versions of rtc_tm time conversion to avoid the y2038 issue. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-fsl-ftm-alarm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-fsl-ftm-alarm.c b/drivers/rtc/rtc-fsl-ftm-alarm.c index e954c51bf39b..039bd2f1a7ee 100644 --- a/drivers/rtc/rtc-fsl-ftm-alarm.c +++ b/drivers/rtc/rtc-fsl-ftm-alarm.c @@ -180,7 +180,7 @@ static int ftm_rtc_alarm_irq_enable(struct device *dev, */ static int ftm_rtc_read_time(struct device *dev, struct rtc_time *tm) { - rtc_time_to_tm(ktime_get_real_seconds(), tm); + rtc_time64_to_tm(ktime_get_real_seconds(), tm); return 0; } @@ -204,12 +204,13 @@ static int ftm_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) static int ftm_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) { struct rtc_time tm; - unsigned long now, alm_time, cycle; + time64_t now, alm_time; + unsigned long long cycle; struct ftm_rtc *rtc = dev_get_drvdata(dev); ftm_rtc_read_time(dev, &tm); - rtc_tm_to_time(&tm, &now); - rtc_tm_to_time(&alm->time, &alm_time); + now = rtc_tm_to_time64(&tm); + alm_time = rtc_tm_to_time64(&alm->time); ftm_clean_alarm(rtc); cycle = (alm_time - now) * rtc->alarm_freq;