public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Eric Andersson <eric.andersson@unixphere.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhengguang.guo@bosch-sensortec.com, stefan.nilsson@unixphere.com,
	alan@lxorguk.ukuu.org.uk,
	Albert Zhang <xu.zhang@bosch-sensortec.com>
Subject: Re: [PATCH v5 1/1] input: add driver for Bosch Sensortec's BMA150 accelerometer
Date: Mon, 25 Jul 2011 18:51:21 -0700	[thread overview]
Message-ID: <20110726015121.GA2076@core.coreip.homeip.net> (raw)
In-Reply-To: <20110722094521.GB710@scully.xfiles.lan>

On Fri, Jul 22, 2011 at 11:45:21AM +0200, Eric Andersson wrote:
> Hi Dmitry,
> 
> Thanks for reviewing!
> 
> > > +static int bma150_open(struct bma150_data *bma150)
> > > +{
> > > +#ifdef CONFIG_PM_RUNTIME
> > > +	return pm_runtime_get_sync(&bma150->client->dev);
> > > +#else
> > > +	return bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
> > 
> > Hmm, this is kind of weird. I'd expect you want to try waking up the
> > parent in both cases (if no runtime pm then call to pm_runtime_get_sync
> > is basically a noop) and then wake up your device.
> 
> I am not sure what you mean? Are you suggesting something like:
> 	bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
> 	return pm_runtime_get_sync(&bma150->client->dev);
> 
> That would cause multiple bma150_set_mode() calls since
> pm_runtime_get_sync() will trigger one if needed.
> 

Right... It looks like instead of calling pm_runtime_get_sync() we need
to do something like this:

static int bma150_open(struct bma150_data *bma150)
{
	int error;

	error = pm_runtime_set_active(&bma150->client->dev);
	if (error)
		return error;

	return bma150_set_mode(bma150->client, BMA150_MODE_NORMAL);
}

and opposite in bma150_close().

Thanks.

-- 
Dmitry

      parent reply	other threads:[~2011-07-26  2:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-21 20:47 [PATCH v5 0/1] input: add driver for Bosch Sensortec's BMA150 accelerometer Eric Andersson
2011-07-21 20:47 ` [PATCH v5 1/1] " Eric Andersson
2011-07-22  5:16   ` Dmitry Torokhov
2011-07-22  9:45     ` Eric Andersson
2011-07-25 10:38       ` Eric Andersson
2011-07-26  1:51       ` Dmitry Torokhov [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=20110726015121.GA2076@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=eric.andersson@unixphere.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefan.nilsson@unixphere.com \
    --cc=xu.zhang@bosch-sensortec.com \
    --cc=zhengguang.guo@bosch-sensortec.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