Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend
From: Liam Breck <hidden>
Date: 2017-01-31 00:01:38
Also in:
linux-omap
On Mon, Jan 30, 2017 at 3:55 PM, Tony Lindgren [off-list ref] wrote:
* Liam Breck [off-list ref] [170126 15:57]:quoted
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.
I meant should the two pm_runtime_* calls above be flipped, so put_sync() is first. That's the order in probe()