From patchwork Tue Jan 13 15:44:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xunlei Pang X-Patchwork-Id: 43059 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AE8AE20DE8 for ; Tue, 13 Jan 2015 15:47:53 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id a1sf2100955wgh.3 for ; Tue, 13 Jan 2015 07:47:52 -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=IToGpnQfcowGD3KZTk1pyUIbvuRZ8YLp3ojtE+orf2M=; b=mH4hBSzb9EYgygNH3wU0kJ8p89zOMIQLc5IpOy0LWDFLpDJVxjTkp4J8qbSON0mMSr Uydu8n+OjaPxFmRQ/JP2gt+PjyBNC7slKWdfqQXWbIiBO5TA2jOlGvI+VbI4p6Si1B7m RZ1oZiWs4Icf2AWIA6aJFdxnPuei0fw/P0kQzuTnKeMS1xvIPjgJJEUPrCWALOR55L5s XJkQYZbV20vLD1e1GlU6NursxmGSDmIioQTSPy6KNACfSiuf+sn/cqKlubxoxa6786kW nTNllDSu8dOP0Z7Rmq0Zvvfx1SF8WODET2lujbPjkchzfQeMndVQIiJX3ch1bpHk8Elb muBA== X-Gm-Message-State: ALoCoQnslEi3zI/zudnUlkjL8neBmiBOwdrtifuMcm6H5pFVI8pD707xMDWbGiFpS/uitNnWSmi3 X-Received: by 10.152.37.193 with SMTP id a1mr2195136lak.3.1421164072860; Tue, 13 Jan 2015 07:47:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.3.170 with SMTP id d10ls10380lad.37.gmail; Tue, 13 Jan 2015 07:47:52 -0800 (PST) X-Received: by 10.152.87.46 with SMTP id u14mr42910862laz.36.1421164072672; Tue, 13 Jan 2015 07:47:52 -0800 (PST) Received: from mail-lb0-x22b.google.com (mail-lb0-x22b.google.com. [2a00:1450:4010:c04::22b]) by mx.google.com with ESMTPS id v4si3211475lav.88.2015.01.13.07.47.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 07:47:52 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) client-ip=2a00:1450:4010:c04::22b; Received: by mail-lb0-f171.google.com with SMTP id w7so3270370lbi.2 for ; Tue, 13 Jan 2015 07:47:52 -0800 (PST) X-Received: by 10.152.45.4 with SMTP id i4mr43208094lam.74.1421164072590; Tue, 13 Jan 2015 07:47:52 -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 c8csp1421272lbb; Tue, 13 Jan 2015 07:47:51 -0800 (PST) X-Received: by 10.68.196.99 with SMTP id il3mr52597049pbc.158.1421164070693; Tue, 13 Jan 2015 07:47:50 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id si4si27612305pab.20.2015.01.13.07.47.49; Tue, 13 Jan 2015 07:47:50 -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 S1753080AbbAMPrd (ORCPT + 27 others); Tue, 13 Jan 2015 10:47:33 -0500 Received: from m15-111.126.com ([220.181.15.111]:37351 "EHLO m15-111.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752840AbbAMPqj (ORCPT ); Tue, 13 Jan 2015 10:46:39 -0500 Received: from vptest-PC.zte.com.cn (unknown [182.149.91.53]) by smtp1 (Coremail) with SMTP id C8mowEAZEUVxPbVUBIRpDg--.692S11; Tue, 13 Jan 2015 23:45:01 +0800 (CST) From: Xunlei Pang To: linux-kernel@vger.kernel.org, John Stultz , Arnd Bergmann Cc: rtc-linux@googlegroups.com, Thomas Gleixner , Alessandro Zummo , Xunlei Pang Subject: [RFC PATCH v2 8/9] rtc/mxc: Update driver to address y2038/y2106 issues Date: Tue, 13 Jan 2015 23:44:56 +0800 Message-Id: <1421163897-8020-9-git-send-email-xlpang@126.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1421163897-8020-1-git-send-email-xlpang@126.com> References: <1421163897-8020-1-git-send-email-xlpang@126.com> X-CM-TRANSID: C8mowEAZEUVxPbVUBIRpDg--.692S11 X-Coremail-Antispam: 1Uf129KBjvJXoW7tr4UKw4UCr1ftF1rAr4fZrb_yoW8CFWrpF srCayDJFs7Kr9Ig3WkGF4kCF1fG3W0qrW8Kr15KanY9w1rXFykJFy8CrWUtry5Ja4kCa13 Ww15Cw1Yv3W5CaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jdNVgUUUUU= X-Originating-IP: [182.149.91.53] X-CM-SenderInfo: p0ost0bj6rjloofrz/1tbigQKAv1E0a1uClwAAs8 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: xlpang@126.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::22b as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=126.com 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: , 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. 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,