From patchwork Thu Apr 2 03:34:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46689 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 44A27216D1 for ; Thu, 2 Apr 2015 03:35:34 +0000 (UTC) Received: by wgfh4 with SMTP id h4sf14302022wgf.1 for ; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=SQSxRFyOijyy/4HhQQmASbV7H4ZITLPD7XwSMVkRhR0=; b=QjyfrNNoBpfqUo7XT9H2cNnDcgMR2TPvA9INwPY2RILiq8l3ZZ9/m/KCh6bRu8VcD9 9bB7MBJFBn6zUaDJDzGwblJgQCa/F+TobLbA9cd2rFHqWxp2L0OTJPnr9HgOk3Fxtzoi TrnXPxKD3HLo03kEebcJwTBQvPEIOg2IqLa0k3xwi2xZemyTzoZoko1IzNwKG95ezxGi pD5MjFf4IgAsE3ch0fGwJvZXcKdb3fAkqGV6YFXJpIvW1LFNKS/0QXE3N94ASU+BRgwA LRUoODA81y9RsJRC1dqh/NnTEZosYtQIIJd5Kk2i0AYHy/uZDa0aTcwmImN/kDcVoN5v Gr5Q== X-Gm-Message-State: ALoCoQm7HrQFmobgD1avCSmEesGUNB6g4LrwQ9sVb0Z+9UqcnEthVey24rAAgphOw/HQDX2Mxwzx X-Received: by 10.112.137.202 with SMTP id qk10mr3043758lbb.21.1427945733612; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.27.74 with SMTP id r10ls144381lag.55.gmail; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) X-Received: by 10.112.139.99 with SMTP id qx3mr38500928lbb.44.1427945733442; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id mp6si3154724lbb.4.2015.04.01.20.35.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 20:35:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lboc7 with SMTP id c7so50376079lbo.1 for ; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr30796608lbh.56.1427945733307; Wed, 01 Apr 2015 20:35:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1063376lbq; Wed, 1 Apr 2015 20:35:32 -0700 (PDT) X-Received: by 10.68.239.104 with SMTP id vr8mr82860165pbc.96.1427945703403; Wed, 01 Apr 2015 20:35:03 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com. [209.85.192.178]) by mx.google.com with ESMTPS id d5si5524819pdg.220.2015.04.01.20.35.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 20:35:03 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.178 as permitted sender) client-ip=209.85.192.178; Received: by pdea3 with SMTP id a3so24276109pde.3 for ; Wed, 01 Apr 2015 20:35:02 -0700 (PDT) X-Received: by 10.70.65.39 with SMTP id u7mr83518346pds.11.1427945702510; Wed, 01 Apr 2015 20:35:02 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id da10sm3572603pac.42.2015.04.01.20.35.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Apr 2015 20:35:01 -0700 (PDT) From: John Stultz To: lkml Cc: Xunlei Pang , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , John Stultz Subject: [PATCH 13/21] rtc/mxc: Update driver to address y2038/y2106 issues Date: Wed, 1 Apr 2015 20:34:33 -0700 Message-Id: <1427945681-29972-14-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427945681-29972-1-git-send-email-john.stultz@linaro.org> References: <1427945681-29972-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Xunlei Pang This driver has a number of y2038/y2106 issues. This patch resolves them by: - Replace rtc_time_to_tm() with rtc_time64_to_tm() - Replace rtc_tm_to_time() with rtc_tm_to_time64() - Change mxc_rtc_set_mmss() to use rtc_class_ops's set_mmss64() After this patch, the driver should not have any remaining y2038/y2106 issues. Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Acked-by: Alessandro Zummo Signed-off-by: Xunlei Pang Signed-off-by: John Stultz --- drivers/rtc/rtc-mxc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 83cba23..09d422b 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c @@ -286,7 +286,7 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm) /* * This function sets the internal RTC time based on tm in Gregorian date. */ -static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) +static int mxc_rtc_set_mmss(struct device *dev, time64_t time) { struct platform_device *pdev = to_platform_device(dev); struct rtc_plat_data *pdata = platform_get_drvdata(pdev); @@ -297,9 +297,9 @@ static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) if (is_imx1_rtc(pdata)) { struct rtc_time tm; - rtc_time_to_tm(time, &tm); + rtc_time64_to_tm(time, &tm); tm.tm_year = 70; - rtc_tm_to_time(&tm, &time); + time = rtc_tm_to_time64(&tm); } /* Avoid roll-over from reading the different registers */ @@ -347,7 +347,7 @@ static int mxc_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) static struct rtc_class_ops mxc_rtc_ops = { .release = mxc_rtc_release, .read_time = mxc_rtc_read_time, - .set_mmss = mxc_rtc_set_mmss, + .set_mmss64 = mxc_rtc_set_mmss, .read_alarm = mxc_rtc_read_alarm, .set_alarm = mxc_rtc_set_alarm, .alarm_irq_enable = mxc_rtc_alarm_irq_enable,