linux-kernel.vger.kernel.org archive mirror
 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, jic23@cam.ac.uk,
	xu.zhang@bosch-sensortec.com
Subject: Re: [PATCH v6 1/1] input: add driver for Bosch Sensortec's BMA150 accelerometer
Date: Sun, 7 Aug 2011 22:15:04 -0700	[thread overview]
Message-ID: <20110808051504.GA7329@core.coreip.homeip.net> (raw)
In-Reply-To: <20110807162325.GA7280@skinner.xfiles.lan>

On Sun, Aug 07, 2011 at 06:23:25PM +0200, Eric Andersson wrote:
> > On Sun, Jul 31, 2011 at 12:49:17AM +0200, Dmitry Torokhov wrote:
> > > > > +static int bma150_open(struct bma150_data *bma150)
> > > > > +{
> > > > > + int ret;
> > > > > +
> > > > > + ret = pm_runtime_set_active(&bma150->client->dev);
> > > > > + if (ret < 0)
> > > > > +         return ret;
> > > > > +
> > > > > + pm_runtime_enable(&bma150->client->dev);
> > > >
> > > > I am pretty sure you want to call pm_runtime_enable() in bma150_probe()
> > > > so that parent controller can be suspended until somebody calls
> > > > bma150_open() and we mark the device as active (which, in turn, should
> > > > wake up its parent).
> > >
> > > If I call pm_runtime_enable() I cannot use pm_runtime_set_active() later
> > > according to the comment in __pm_runtime_set_status (runtime.c):
> > > "If runtime PM of the device is disabled or its power.runtime_error
> > > field is different from zero, the status may be changed either to
> > > RPM_ACTIVE, or to RPM_SUSPENDED..."
> > >
> > > If the PM of the device is enabled it will return -EAGAIN. Of course, we
> > > could enable() in probe, then disable(); set_active(); enable(); in
> > > open, but that seems a bit confused, right?
> > 
> > Hmm, indeed. I do not like the idea about disable/set_active/enable so I
> > guess we'll have to keep track of the current mode themselves and call
> > bma150_set_mode() ourselves if, after calling pm_runtime_get/put_sync()
> > we find that our mode is different from what we expect it to be.
> > 
> > I also noticed that you did not properly free IRQ on device removal and
> > also polled devices need to be freed always (unlike regular input
> > devices that should be only unregistered). The default_cfg can't be
> > __initdata because it is used by __devinit functions. And my version of
> > GCC can't figure out that ipoll_dev never used uninitialized and gives
> > false warning.
> > 
> > I tried correcting these issues in the patch below, along with renaming
> > 'ret' to 'error' which I prefer when we dealing with error handling.
> > Could you please git it a try and if everything still works I'll fold it
> > and commit.
> 
> Thanks Dmitry! I tried your patch and it worked like a charm!

Excellent, thanks for testing.

> 
> Do you take it from here or would you like me to send an updated
> version that includes your patch?

No, there is no need for that. I'll fold them all together and queue for
2.6.32.

I take the other patch that makes polled devices do poll upon opening
working well for you too.. Should I queue for .2 as well?

Thanks.

-- 
Dmitry

  reply	other threads:[~2011-08-08  5:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 20:53 [PATCH v6 0/1] input: add driver for Bosch Sensortec's BMA150 accelerometer Eric Andersson
2011-07-27 20:53 ` [PATCH v6 1/1] " Eric Andersson
2011-07-28  8:10   ` Jonathan Cameron
2011-07-30 19:17   ` Dmitry Torokhov
2011-07-30 22:49     ` Eric Andersson
2011-07-31  7:08       ` Dmitry Torokhov
     [not found]         ` <CAH+e7S2LU7zr6fcp+f+2UuzyXX_=icBa4OtO7m1YQQ2BtOyMAQ@mail.gmail.com>
2011-08-07 16:23           ` Eric Andersson
2011-08-08  5:15             ` Dmitry Torokhov [this message]
2011-08-08 20:27               ` Eric Andersson

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=20110808051504.GA7329@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=eric.andersson@unixphere.com \
    --cc=jic23@cam.ac.uk \
    --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;
as well as URLs for NNTP newsgroup(s).