RTC: RK808: remove tm_def structure
PATCH 1/1 RTC: RK808: remove tm_def structure
Signed-off-by Chris Zhong <[email protected]>
---
drivers/rtc/rtc-rk808.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-)
drivers/rtc/rtc-rk808.c +2 -15
@@ -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 );
Signature · 1 line
1.7.9.5
Chris,
Quoted 1 line · Chris Zhong
Signed-off-by Chris Zhong <[email protected]>
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.
Quoted 4 lines
---
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 <[email protected]>
Tested-by Doug Anderson <[email protected]>