lkml.org 
[lkml]   [2015]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 6/9] rtc-pcf2123: avoid resetting the clock if possible
On Wed, 25 Nov 2015 00:25:12 +0100
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> On 04/11/2015 at 07:36:37 -0800, Joshua Clayton wrote :
> > + ret = pcf2123_rtc_read_time(dev, &tm);
> > + if (ret < 0)
> > + return false;
> > +
> > + if (rtc_valid_tm(&tm) < 0) {
> > + dev_err(dev, "retrieved date/time is not
> > valid.\n");
> > + return false;
> > + }
> > +
>
> I would remove that test as basically, the date/time will only be
> valid when OSC_HAS_STOPPED is not set.
>
OSC_HAS_STOPPED really only protects us in case everything else
looks good, but we've lost power.
There are other reasons to check for a valid time.
Specifically, if there is no communication with the device, the spi
operation will succeed and return all zeros or all ones.
Since either of these results in an invalid time, it is a nice way
to probe whether we really have a pcf2123 compatible device.

I don't think I should remove this test, but I can add a comment


\
 
 \ /
  Last update: 2015-12-01 21:41    [W:0.146 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site