From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Date: Mon, 30 Jan 2017 16:04:16 -0800 Message-ID: <20170131000415.GA7403@atomide.com> References: <20170120220440.1971-1-tony@atomide.com> <20170120220440.1971-3-tony@atomide.com> <20170124012702.GA7403@atomide.com> <20170124182925.GF7403@atomide.com> <20170130235558.GZ7403@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-pm-owner@vger.kernel.org To: Liam Breck Cc: Sebastian Reichel , Liam Breck , "Mark A . Greer" , linux-pm@vger.kernel.org, linux-omap@vger.kernel.org List-Id: linux-omap@vger.kernel.org * Liam Breck [170130 16:02]: > On Mon, Jan 30, 2017 at 3:55 PM, Tony Lindgren wrote: > > * Liam Breck [170126 15:57]: > >> On Tue, Jan 24, 2017 at 10:29 AM, Tony Lindgren wrote: > >> > @@ -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() Oh I see yeah ideally yes. Regards, Tony