From: Andrew Morton <akpm@linux-foundation.org>
To: Doug Anderson <dianders@chromium.org>
Cc: "Chris Zhong" <zyw@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Rob Herring" <robh+dt@kernel.org>,
"Pawel Moll" <pawel.moll@arm.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
"Kumar Gala" <galak@codeaurora.org>,
"Samuel Ortiz" <sameo@linux.intel.com>,
"Lee Jones" <lee.jones@linaro.org>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Alessandro Zummo" <a.zummo@towertech.it>,
"Mike Turquette" <mturquette@linaro.org>,
"broonie@kernel.org" <broonie@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
rtc-linux@googlegroups.com,
"Grant Likely" <grant.likely@linaro.org>,
"Lin Huang" <hl@rock-chips.com>,
"Tao Huang" <huangtao@rock-chips.com>,
"Eddie Cai" <cf@rock-chips.com>,
zhangqing <zhangqing@rock-chips.com>, xxx <xxx@rock-chips.com>,
"Olof Johansson" <olof@lixom.net>,
"Sonny Rao" <sonnyrao@chromium.org>,
"Dmitry Torokhov" <dtor@chromium.org>,
"Javier Martinez Canillas" <javier.martinez@collabora.co.uk>,
"Kever Yang" <kever.yang@rock-chips.com>
Subject: Re: [PATCH v10 1/3] RTC: RK808: add RTC driver for RK808
Date: Wed, 10 Sep 2014 15:08:43 -0700 [thread overview]
Message-ID: <20140910150843.78d9416ae0dada8fccf8063a@linux-foundation.org> (raw)
In-Reply-To: <CAD=FV=V4-dHpKwRqewCr7ujDdRYiMiUcRuJAS7C602EyCMnPFQ@mail.gmail.com>
On Wed, 10 Sep 2014 14:37:13 -0700 Doug Anderson <dianders@chromium.org> wrote:
> Andrew,
>
> On Wed, Sep 10, 2014 at 1:44 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
> > On Wed, 10 Sep 2014 09:18:04 +0800 Chris Zhong <zyw@rock-chips.com> 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?
>
> When you say "give up", what does that mean? I assume the driver
> should keep initting, right? Then the user can go in and set a time
> later...
I think I was misreading current drivers a bit. rtc-cmos.c will go in
and set a dummy time but regular low-level drivers don't sanity-check
the time at all at setup time.
>
> I did test things with just removing this chunk of code. You get some
> yells at bootup if you put a bogus time in there:
>
> [ 2.987590] rk808-rtc rk808-rtc: invalid date/time and init time
> [ 3.013148] rk808-rtc rk808-rtc: rtc core: registered rk808-rtc as rtc0
> [ 4.586115] rk808-rtc rk808-rtc: hctosys: invalid date/time
>
> ...but if you later set a valid time then everything is fine. That
> seems reasonable behavior to me, so I guess we could just remove this
> whole chunk? It appears that after a normal bootup the date/time is
> something valid.
hm. Having an invalid time is perhaps better than having a valid but
incorrect time.
When one sees one driver doing something differently from the others
one has to wonder "why" and "which one is better". If setting a dummy
time is better then all drivers should do it, and I expect this could
be done by rtc core at registration time.
next prev parent reply other threads:[~2014-09-10 22:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-10 1:18 [PATCH v10 0/3] Add rockchip RK808 pmic driver Chris Zhong
2014-09-10 1:18 ` [PATCH v10 1/3] RTC: RK808: add RTC driver for RK808 Chris Zhong
2014-09-10 20:44 ` Andrew Morton
2014-09-10 21:37 ` Doug Anderson
2014-09-10 22:08 ` Andrew Morton [this message]
2014-09-11 0:10 ` Doug Anderson
2014-09-10 1:18 ` [PATCH v10 2/3] clk: RK808: Add clkout " Chris Zhong
2014-09-10 1:18 ` [PATCH v10 3/3] regulator: RK808: Remove pdata from the regulator Chris Zhong
2014-09-10 2:49 ` Doug Anderson
2014-09-10 10:51 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140910150843.78d9416ae0dada8fccf8063a@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=broonie@kernel.org \
--cc=cf@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dtor@chromium.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=heiko@sntech.de \
--cc=hl@rock-chips.com \
--cc=huangtao@rock-chips.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=javier.martinez@collabora.co.uk \
--cc=kever.yang@rock-chips.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@linaro.org \
--cc=olof@lixom.net \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@linux.intel.com \
--cc=sonnyrao@chromium.org \
--cc=xxx@rock-chips.com \
--cc=zhangqing@rock-chips.com \
--cc=zyw@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®