From patchwork Tue Jan 20 16:21:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43408 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6F2F02034D for ; Tue, 20 Jan 2015 16:22:50 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id pv20sf7012736lab.3 for ; Tue, 20 Jan 2015 08:22:49 -0800 (PST) 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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=FVQzVNPVTvdVTMSGRkV8Y8MUKeONf4tPk0y/usX/Ef8=; b=nB58LBZ6S0vyCmOeO+38z1WqPDpfQnFUSDMlYt3elCkclmaRWMEZtbReerMWWdUWdL dqQQw6Er2a4xeWlaCUARw6h3Tlz+NmRywK1r3grHTg/RxKN4P3kiSFGGr5jJ376rwQ9E XeW9JTl9IfWPY29ld5FdGsuN5st9dTixJniWbNz2y8TyiKjAZXEVrGi9dTp73XVIlnnO xJ6nBV3qmhIFKCuBj1SRKvLB3q35Ig/2I5Avv7VrBgyXVWf8EImu+/x/3LaiMbBUWyP7 oSG229nD8pg+i7KnXocQlr95BivnRvvJIze92xB6kRAC0e8Ej59P6YfMY2H97wVSMR/t cgVw== X-Gm-Message-State: ALoCoQkm+naoHRLXAUAc9cHOFZWVFvR2CaOC6hou+tDXy5nFvUKLusqMtD99lNf5f6GFlpSjwmYw X-Received: by 10.112.181.198 with SMTP id dy6mr605lbc.22.1421770969367; Tue, 20 Jan 2015 08:22:49 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.40 with SMTP id h8ls739950lah.12.gmail; Tue, 20 Jan 2015 08:22:49 -0800 (PST) X-Received: by 10.152.115.212 with SMTP id jq20mr19169682lab.36.1421770969180; Tue, 20 Jan 2015 08:22:49 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ny7si15549500lbb.135.2015.01.20.08.22.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:22:49 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id u10so3885135lbd.9 for ; Tue, 20 Jan 2015 08:22:49 -0800 (PST) X-Received: by 10.152.182.235 with SMTP id eh11mr21922772lac.9.1421770969108; Tue, 20 Jan 2015 08:22:49 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1473168lbb; Tue, 20 Jan 2015 08:22:48 -0800 (PST) X-Received: by 10.68.202.194 with SMTP id kk2mr54275733pbc.41.1421770966986; Tue, 20 Jan 2015 08:22:46 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ch3si4041286pbc.36.2015.01.20.08.22.46; Tue, 20 Jan 2015 08:22:46 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753759AbbATQWZ (ORCPT + 28 others); Tue, 20 Jan 2015 11:22:25 -0500 Received: from mail-qc0-f175.google.com ([209.85.216.175]:41967 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753521AbbATQWX (ORCPT ); Tue, 20 Jan 2015 11:22:23 -0500 Received: by mail-qc0-f175.google.com with SMTP id c9so9089157qcz.6 for ; Tue, 20 Jan 2015 08:22:22 -0800 (PST) X-Received: by 10.140.105.55 with SMTP id b52mr11615603qgf.1.1421770942635; Tue, 20 Jan 2015 08:22:22 -0800 (PST) Received: from ip-10-181-65-231.ec2.internal ([54.235.93.228]) by mx.google.com with ESMTPSA id o34sm15633515qge.29.2015.01.20.08.22.22 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:22:22 -0800 (PST) From: Xunlei Pang To: linux-kernel@vger.kernel.org Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , Richard Henderson , Uwe Kleine-Koenig , Linus Walleij , Fabio Estevam , John Stultz , Arnd Bergmann , Xunlei Pang Subject: [RFC PATCH v3 7/8] rtc/mxc: Update driver to address y2038/y2106 issues Date: Tue, 20 Jan 2015 16:21:38 +0000 Message-Id: <1421770899-4136-8-git-send-email-pang.xunlei@linaro.org> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421770899-4136-1-git-send-email-pang.xunlei@linaro.org> References: <1421770899-4136-1-git-send-email-pang.xunlei@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pang.xunlei@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.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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. Signed-off-by: Xunlei Pang --- 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,