From patchwork Thu Apr 2 03:34:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46684 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D96E4216D1 for ; Thu, 2 Apr 2015 03:35:19 +0000 (UTC) Received: by wibgr10 with SMTP id gr10sf15746357wib.2 for ; Wed, 01 Apr 2015 20:35:19 -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=Ed+pYWEDm9aZvb3iOA3PUectLGXmure9JrwS5TB7pzM=; b=MbZRftUEuFG52p3xQz3mtvQ1CuhZSApoBZD6f1lwYx5MG3ddC7+RGPgBGdJ5XEL1Cm Bts2xZJ465roiag4zrxHi9B7UKsObQLvw15xXK4Lg3me7Uu/NdqFIJEtzpIUu2i+7rZc tupwHawiv+3ihUbLqgQSu17CkbZo8Nd4LBSUjaTA1LOocTsXQoYiPF3ZHwbdFIm9GHBY SWpoSxYWcGoYMuoLG7e+9JErxrQjIY3fDW33i+qe38Knn2AMu/8BsfSS7fd1tXLvPfWY +zwmcikAB2+u7lxEZOzx3l8KiVVA23dX2gJVsyinBrxpcPV45LgyAqeePro9BWAqt1oM 9H8A== X-Gm-Message-State: ALoCoQl4stVTOr+3IuPelYcY7RqP1fbyW4yYv/BM7lLzi4gb4vLDxz8JDpFa7GDuSIOlUPkfXRQA X-Received: by 10.112.130.71 with SMTP id oc7mr6146710lbb.13.1427945719203; Wed, 01 Apr 2015 20:35:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.5.2 with SMTP id ci2ls142782lad.38.gmail; Wed, 01 Apr 2015 20:35:19 -0700 (PDT) X-Received: by 10.112.17.8 with SMTP id k8mr38496272lbd.26.1427945719062; Wed, 01 Apr 2015 20:35:19 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com. [209.85.217.175]) by mx.google.com with ESMTPS id aq10si3138185lbc.58.2015.04.01.20.35.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 20:35:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by lbbug6 with SMTP id ug6so50490072lbb.3 for ; Wed, 01 Apr 2015 20:35:19 -0700 (PDT) X-Received: by 10.152.197.34 with SMTP id ir2mr12037650lac.36.1427945718935; Wed, 01 Apr 2015 20:35:18 -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 k9csp1063266lbq; Wed, 1 Apr 2015 20:35:17 -0700 (PDT) X-Received: by 10.70.102.8 with SMTP id fk8mr81895548pdb.141.1427945697853; Wed, 01 Apr 2015 20:34:57 -0700 (PDT) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com. [209.85.192.181]) by mx.google.com with ESMTPS id ro6si5519401pab.194.2015.04.01.20.34.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Apr 2015 20:34:57 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.181 as permitted sender) client-ip=209.85.192.181; Received: by pdea3 with SMTP id a3so24273969pde.3 for ; Wed, 01 Apr 2015 20:34:56 -0700 (PDT) X-Received: by 10.69.0.106 with SMTP id ax10mr83414311pbd.11.1427945696484; Wed, 01 Apr 2015 20:34:56 -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.34.55 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Apr 2015 20:34:55 -0700 (PDT) From: John Stultz To: lkml Cc: Xunlei Pang , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , John Stultz Subject: [PATCH 08/21] rtc/test: Update driver to address y2038/y2106 issues Date: Wed, 1 Apr 2015 20:34:28 -0700 Message-Id: <1427945681-29972-9-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.175 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: - 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. 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-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)) {