mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] isl29020: ambient light sensor
Date: Fri, 22 Oct 2010 21:01:32 +0100	[thread overview]
Message-ID: <20101022210132.72389768@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20101022125130.064710ba.akpm@linux-foundation.org>

On Fri, 22 Oct 2010 12:51:30 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 22 Oct 2010 13:46:07 +0100
> Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> 
> > From: Kalhan Trisal <kalhan.trisal@intel.com>
> > 
> > The LS driver will read the latest Lux measurement based upon the
> > light brightness and will report the LUX output through sysfs interface.
> > 
> > This hardware isn't quite the same as the ISL29003 so has a different driver.
> > 
> >
> > ...
> >
> > +static ssize_t als_lux_input_data_show(struct device *dev,
> > +			struct device_attribute *attr, char *buf)
> > +{
> > +	struct i2c_client *client = to_i2c_client(dev);
> > +	int ret_val, val;
> > +	unsigned long int lux;
> > +	int temp;
> > +
> > +	pm_runtime_get_sync(dev);
> > +	msleep(100);
> 
> The msleep() is a bit mysterious.  And long!  A little code comment
> explaining why it's here would illuminate things (heh, I kill me).

It takes that long to get a sensible answer from the device after you
power it up and sysfs doesn't keep enough context around to do poll etc.

It may be possible to shorten it if we've not been suspended but there
isn't a sane way I've found to track last suspended time nicely and race
free in the runtime_pm layer.

> Could/should we make the PM code disappear if !CONFIG_PM?  Such as

Looks sensible. Will add to it.

Alan

      reply	other threads:[~2010-10-22 20:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 12:46 Alan Cox
2010-10-22 19:51 ` Andrew Morton
2010-10-22 20:01   ` Alan Cox [this message]

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=20101022210132.72389768@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®