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=-16.7 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,URIBL_BLOCKED autolearn=unavailable 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 67D11C433ED for ; Mon, 3 May 2021 09:57:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 41FFD6121E for ; Mon, 3 May 2021 09:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233172AbhECJ57 (ORCPT ); Mon, 3 May 2021 05:57:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:53286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbhECJ56 (ORCPT ); Mon, 3 May 2021 05:57:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 33A7C61157; Mon, 3 May 2021 09:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620035825; bh=NHIRO3+PyDbLugh6/AIoA+3M25be2L4BL+5JpSuPWs4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EjghMvyXqe4C3XAQOdQia+TDQPIrOeHVFc+Q8X7DOrmSK4v4CVpXxkKoHSt4i+OxA o6vf8bsPmcxMwvqfFuQzJJy4nwlSA90T91Fx6JjKGRni3jtd0SX22V1uAuB43pVMHu ychRh+6P1rKtZH2ZJR9WDO2fWcKNwZBDwyHPFPcf1VkcPHefgBs2B4x+dD/6ZEfJW2 3MTLbyvu+eaMmTQ/uNeF5R9+MKJc74sJqS5ByyHTg87xi77mt+gJVRHt/tXcXIVyfz 7fB/ePUP/53JgxCA49zUXF9JmYbnEG7S3feP3l3RYMUK/petVGjhQ6sUEFWN2nYYOf 9Jalo8ZkqSzsA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1ldVKF-0004I6-Nv; Mon, 03 May 2021 11:57:16 +0200 Date: Mon, 3 May 2021 11:57:15 +0200 From: Johan Hovold To: Jonathan Cameron Cc: Mauro Carvalho Chehab , devel@driverdev.osuosl.org, Greg Kroah-Hartman , linuxarm@huawei.com, linux-kernel@vger.kernel.org, Sakari Ailus , mauro.chehab@huawei.com, Bingbu Cao , Mauro Carvalho Chehab , Tianshu Qiu , linux-media@vger.kernel.org Subject: Re: [PATCH v4 23/79] staging: media: ipu3: use pm_runtime_resume_and_get() Message-ID: References: <20210430180338.00006e62@Huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210430180338.00006e62@Huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 30, 2021 at 06:03:38PM +0100, Jonathan Cameron wrote: > On Wed, 28 Apr 2021 16:51:44 +0200 > Mauro Carvalho Chehab wrote: > > > Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > > added pm_runtime_resume_and_get() in order to automatically handle > > dev->power.usage_count decrement on errors. > > > > Use the new API, in order to cleanup the error check logic. > > > > Signed-off-by: Mauro Carvalho Chehab > Could add that pm_runtime_put() should have been pm_runtime_put_noidle() > inorder to not potentially result in a call to runtime suspend when > we never resumed in the first place. No, that would never happen anyway and any pm_runtime_put() will do even if pm_runtime_put_noidle() is the natural choice in this case to balance the counter. > Otherwise reasonable cleanup. > > Reviewed-by: Jonathan Cameron > > > --- > > drivers/staging/media/ipu3/ipu3.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c > > index ee1bba6bdcac..8e1e9e46e604 100644 > > --- a/drivers/staging/media/ipu3/ipu3.c > > +++ b/drivers/staging/media/ipu3/ipu3.c > > @@ -392,10 +392,9 @@ int imgu_s_stream(struct imgu_device *imgu, int enable) > > } > > > > /* Set Power */ > > - r = pm_runtime_get_sync(dev); > > + r = pm_runtime_resume_and_get(dev); > > if (r < 0) { > > dev_err(dev, "failed to set imgu power\n"); > > - pm_runtime_put(dev); > > return r; > > } Johan 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=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 5CDA5C433B4 for ; Mon, 3 May 2021 09:57:10 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D69926120D for ; Mon, 3 May 2021 09:57:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D69926120D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9509E6058B; Mon, 3 May 2021 09:57:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vau30Whex9RJ; Mon, 3 May 2021 09:57:08 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 905FE6059C; Mon, 3 May 2021 09:57:08 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 88D621BF373 for ; Mon, 3 May 2021 09:57:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 77A314020F for ; Mon, 3 May 2021 09:57:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U0VfH3J4PgaA for ; Mon, 3 May 2021 09:57:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp2.osuosl.org (Postfix) with ESMTPS id C593B400DC for ; Mon, 3 May 2021 09:57:05 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 33A7C61157; Mon, 3 May 2021 09:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620035825; bh=NHIRO3+PyDbLugh6/AIoA+3M25be2L4BL+5JpSuPWs4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EjghMvyXqe4C3XAQOdQia+TDQPIrOeHVFc+Q8X7DOrmSK4v4CVpXxkKoHSt4i+OxA o6vf8bsPmcxMwvqfFuQzJJy4nwlSA90T91Fx6JjKGRni3jtd0SX22V1uAuB43pVMHu ychRh+6P1rKtZH2ZJR9WDO2fWcKNwZBDwyHPFPcf1VkcPHefgBs2B4x+dD/6ZEfJW2 3MTLbyvu+eaMmTQ/uNeF5R9+MKJc74sJqS5ByyHTg87xi77mt+gJVRHt/tXcXIVyfz 7fB/ePUP/53JgxCA49zUXF9JmYbnEG7S3feP3l3RYMUK/petVGjhQ6sUEFWN2nYYOf 9Jalo8ZkqSzsA== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1ldVKF-0004I6-Nv; Mon, 03 May 2021 11:57:16 +0200 Date: Mon, 3 May 2021 11:57:15 +0200 From: Johan Hovold To: Jonathan Cameron Subject: Re: [PATCH v4 23/79] staging: media: ipu3: use pm_runtime_resume_and_get() Message-ID: References: <20210430180338.00006e62@Huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210430180338.00006e62@Huawei.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devel@driverdev.osuosl.org, Mauro Carvalho Chehab , Greg Kroah-Hartman , linuxarm@huawei.com, linux-kernel@vger.kernel.org, Sakari Ailus , mauro.chehab@huawei.com, Bingbu Cao , Mauro Carvalho Chehab , Tianshu Qiu , linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" On Fri, Apr 30, 2021 at 06:03:38PM +0100, Jonathan Cameron wrote: > On Wed, 28 Apr 2021 16:51:44 +0200 > Mauro Carvalho Chehab wrote: > > > Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > > added pm_runtime_resume_and_get() in order to automatically handle > > dev->power.usage_count decrement on errors. > > > > Use the new API, in order to cleanup the error check logic. > > > > Signed-off-by: Mauro Carvalho Chehab > Could add that pm_runtime_put() should have been pm_runtime_put_noidle() > inorder to not potentially result in a call to runtime suspend when > we never resumed in the first place. No, that would never happen anyway and any pm_runtime_put() will do even if pm_runtime_put_noidle() is the natural choice in this case to balance the counter. > Otherwise reasonable cleanup. > > Reviewed-by: Jonathan Cameron > > > --- > > drivers/staging/media/ipu3/ipu3.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/staging/media/ipu3/ipu3.c b/drivers/staging/media/ipu3/ipu3.c > > index ee1bba6bdcac..8e1e9e46e604 100644 > > --- a/drivers/staging/media/ipu3/ipu3.c > > +++ b/drivers/staging/media/ipu3/ipu3.c > > @@ -392,10 +392,9 @@ int imgu_s_stream(struct imgu_device *imgu, int enable) > > } > > > > /* Set Power */ > > - r = pm_runtime_get_sync(dev); > > + r = pm_runtime_resume_and_get(dev); > > if (r < 0) { > > dev_err(dev, "failed to set imgu power\n"); > > - pm_runtime_put(dev); > > return r; > > } Johan _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel