linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: bonbons@linux-vserver.org (Bruno Prémont)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC Patch 2/4] mfd: AXP20x: Add power supply sub-driver
Date: Mon, 3 Nov 2014 21:14:56 +0100	[thread overview]
Message-ID: <20141103211456.2eb13a6e@neptune.home> (raw)
In-Reply-To: <20141023201235.3b94cc82@smutje.local>

On Thu, 23 October 2014 Edgar Toernig <froese@gmx.de> wrote:
> > +	getnstimeofday(&ts);
> > +	/* only query hardware if our data is stale */
> > +	spin_lock(&devdata->lock);
> > +	if (!init && !(ts.tv_sec > devdata->next_check.tv_sec ||
> > +	               ts.tv_nsec > devdata->next_check.tv_sec)) {
> > +		spin_unlock(&devdata->lock);
> > +		return 0;
> > +	}
> > +	spin_unlock(&devdata->lock);
> 
> That time comparison is broken - it compares nsec with sec and
> doesn't check that secs are equal before comparing the nsecs.
> There's timespec_compare which gets it right.

Oops, yeah, going to switch to timespec_compare().
Thanks for spotting!

> Btw, you are aware that the timeofday is a user adjustable
> value?  If I ever turn back system time I won't get power
> data any more until the old (future) time is reached.

Huh, no, I didn't consider that.

> Wouldn't it be easier to simply use jiffies and limit the
> poll rate to one second or so?

I considered limiting to some arbitrary polling rate though think
it's better to give users the option to query values more often,
up to the rate at which the value are measured by AXP.
As the AXP's measurement rate is configurable (not exposed by
driver) it's better to base on that setting instead of having
to care at the time of exposing the configuration knob.

Thus jiffies seem to be a bit at their limit. Is using ktime better?


Bruno

  parent reply	other threads:[~2014-11-03 20:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141020215954.7f1d5502@neptune.home>
2014-10-20 20:33 ` [RFC Patch 1/4] mfd: AXP20x: Add power supply bindings documentation Bruno Prémont
2014-10-21 10:15   ` Lee Jones
2014-10-21 16:09     ` Bruno Prémont
2014-10-21 19:19       ` Maxime Ripard
2014-11-03 20:02         ` Bruno Prémont
2014-11-04 14:31           ` Maxime Ripard
2014-11-04 21:08             ` Bruno Prémont
2014-11-05 14:48               ` Maxime Ripard
2014-11-05 14:55                 ` [linux-sunxi] " Koen Kooi
     [not found]           ` <553e634f-ce75-4409-883c-acbfe773e950@googlegroups.com>
2014-11-04 21:21             ` Bruno Prémont
2014-10-21 20:10   ` Maxime Ripard
2014-10-20 20:33 ` [RFC Patch 2/4] mfd: AXP20x: Add power supply sub-driver Bruno Prémont
2014-10-21 20:27   ` Maxime Ripard
2014-10-22  6:30     ` Bruno Prémont
2014-10-23  9:29       ` Maxime Ripard
     [not found]   ` <20141023201235.3b94cc82@smutje.local>
2014-11-03 20:14     ` Bruno Prémont [this message]
2014-10-20 20:33 ` [RFC Patch 3/4] mfd: AXP20x: Add power supply defconfig entries Bruno Prémont
2014-10-20 20:33 ` [RFC Patch 4/4] mfd: AXP20x: Add backup battery DTS entry for Cubietruck Bruno Prémont
2014-10-20 20:19 [RFC Patch 0/4] mfd: AXP20x: Add power supply sub-driver Bruno Prémont

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=20141103211456.2eb13a6e@neptune.home \
    --to=bonbons@linux-vserver.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).