Re: [PATCH v10 1/3] RTC: RK808: add RTC driver for RK808

From: Andrew Morton
Date: Wed Sep 10 2014 - 16:44:17 EST


On Wed, 10 Sep 2014 09:18:04 +0800 Chris Zhong <zyw@xxxxxxxxxxxxxx> wrote:

> Adding RTC driver for supporting RTC device present inside RK808 PMIC.
>
> ...
>
> + 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);
> + }

This is somewhat unusual. Most drivers will emit a warning and give up
when they find the time is wrong. Why is this driver different and is
this desirable behaviour?


Also, I did this:

From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Subject: rtc-rk808-add-rtc-driver-for-rk808-fix

make tm_def static

Cc: Chris Zhong <zyw@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

drivers/rtc/rtc-rk808.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff -puN drivers/rtc/Kconfig~rtc-rk808-add-rtc-driver-for-rk808-fix drivers/rtc/Kconfig
diff -puN drivers/rtc/Makefile~rtc-rk808-add-rtc-driver-for-rk808-fix drivers/rtc/Makefile
diff -puN drivers/rtc/rtc-rk808.c~rtc-rk808-add-rtc-driver-for-rk808-fix drivers/rtc/rtc-rk808.c
--- a/drivers/rtc/rtc-rk808.c~rtc-rk808-add-rtc-driver-for-rk808-fix
+++ a/drivers/rtc/rtc-rk808.c
@@ -326,14 +326,14 @@ static SIMPLE_DEV_PM_OPS(rk808_rtc_pm_op
rk808_rtc_suspend, rk808_rtc_resume);

/* 2014.1.1 12:00:00 Saturday */
-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 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)
_


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/