From patchwork Tue Jan 20 16:21:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43411 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A3CF92034D for ; Tue, 20 Jan 2015 16:23:26 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf7726194wiv.0 for ; Tue, 20 Jan 2015 08:23:25 -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=qm2U+1JipJAHTI1hUt8iyEuWFFTbNfA10jG9lHTynm0=; b=ey7Bv3F8gciN258IQ+HIkMT3SARR7efNnm+A7eNYlNKw+Ev+g0WIjsPqJrd185+BNb X3prDmEopZ7VtRKHnQHx+NVoYtf+ePGk8FlNmAiEKbMBxoL1tjvVr0vw2iKmRubzlLnV FnCq1EtXbO0xL7xcJQGl9P0/kNFDk4rcvnxGdmuY8TAsDss63FpMQE37KSIdHEbUWwWf OxUHQaJXiAxFOwXUMK/IG491W7gAk4ufNrB0F4Oydi03I8VJaZT3Buq5jFagbx5LKG0q CNvUVu/wKf/sFvvWM9TVgMx/iQA6UVBdZeYlXd7fVt1u2zAaInbW7RMVR7l441M96hwh +V5A== X-Gm-Message-State: ALoCoQmLdB3WUm80EMdKelFFsEEnTKU6LBR/If0Pgo1DklG3d0vaA+0xtRtfQblGAQ/UxcAbNXPN X-Received: by 10.152.115.241 with SMTP id jr17mr1619247lab.0.1421771005840; Tue, 20 Jan 2015 08:23:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.4.72 with SMTP id i8ls189296lai.1.gmail; Tue, 20 Jan 2015 08:23:25 -0800 (PST) X-Received: by 10.113.11.12 with SMTP id ee12mr39139307lbd.79.1421771005670; Tue, 20 Jan 2015 08:23:25 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id ld9si15621599lbc.77.2015.01.20.08.23.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id b6so8902215lbj.11 for ; Tue, 20 Jan 2015 08:23:25 -0800 (PST) X-Received: by 10.112.131.1 with SMTP id oi1mr38753848lbb.2.1421771005541; Tue, 20 Jan 2015 08:23:25 -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 c8csp1473364lbb; Tue, 20 Jan 2015 08:23:24 -0800 (PST) X-Received: by 10.70.130.9 with SMTP id oa9mr6481172pdb.53.1421771003644; Tue, 20 Jan 2015 08:23:23 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k2si585212pdf.109.2015.01.20.08.23.22; Tue, 20 Jan 2015 08:23:23 -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 S1753451AbbATQWV (ORCPT + 28 others); Tue, 20 Jan 2015 11:22:21 -0500 Received: from mail-qa0-f44.google.com ([209.85.216.44]:50496 "EHLO mail-qa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752908AbbATQWT (ORCPT ); Tue, 20 Jan 2015 11:22:19 -0500 Received: by mail-qa0-f44.google.com with SMTP id w8so28953617qac.3 for ; Tue, 20 Jan 2015 08:22:19 -0800 (PST) X-Received: by 10.140.48.197 with SMTP id o63mr56224111qga.81.1421770938958; Tue, 20 Jan 2015 08:22:18 -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.18 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 20 Jan 2015 08:22:18 -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 2/8] rtc/test: Update driver to address y2038/y2106 issues Date: Tue, 20 Jan 2015 16:21:33 +0000 Message-Id: <1421770899-4136-3-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.180 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: - Repalce get_seconds() with ktime_get_real_seconds() - Replace rtc_time_to_tm() with rtc_time64_to_tm() Also add test_rtc_set_mmss64() for testing rtc_class_ops's set_mmss64(), which can be activated by "test_mmss64" module parameter. Signed-off-by: Xunlei Pang --- drivers/rtc/rtc-test.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 8f86fa9..3a2da4c 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c @@ -13,6 +13,10 @@ #include #include +static int test_mmss64; +module_param(test_mmss64, int, 0644); +MODULE_PARM_DESC(test_mmss64, "Test struct rtc_class_ops.set_mmss64()."); + static struct platform_device *test0 = NULL, *test1 = NULL; static int test_rtc_read_alarm(struct device *dev, @@ -30,7 +34,13 @@ static int test_rtc_set_alarm(struct device *dev, static int test_rtc_read_time(struct device *dev, struct rtc_time *tm) { - rtc_time_to_tm(get_seconds(), tm); + rtc_time64_to_tm(ktime_get_real_seconds(), tm); + return 0; +} + +static int test_rtc_set_mmss64(struct device *dev, time64_t secs) +{ + dev_info(dev, "%s, secs = %lld\n", __func__, (long long)secs); return 0; } @@ -55,7 +65,7 @@ static int test_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) return 0; } -static const struct rtc_class_ops test_rtc_ops = { +static struct rtc_class_ops test_rtc_ops = { .proc = test_rtc_proc, .read_time = test_rtc_read_time, .read_alarm = test_rtc_read_alarm, @@ -101,6 +111,11 @@ static int test_probe(struct platform_device *plat_dev) int err; struct rtc_device *rtc; + if (test_mmss64) { + test_rtc_ops.set_mmss64 = test_rtc_set_mmss64; + test_rtc_ops.set_mmss = NULL; + } + rtc = devm_rtc_device_register(&plat_dev->dev, "test", &test_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) {