linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Cohen <david.a.cohen@linux.intel.com>
To: Felipe Balbi <balbi@ti.com>
Cc: "xinhui.pan" <xinhuix.pan@intel.com>,
	linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	linus.walleij@linaro.org, gnurou@gmail.com,
	yanmin_zhang@linux.intel.com
Subject: Re: [PATCH] gpio-intel-mid: fix the incorrect return of idle callback
Date: Tue, 28 Jan 2014 16:13:57 -0800	[thread overview]
Message-ID: <20140129001357.GA13185@psi-dev26.jf.intel.com> (raw)
In-Reply-To: <20140128181206.GB31977@saruman.home>

On Tue, Jan 28, 2014 at 12:12:06PM -0600, Felipe Balbi wrote:
> On Tue, Jan 28, 2014 at 09:24:13AM -0800, David Cohen wrote:
> > On Tue, Jan 28, 2014 at 10:49:37AM -0600, Felipe Balbi wrote:
> > > On Tue, Jan 28, 2014 at 04:50:57PM +0800, xinhui.pan wrote:
> > > > From: "xinhui.pan" <xinhuiX.pan@intel.com>
> > > > 
> > > > intel_gpio_runtime_idle should return correct error code if it do fail.
> > > > make it more correct even though -EBUSY is the most possible return value.
> > > > 
> > > > Signed-off-by: bo.he <bo.he@intel.com>
> > > > Signed-off-by: xinhui.pan <xinhuiX.pan@intel.com>
> > > > ---
> > > >  drivers/gpio/gpio-intel-mid.c |    4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c
> > > > index d1b50ef..05749a3 100644
> > > > --- a/drivers/gpio/gpio-intel-mid.c
> > > > +++ b/drivers/gpio/gpio-intel-mid.c
> > > > @@ -394,7 +394,9 @@ static const struct irq_domain_ops intel_gpio_irq_ops = {
> > > >  
> > > >  static int intel_gpio_runtime_idle(struct device *dev)
> > > >  {
> > > > -	pm_schedule_suspend(dev, 500);
> > > > +	int err = pm_schedule_suspend(dev, 500);
> > > > +	if (err)
> > > > +		return err;
> > > >  	return -EBUSY;
> > > 
> > > wait, is it only me or this would look a lot better as:
> > > 
> > > static int intel_gpio_runtime_idle(struct device *dev)
> > > {
> > > 	return pm_schedule_suspend(dev, 500);
> > > }
> > 
> > The reply to your suggestion is probably in this commit :)
> > 
> > ---
> > commit 45f0a85c8258741d11bda25c0a5669c06267204a
> > Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Date:   Mon Jun 3 21:49:52 2013 +0200
> > 
> >     PM / Runtime: Rework the "runtime idle" helper routine
> > ---
> > 
> > We won't return 0 from here.
> 
> so you never want to return 0, why don't you, then:
> 
> static int intel_gpio_runtime_idle(struct device *dev)
> {
> 	pm_schedule_suspend(dev, 500);
> 	return -EBUSY;
> }

That's how it is currently :)

But this patch is making the function to return a different code in case
of error. IMHO there is not much fuctional gain with it, but I see
perhaps one extra info for tracing during development.

Anyway, I'll let Xinhui to do further comment since he's the author.

Br, David

> 
> just like drivers/tty/serial/mfd.c::serial_hsu_runtime_idle() is doing ?
> 
> -- 
> balbi



  reply	other threads:[~2014-01-29  0:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-28  8:50 [PATCH] gpio-intel-mid: fix the incorrect return of idle callback xinhui.pan
2014-01-28 16:48 ` David Cohen
2014-01-28 16:49 ` Felipe Balbi
2014-01-28 17:24   ` David Cohen
2014-01-28 18:12     ` Felipe Balbi
2014-01-29  0:13       ` David Cohen [this message]
2014-01-29  7:23         ` xinhui.pan
2014-01-29 19:12           ` David Cohen
2014-01-29 19:52             ` Felipe Balbi
2014-01-29 21:06               ` David Cohen
2014-01-30 12:15 xinhui.pan
2014-01-31 20:50 ` David Cohen

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=20140129001357.GA13185@psi-dev26.jf.intel.com \
    --to=david.a.cohen@linux.intel.com \
    --cc=balbi@ti.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xinhuix.pan@intel.com \
    --cc=yanmin_zhang@linux.intel.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).