From patchwork Fri Jan 16 15:40:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "pang.xunlei" X-Patchwork-Id: 43250 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f197.google.com (mail-we0-f197.google.com [74.125.82.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5362E240D8 for ; Fri, 16 Jan 2015 15:40:35 +0000 (UTC) Received: by mail-we0-f197.google.com with SMTP id w61sf11476740wes.0 for ; Fri, 16 Jan 2015 07:40:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mime-version:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=IiiiVS+Hn/ONnu0K9TykRu4FzZyiyJHWQ9rSFJ8KoFU=; b=nJp3Aqi+K9o23j0oSOSRUvkPha7UXALSA0lZqx/K+JcIjsyIi5R9oAKh34vUrVzD5o atqzbCvxRi7aHzfDwUHt8WdNv4t4KzZG0caKKuKfnrlHjF5DttwjPkd0te4gwZbvclI4 H4XQPjeLVXg2WNw3nTwMwVw/dVy7myJ4bIKhVBZ9kfoJ/wDqJIqHS/CuN81gK5UHowYV BuA0nt1UbQb+o30yeyjIBGCZe435OMHYmHjG8Diq/E8pT2CTfbI/+08TVaDs9pujp5TY bYgNmSQxK2i8Y6S5J/pCpEvhUmd4mFzJH9YhA4HmKYPAjIoDyQ5LAv1d7DwMYsM/uDfa lhJw== X-Gm-Message-State: ALoCoQnsmIvdlMWGegU4k0iKJ8RG+3mbykxF1hoIAWxVtSVnhx1pE3geenXGfrGa5VaQ5XAUsJam X-Received: by 10.180.74.140 with SMTP id t12mr527158wiv.2.1421422834576; Fri, 16 Jan 2015 07:40:34 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.39 with SMTP id s7ls408610lae.20.gmail; Fri, 16 Jan 2015 07:40:34 -0800 (PST) X-Received: by 10.112.150.102 with SMTP id uh6mr16080356lbb.66.1421422834383; Fri, 16 Jan 2015 07:40:34 -0800 (PST) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id zp10si3283792lbb.104.2015.01.16.07.40.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 16 Jan 2015 07:40:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by mail-lb0-f182.google.com with SMTP id u10so18966490lbd.13 for ; Fri, 16 Jan 2015 07:40:34 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr16056291lbc.23.1421422833967; Fri, 16 Jan 2015 07:40:33 -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 c8csp348628lbb; Fri, 16 Jan 2015 07:40:32 -0800 (PST) X-Received: by 10.68.224.101 with SMTP id rb5mr23471829pbc.67.1421422831844; Fri, 16 Jan 2015 07:40:31 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si5730677pdf.254.2015.01.16.07.40.30; Fri, 16 Jan 2015 07:40:31 -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 S1755878AbbAPPk3 (ORCPT + 28 others); Fri, 16 Jan 2015 10:40:29 -0500 Received: from mail-yh0-f49.google.com ([209.85.213.49]:52238 "EHLO mail-yh0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751810AbbAPPk1 (ORCPT ); Fri, 16 Jan 2015 10:40:27 -0500 Received: by mail-yh0-f49.google.com with SMTP id f10so10420969yha.8 for ; Fri, 16 Jan 2015 07:40:26 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.236.96.196 with SMTP id r44mr9905641yhf.187.1421422826301; Fri, 16 Jan 2015 07:40:26 -0800 (PST) Received: by 10.170.191.77 with HTTP; Fri, 16 Jan 2015 07:40:26 -0800 (PST) In-Reply-To: <20150114163905.1c0cf7d1@linux.lan.towertech.it> References: <1421163897-8020-1-git-send-email-xlpang@126.com> <1421163897-8020-4-git-send-email-xlpang@126.com> <20150113171904.6b2327d5@linux.lan.towertech.it> <20150114160308.08a7f45b@linux.lan.towertech.it> <20150114163905.1c0cf7d1@linux.lan.towertech.it> Date: Fri, 16 Jan 2015 23:40:26 +0800 Message-ID: Subject: Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues From: Xunlei Pang To: Alessandro Zummo Cc: Xunlei Pang , lkml , John Stultz , Arnd Bergmann , "rtc-linux@googlegroups.com" , Thomas Gleixner 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.182 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: , On 14 January 2015 at 23:39, Alessandro Zummo wrote: > On Wed, 14 Jan 2015 23:26:37 +0800 > Xunlei Pang wrote: > >> But on the other hand, we will have no test for set_mmss64(), >> because adding the set_mmss64() will make set_mmss() dysfunctional. > > add a module parameter Hi Alessandro, Thanks for your advice, how about the following one? --- drivers/rtc/rtc-test.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) .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)) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ 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,