linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Liam Breck <liam@networkimprov.net>
Cc: Sebastian Reichel <sre@kernel.org>,
	Liam Breck <kernel@networkimprov.net>,
	"Mark A . Greer" <mgreer@animalcreek.com>,
	linux-pm@vger.kernel.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend
Date: Thu, 2 Feb 2017 19:44:40 -0800	[thread overview]
Message-ID: <20170203034440.GI7403@atomide.com> (raw)
In-Reply-To: <CAKvHMgTP40_YTHZn=mNNYBW5aheVNV2WskuikQeyjv3Zn27fOg@mail.gmail.com>

* Liam Breck <liam@networkimprov.net> [170202 17:44]:
> > @@ -427,11 +428,20 @@ static ssize_t bq24190_sysfs_show(struct device *dev,
> >         if (!info)
> >                 return -EINVAL;
> >
> > +       ret = pm_runtime_get_sync(bdi->dev);
> > +       if (ret < 0)
> > +               return ret;
> 
> Let's not stop here if get_sync fails.

Hmm care to describe why we would want to ignore errors on pm_runtime_get()?
I don't think that's a good idea.. And for sysfs_show() output?

If these calls fail it's a sign of a serious problem somewhere
and it should be fixed instead of ignoring the errors and attempting to
continue. Ignoring errors with these calls can lead into problems that
are hard to debug.

> > @@ -1364,12 +1394,16 @@ static int bq24190_probe(struct i2c_client *client,
> >         }
> >
> >         pm_runtime_enable(dev);
> > -       pm_runtime_resume(dev);
> > +       pm_runtime_use_autosuspend(dev);
> > +       pm_runtime_set_autosuspend_delay(dev, 600);
> > +       ret = pm_runtime_get_sync(dev);
> > +       if (ret < 0)
> > +               goto out1;
> 
> Nor here 8.

Eek, let's not try to continue the probe if pm_runtime_get_fails. Let's
just assume it's either implemented and must be working, or a nop operation
that will not do anything. Depending on the implementation, this could
affect something in the hardware like pin multiplexing, parent device
clocking.. On the module exit path it might make sense as we know the
device was working to get there so it might be possible to do something :)

> We need helper funcs...
> 
> static inline int bq24190_pmrt_get(struct device* dev) {
>   int err = pm_runtime_get_sync(dev);
>   if (err < 0) {
>     dev_warn(dev, "pm_runtime_get failed: %i\n", err);
>     pm_runtime_put_noidle(dev);
>   }
>   return err;
> }
> 
> static inline void bq24190_pmrt_put(struct device* dev, int err) {
>   if (!err) {
>     pm_runtime_mark_last_busy(dev);
>     pm_runtime_put_autosuspend(dev);
>   }
> }

If you want to implement something like that it should probably be
done in a Linux generic way. There's still quite a bit boilerplate
code needed for the autosuspend usage.

Regards,

Tony

  reply	other threads:[~2017-02-03  3:44 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-31  0:02 [PATCHv2 0/2] Two bq24190 PM improvments Tony Lindgren
2017-01-31  0:02 ` [PATCH 1/2] power: bq24190_charger: Check the interrupt status on resume Tony Lindgren
2017-02-03  0:32   ` Liam Breck
2017-01-31  0:02 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-01-31  0:14   ` Liam Breck
2017-01-31  0:36     ` Tony Lindgren
2017-02-03  1:43       ` Liam Breck
2017-02-03  3:44         ` Tony Lindgren [this message]
2017-02-03 10:38       ` Liam Breck
2017-02-03 18:54         ` Tony Lindgren
2017-02-03 21:00           ` Liam Breck
2017-02-03 21:17             ` Tony Lindgren
2017-02-03 21:44               ` Liam Breck
2017-02-03 22:28                 ` Tony Lindgren
2017-02-04  0:23               ` Liam Breck
2017-02-07 16:01                 ` Tony Lindgren
2017-02-07 18:20                   ` Liam Breck
  -- strict thread matches above, loose matches on Subject: below --
2017-02-08 23:12 [PATCHv4 0/2] Two bq24190 PM improvments Tony Lindgren
2017-02-08 23:13 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-02-03 23:09 [PATCHv3 0/2] Two bq24190 PM improvments Tony Lindgren
2017-02-03 23:09 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-02-08 21:32   ` Tony Lindgren
2017-01-20 22:04 [PATCH 0/2] Two bq24190 PM improvments Tony Lindgren
2017-01-20 22:04 ` [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-01-21  0:47   ` Liam Breck
2017-01-24  1:27     ` Tony Lindgren
2017-01-24  3:34       ` Liam Breck
2017-01-24 18:29         ` Tony Lindgren
2017-01-24 23:05           ` Mark Greer
2017-01-26 16:20             ` Tony Lindgren
2017-01-26 23:56           ` Liam Breck
2017-01-30 23:55             ` Tony Lindgren
2017-01-31  0:01               ` Liam Breck
2017-01-31  0:04                 ` Tony Lindgren

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=20170203034440.GI7403@atomide.com \
    --to=tony@atomide.com \
    --cc=kernel@networkimprov.net \
    --cc=liam@networkimprov.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgreer@animalcreek.com \
    --cc=sre@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;
as well as URLs for NNTP newsgroup(s).