From patchwork Tue Feb 7 16:01:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 9560515 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8E24560547 for ; Tue, 7 Feb 2017 16:03:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E5CA21F61 for ; Tue, 7 Feb 2017 16:03:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7205E28415; Tue, 7 Feb 2017 16:03:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D216D27BA5 for ; Tue, 7 Feb 2017 16:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754472AbdBGQDK (ORCPT ); Tue, 7 Feb 2017 11:03:10 -0500 Received: from muru.com ([72.249.23.125]:33976 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754977AbdBGQCH (ORCPT ); Tue, 7 Feb 2017 11:02:07 -0500 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id E25788245; Tue, 7 Feb 2017 16:03:19 +0000 (UTC) Date: Tue, 7 Feb 2017 08:01:57 -0800 From: Tony Lindgren To: Liam Breck Cc: Sebastian Reichel , Liam Breck , "Mark A . Greer" , linux-pm@vger.kernel.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 2/2] power: bq24190_charger: Use PM runtime autosuspend Message-ID: <20170207160157.GA21809@atomide.com> References: <20170131000210.5442-1-tony@atomide.com> <20170131000210.5442-3-tony@atomide.com> <20170131003632.GB7403@atomide.com> <20170203185408.GB3721@atomide.com> <20170203211707.GC3721@atomide.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP * Liam Breck [170203 16:25]: > On Fri, Feb 3, 2017 at 1:17 PM, Tony Lindgren wrote: > > static int bq24190_remove(struct i2c_client *client) > > { > > struct bq24190_dev_info *bdi = i2c_get_clientdata(client); > > + int error; > > > > - pm_runtime_get_sync(bdi->dev); > > - bq24190_register_reset(bdi); > > - pm_runtime_put_sync(bdi->dev); > > + 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); > > + } > > > > + bq24190_register_reset(bdi); > > bq24190_sysfs_remove_group(bdi); > > power_supply_unregister(bdi->battery); > > power_supply_unregister(bdi->charger); > > + pm_runtime_put_sync(bdi->dev); > > + pm_runtime_dont_use_autosuspend(bdi->dev); > > pm_runtime_disable(bdi->dev); > > I think you addressed this, but should the above be > > if (!error) > pm_runtime_put_sync(bdi->dev); Hmm yeah.. But we need to check for if (error >= 0), also in the other places see below. Regards, Tony 8< -------------------- Acked-by: Liam Breck diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c --- a/drivers/power/supply/bq24190_charger.c +++ b/drivers/power/supply/bq24190_charger.c @@ -1487,7 +1487,8 @@ static int bq24190_remove(struct i2c_client *client) bq24190_sysfs_remove_group(bdi); power_supply_unregister(bdi->battery); power_supply_unregister(bdi->charger); - pm_runtime_put_sync(bdi->dev); + if (error >= 0) + pm_runtime_put_sync(bdi->dev); pm_runtime_dont_use_autosuspend(bdi->dev); pm_runtime_disable(bdi->dev); @@ -1541,7 +1542,7 @@ static int bq24190_pm_suspend(struct device *dev) bq24190_register_reset(bdi); - if (!error) { + if (error >= 0) { pm_runtime_mark_last_busy(bdi->dev); pm_runtime_put_autosuspend(bdi->dev); } @@ -1568,7 +1569,7 @@ static int bq24190_pm_resume(struct device *dev) bq24190_set_mode_host(bdi); bq24190_read(bdi, BQ24190_REG_SS, &bdi->ss_reg); - if (!error) { + if (error >= 0) { pm_runtime_mark_last_busy(bdi->dev); pm_runtime_put_autosuspend(bdi->dev); }