Thread (17 messages) 17 messages, 4 authors, 2017-01-31

Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend

From: Tony Lindgren <tony@atomide.com>
Date: 2017-01-30 23:56:07
Also in: linux-pm

* Liam Breck [off-list ref] [170126 15:57]:
On Tue, Jan 24, 2017 at 10:29 AM, Tony Lindgren [off-list ref] wrote:
quoted
@@ -1430,10 +1473,20 @@ static int bq24190_probe(struct i2c_client *client,
 static int bq24190_remove(struct i2c_client *client)
 {
        struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
+       int error;
+
+       error = pm_runtime_get_sync(bdi->dev);
+       if (error < 0) {
+               dev_warn(bdi->dev, "pm_runtime_get failed: %i\n", error);
+               pm_runtime_put_noidle(bdi->dev);
+       }

-       pm_runtime_get_sync(bdi->dev);
        bq24190_register_reset(bdi);
-       pm_runtime_put_sync(bdi->dev);
+
+       if (!error) {
+               pm_runtime_dont_use_autosuspend(bdi->dev);
+               pm_runtime_put_sync(bdi->dev);
+       }
Should put_sync() be called before dont_use_autosuspend(), as in probe()?
Yeah good to have them paired. With pm_runtime_put_noidle() we're
active on error, so we can just call pm_runtime_dont_use_autosuspend()
and pm_runtime_put_sync() unconditionally.
Should the pm_runtime_disable() further on in remove() go inside the
above block?
No need to because of the pm_runtime_put_noidle(). I'll just move the
pm_runtime_dont_use_autosuspend() and pm_runtime_put_sync() to the
end.

I'll repost both patches one more time with acks.

Regards,

Tony
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help