From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58F26C433B4 for ; Wed, 12 May 2021 13:22:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 265F7611CE for ; Wed, 12 May 2021 13:22:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbhELNX5 (ORCPT ); Wed, 12 May 2021 09:23:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:41918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230265AbhELNX5 (ORCPT ); Wed, 12 May 2021 09:23:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46067613CA; Wed, 12 May 2021 13:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620825769; bh=+600oXmUz5yCA9BXwu6IsBzPyPlFFVP/G878xtyUWzw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=YBmJiVB7mcklbBf4tNS1KXO/hWJaveBBllEfUrkkQfILmLEtKPQuXKCWhzic86vQR aKdZRrvSORUVM6jABJQnVSbMT2UiFhzg1LYxoW1jSGGNHTyl1AsLlvFj+/DwgkSVLr hMwfdfNgb7HHavtb19E6IGCWO0ZPggvuEf/V6GPbrBO0CFG4S4A3BvlGG8cy6DX+hP JuNN22Qe2G0FXamjkhLeTxe7p3zWIHVTZZ/X/X9amWCWnryzSyUF41LwoSXX6aKTzv T8ev7fG97X3EI9I619JD+9+4BHxHEbxi6JT6nlWp1oN8u2ApkuLEn5eMKNEEVElhSl sYpX9BtFlGE2w== Date: Wed, 12 May 2021 15:22:43 +0200 From: Mauro Carvalho Chehab To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, Julia Lawall , "Rafael J . Wysocki" , Jonathan Cameron , Rui Miguel Silva Subject: Re: [PATCH 01/28] iio: gyro: fxa210002c: Balance runtime pm + use pm_runtime_resume_and_get(). Message-ID: <20210512152243.48c2fc74@coco.lan> In-Reply-To: <20210509113354.660190-2-jic23@kernel.org> References: <20210509113354.660190-1-jic23@kernel.org> <20210509113354.660190-2-jic23@kernel.org> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Em Sun, 9 May 2021 12:33:27 +0100 Jonathan Cameron escreveu: > From: Jonathan Cameron > > In both the probe() error path and remove() pm_runtime_put_noidle() > is called which will decrement the runtime pm reference count. > However, there is no matching function to have raised the reference count. > Not this isn't a fix as the runtime pm core will stop the reference count > going negative anyway. > > An alternative would have been to raise the count in these paths, but > it is not clear why that would be necessary. > > Whilst we are here replace some boilerplate with pm_runtime_resume_and_get() > Found using coccicheck script under review at: > https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/ > > Signed-off-by: Jonathan Cameron > Cc: Rui Miguel Silva LGTM. Reviewed-by: Mauro Carvalho Chehab > --- > drivers/iio/gyro/fxas21002c_core.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c > index 5af7b48ff01a..539585b0d300 100644 > --- a/drivers/iio/gyro/fxas21002c_core.c > +++ b/drivers/iio/gyro/fxas21002c_core.c > @@ -366,14 +366,7 @@ static int fxas21002c_write(struct fxas21002c_data *data, > > static int fxas21002c_pm_get(struct fxas21002c_data *data) > { > - struct device *dev = regmap_get_device(data->regmap); > - int ret; > - > - ret = pm_runtime_get_sync(dev); > - if (ret < 0) > - pm_runtime_put_noidle(dev); > - > - return ret; > + return pm_runtime_resume_and_get(regmap_get_device(data->regmap)); > } > > static int fxas21002c_pm_put(struct fxas21002c_data *data) > @@ -1002,7 +995,6 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, > pm_disable: > pm_runtime_disable(dev); > pm_runtime_set_suspended(dev); > - pm_runtime_put_noidle(dev); > > return ret; > } > @@ -1016,7 +1008,6 @@ void fxas21002c_core_remove(struct device *dev) > > pm_runtime_disable(dev); > pm_runtime_set_suspended(dev); > - pm_runtime_put_noidle(dev); > } > EXPORT_SYMBOL_GPL(fxas21002c_core_remove); > Thanks, Mauro