* [PATCH] rtc: rtc-s3c: Fix failed first read of RTC time
@ 2015-04-02 11:00 Krzysztof Kozlowski
2015-04-02 23:58 ` Chanwoo Choi
0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Kozlowski @ 2015-04-02 11:00 UTC (permalink / raw)
To: Alessandro Zummo, rtc-linux, linux-kernel, linux-samsung-soc,
Alexandre Belloni
Cc: Marek Szyprowski, Krzysztof Kozlowski
Initialize the device time (if it is wrong) before registering RTC
device to fix following error message during rtc-s3c probe:
[ 2.215414] rtc (null): read_time: fail to read
[ 2.216322] s3c-rtc 10070000.rtc: rtc core: registered s3c as rtc1
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/rtc/rtc-s3c.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 5e162eaad277..1d3a4c58fec4 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -496,6 +496,22 @@ static int s3c_rtc_probe(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 1);
+ /* Check RTC Time */
+ s3c_rtc_gettime(&pdev->dev, &rtc_tm);
+
+ if (rtc_valid_tm(&rtc_tm)) {
+ rtc_tm.tm_year = 100;
+ rtc_tm.tm_mon = 0;
+ rtc_tm.tm_mday = 1;
+ rtc_tm.tm_hour = 0;
+ rtc_tm.tm_min = 0;
+ rtc_tm.tm_sec = 0;
+
+ s3c_rtc_settime(&pdev->dev, &rtc_tm);
+
+ dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
+ }
+
/* register RTC and exit */
info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops,
THIS_MODULE);
@@ -519,22 +535,6 @@ static int s3c_rtc_probe(struct platform_device *pdev)
goto err_nortc;
}
- /* Check RTC Time */
- s3c_rtc_gettime(&pdev->dev, &rtc_tm);
-
- if (rtc_valid_tm(&rtc_tm)) {
- rtc_tm.tm_year = 100;
- rtc_tm.tm_mon = 0;
- rtc_tm.tm_mday = 1;
- rtc_tm.tm_hour = 0;
- rtc_tm.tm_min = 0;
- rtc_tm.tm_sec = 0;
-
- s3c_rtc_settime(&pdev->dev, &rtc_tm);
-
- dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
- }
-
if (info->data->select_tick_clk)
info->data->select_tick_clk(info);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: rtc-s3c: Fix failed first read of RTC time
2015-04-02 11:00 [PATCH] rtc: rtc-s3c: Fix failed first read of RTC time Krzysztof Kozlowski
@ 2015-04-02 23:58 ` Chanwoo Choi
0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2015-04-02 23:58 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Alessandro Zummo, rtc-linux, linux-kernel, linux-samsung-soc,
Alexandre Belloni, Marek Szyprowski
On 04/02/2015 08:00 PM, Krzysztof Kozlowski wrote:
> Initialize the device time (if it is wrong) before registering RTC
> device to fix following error message during rtc-s3c probe:
>
> [ 2.215414] rtc (null): read_time: fail to read
> [ 2.216322] s3c-rtc 10070000.rtc: rtc core: registered s3c as rtc1
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
> drivers/rtc/rtc-s3c.c | 32 ++++++++++++++++----------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
> index 5e162eaad277..1d3a4c58fec4 100644
> --- a/drivers/rtc/rtc-s3c.c
> +++ b/drivers/rtc/rtc-s3c.c
> @@ -496,6 +496,22 @@ static int s3c_rtc_probe(struct platform_device *pdev)
>
> device_init_wakeup(&pdev->dev, 1);
>
> + /* Check RTC Time */
> + s3c_rtc_gettime(&pdev->dev, &rtc_tm);
> +
> + if (rtc_valid_tm(&rtc_tm)) {
> + rtc_tm.tm_year = 100;
> + rtc_tm.tm_mon = 0;
> + rtc_tm.tm_mday = 1;
> + rtc_tm.tm_hour = 0;
> + rtc_tm.tm_min = 0;
> + rtc_tm.tm_sec = 0;
> +
> + s3c_rtc_settime(&pdev->dev, &rtc_tm);
> +
> + dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
> + }
> +
> /* register RTC and exit */
> info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops,
> THIS_MODULE);
> @@ -519,22 +535,6 @@ static int s3c_rtc_probe(struct platform_device *pdev)
> goto err_nortc;
> }
>
> - /* Check RTC Time */
> - s3c_rtc_gettime(&pdev->dev, &rtc_tm);
> -
> - if (rtc_valid_tm(&rtc_tm)) {
> - rtc_tm.tm_year = 100;
> - rtc_tm.tm_mon = 0;
> - rtc_tm.tm_mday = 1;
> - rtc_tm.tm_hour = 0;
> - rtc_tm.tm_min = 0;
> - rtc_tm.tm_sec = 0;
> -
> - s3c_rtc_settime(&pdev->dev, &rtc_tm);
> -
> - dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
> - }
> -
> if (info->data->select_tick_clk)
> info->data->select_tick_clk(info);
>
>
When registering RTC device by using devm_rtc_device_register(),
rtc_device_register() read the time as following. Looks good to me.
devm_rtc_device_register()
rtc_device_register()
__rtc_read_alarm()
rtc_read_time()
__rtc_read_time()
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Thanks,
Chanwoo Choi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-02 23:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02 11:00 [PATCH] rtc: rtc-s3c: Fix failed first read of RTC time Krzysztof Kozlowski
2015-04-02 23:58 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).