Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
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(-) 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(_dev->dev, "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 majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On 14 January 2015 at 23:39, Alessandro Zummo a.zu...@towertech.it wrote: On Wed, 14 Jan 2015 23:26:37 +0800 Xunlei Pang pang.xun...@linaro.org 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(-) 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 linux/rtc.h #include linux/platform_device.h +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)) { -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
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 -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On 14 January 2015 at 23:03, Alessandro Zummo wrote: > On Wed, 14 Jan 2015 22:56:15 +0800 > Xunlei Pang wrote: > >> We want to do away with set_mmss() eventually, time64 is the final version, >> so I think this would be ok. > > We'll get rid of set_mmss() from the test driver later on, > after everything else has been converted :) Ok. But on the other hand, we will have no test for set_mmss64(), because adding the set_mmss64() will make set_mmss() dysfunctional. Thanks, Xunlei > > -- > > Best regards, > > Alessandro Zummo, > Tower Technologies - Torino, Italy > > http://www.towertech.it > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On Wed, 14 Jan 2015 22:56:15 +0800 Xunlei Pang wrote: > We want to do away with set_mmss() eventually, time64 is the final version, > so I think this would be ok. We'll get rid of set_mmss() from the test driver later on, after everything else has been converted :) -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On 14 January 2015 at 00:19, Alessandro Zummo wrote: > On Tue, 13 Jan 2015 23:44:51 +0800 > Xunlei Pang wrote: > >> This patch resolves them by: >> - Repalce get_seconds() with get_seconds64() >> - Replace rtc_time_to_tm() with rtc_time64_to_tm() >> - Change test_rtc_set_mmss() to use rtc_class_ops's set_mmss64() > > so we no more have a non time64 test driver?| Hi Alessandro, We want to do away with set_mmss() eventually, time64 is the final version, so I think this would be ok. Thanks, Xunlei > > -- > > Best regards, > > Alessandro Zummo, > Tower Technologies - Torino, Italy > > http://www.towertech.it > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On 14 January 2015 at 23:03, Alessandro Zummo a.zu...@towertech.it wrote: On Wed, 14 Jan 2015 22:56:15 +0800 Xunlei Pang pang.xun...@linaro.org wrote: We want to do away with set_mmss() eventually, time64 is the final version, so I think this would be ok. We'll get rid of set_mmss() from the test driver later on, after everything else has been converted :) Ok. But on the other hand, we will have no test for set_mmss64(), because adding the set_mmss64() will make set_mmss() dysfunctional. Thanks, Xunlei -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On Wed, 14 Jan 2015 22:56:15 +0800 Xunlei Pang pang.xun...@linaro.org wrote: We want to do away with set_mmss() eventually, time64 is the final version, so I think this would be ok. We'll get rid of set_mmss() from the test driver later on, after everything else has been converted :) -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On 14 January 2015 at 00:19, Alessandro Zummo a.zu...@towertech.it wrote: On Tue, 13 Jan 2015 23:44:51 +0800 Xunlei Pang xlp...@126.com wrote: This patch resolves them by: - Repalce get_seconds() with get_seconds64() - Replace rtc_time_to_tm() with rtc_time64_to_tm() - Change test_rtc_set_mmss() to use rtc_class_ops's set_mmss64() so we no more have a non time64 test driver?| Hi Alessandro, We want to do away with set_mmss() eventually, time64 is the final version, so I think this would be ok. Thanks, Xunlei -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On Wed, 14 Jan 2015 23:26:37 +0800 Xunlei Pang pang.xun...@linaro.org 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 -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On Tue, 13 Jan 2015 23:44:51 +0800 Xunlei Pang wrote: > This patch resolves them by: > - Repalce get_seconds() with get_seconds64() > - Replace rtc_time_to_tm() with rtc_time64_to_tm() > - Change test_rtc_set_mmss() to use rtc_class_ops's set_mmss64() so we no more have a non time64 test driver? -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues
On Tue, 13 Jan 2015 23:44:51 +0800 Xunlei Pang xlp...@126.com wrote: This patch resolves them by: - Repalce get_seconds() with get_seconds64() - Replace rtc_time_to_tm() with rtc_time64_to_tm() - Change test_rtc_set_mmss() to use rtc_class_ops's set_mmss64() so we no more have a non time64 test driver? -- Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/