public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joshua Clayton <stillcompiling@gmail.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/9] rtc-pcf2123: avoid resetting the clock if possible
Date: Tue, 1 Dec 2015 12:23:51 -0800	[thread overview]
Message-ID: <20151201122351.27e3f542@jclayton-pc> (raw)
In-Reply-To: <20151124232512.GG3950@piout.net>

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

  reply	other threads:[~2015-12-01 20:23 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04 15:36 [PATCH 0/9] rtc-2123: access the clock offset feature Joshua Clayton
2015-11-04 15:36 ` [PATCH 1/9] rtc-pcf2123: Document all registers and useful bits Joshua Clayton
2015-11-24 21:51   ` Alexandre Belloni
2015-12-01 18:13     ` Joshua Clayton
2015-11-04 15:36 ` [PATCH 2/9] rtc-pcf2123: clean up reads from the chip Joshua Clayton
2015-11-04 15:36 ` [PATCH 3/9] rtc-pcf2123: clean up writes to the rtc chip Joshua Clayton
2015-11-24 22:16   ` Alexandre Belloni
2015-12-01 18:19     ` Joshua Clayton
2015-11-04 15:36 ` [PATCH 4/9] rtc-pcf2123: replace magic numbers with defines Joshua Clayton
2015-11-04 15:36 ` [PATCH 5/9] rtc-pcf2123: put the chip reset into a function Joshua Clayton
2015-11-24 23:17   ` Alexandre Belloni
2015-12-01 18:22     ` Joshua Clayton
2015-11-04 15:36 ` [PATCH 6/9] rtc-pcf2123: avoid resetting the clock if possible Joshua Clayton
2015-11-24 23:25   ` Alexandre Belloni
2015-12-01 20:23     ` Joshua Clayton [this message]
2015-12-01 21:04       ` Alexandre Belloni
2015-11-04 15:36 ` [PATCH 7/9] rtc-pcf2123: allow sysfs to accept hexidecimal Joshua Clayton
2015-11-04 15:36 ` [PATCH 8/9] rtc-pcf2123: use sysfs groups Joshua Clayton
2015-11-18 23:52   ` Joshua Clayton
2015-11-24 23:31   ` Alexandre Belloni
2015-12-01 20:28     ` Joshua Clayton
2015-12-01 20:47       ` Alexandre Belloni
2015-11-04 15:36 ` [PATCH 9/9] rtc-pcf2123: adjust the clock rate via sysfs Joshua Clayton
2015-11-18 23:51   ` Joshua Clayton
2015-11-17 15:30 ` [PATCH 0/9] rtc-2123: access the clock offset feature Joshua Clayton
2015-11-17 16:25   ` Alexandre Belloni
2015-11-19  0:25     ` Joshua Clayton

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=20151201122351.27e3f542@jclayton-pc \
    --to=stillcompiling@gmail.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.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