* [PATCH] RTC: RK808: remove tm_def structure
@ 2014-09-11 2:04 Chris Zhong
2014-09-11 4:04 ` Doug Anderson
0 siblings, 1 reply; 2+ messages in thread
From: Chris Zhong @ 2014-09-11 2:04 UTC (permalink / raw)
To: akpm
Cc: zhangqing, xxx, dianders, heiko, Chris Zhong, Alessandro Zummo,
rtc-linux, linux-kernel
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
---
drivers/rtc/rtc-rk808.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/rtc/rtc-rk808.c b/drivers/rtc/rtc-rk808.c
index 22c8514..df42257 100644
--- a/drivers/rtc/rtc-rk808.c
+++ b/drivers/rtc/rtc-rk808.c
@@ -325,17 +325,6 @@ static int rk808_rtc_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(rk808_rtc_pm_ops,
rk808_rtc_suspend, rk808_rtc_resume);
-/* 2014.1.1 12:00:00 Saturday */
-static struct rtc_time tm_def = {
- .tm_wday = 6,
- .tm_year = 114,
- .tm_mon = 0,
- .tm_mday = 1,
- .tm_hour = 12,
- .tm_min = 0,
- .tm_sec = 0,
-};
-
static int rk808_rtc_probe(struct platform_device *pdev)
{
struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
@@ -376,10 +365,8 @@ static int rk808_rtc_probe(struct platform_device *pdev)
return ret;
}
ret = rtc_valid_tm(&tm);
- if (ret) {
- dev_warn(&pdev->dev, "invalid date/time and init time\n");
- rk808_rtc_set_time(&pdev->dev, &tm_def);
- }
+ if (ret)
+ dev_warn(&pdev->dev, "invalid date/time\n");
device_init_wakeup(&pdev->dev, 1);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RTC: RK808: remove tm_def structure
2014-09-11 2:04 [PATCH] RTC: RK808: remove tm_def structure Chris Zhong
@ 2014-09-11 4:04 ` Doug Anderson
0 siblings, 0 replies; 2+ messages in thread
From: Doug Anderson @ 2014-09-11 4:04 UTC (permalink / raw)
To: Chris Zhong
Cc: Andrew Morton, zhangqing, xxx, Heiko Stübner,
Alessandro Zummo, rtc-linux, linux-kernel
Chris,
On Wed, Sep 10, 2014 at 7:04 PM, Chris Zhong <zyw@rock-chips.com> wrote:
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
It's good to add a description, like:
If the date/time is invalid at bootup, there's no reason to set it to
a bogus value. We can just let the data and time be invalid until
someone makes it valid.
> ---
>
> drivers/rtc/rtc-rk808.c | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
Other than the lack of description, this looks great. It applies atop
Andrew's patch to make tm_dev "static" and works like a charm.
I tested by hacking the device with:
i2cset -f -y 0 0x1b 0x10 0xc1
i2cset -f -y 0 0x1b 3 0x32
i2cset -f -y 0 0x1b 0x10 0xc0
That made it think it was the 32nd day of the month. I then rebooted and saw:
[ 3.371853] rk808-rtc rk808-rtc: invalid date/time
[ 3.379115] rk808-rtc rk808-rtc: rtc core: registered rk808-rtc as rtc0
[ 5.411574] rk808-rtc rk808-rtc: hctosys: invalid date/time
I was still able to set the clock. Once I did it worked fine.
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-11 4:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 2:04 [PATCH] RTC: RK808: remove tm_def structure Chris Zhong
2014-09-11 4:04 ` Doug Anderson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.