From patchwork Tue Apr 27 10:12:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428209 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.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,USER_AGENT_GIT 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 68372C43460 for ; Tue, 27 Apr 2021 10:14:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3A2A160FF1 for ; Tue, 27 Apr 2021 10:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235501AbhD0KOm (ORCPT ); Tue, 27 Apr 2021 06:14:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:34658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235268AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EEC5E613CF; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=Dz4yuaAkE3G30hsowoZG+/b+CgXUAS8PpNDZLkNm+lU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBf4W9RKz5BBonSdEtXhxn5lmb/bEJ9yN6halpTLgkI/cMsCSJ8CJGFBoFe/6MlvK uE4rOQO+oQW0k5nRlKLEvRnzgonMoScpGmuIutaGqH20jMZ7DrStIswhsI1cASeR28 Jv/xYkLc8h6i8BexaOtpohbUDmyWxG/wPEEcIge/2r9+GgCi5GUgKIa6xcNYc/SlNF DQlXowrftBJUmHiuE1E0oHzAwC8Yn950smVVRaZ8nZlnC50VgEWon3RaRJuoTfBxy6 JG0BKJ/bNkObmaUnpmLrpcunepLNOlix4DB0d9DkBD5mbl3n2KefwNeJFNPQTJ++fQ 68AlL84UtPaTg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4f-9q; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 02/79] media: i2c: ccs-core: return the right error code at suspend Date: Tue, 27 Apr 2021 12:12:29 +0200 Message-Id: <745502b8a3216c0607dcb2a9c401636f245c32ad.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org If pm_runtime resume logic fails, return the error code provided by it, instead of -EAGAIN, as, depending on what caused it to fail, it may not be something that would be recovered. Acked-by: Sakari Ailus Fixes: cbba45d43631 ("[media] smiapp: Use runtime PM") Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ccs/ccs-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 9dc3f45da3dc..b05f409014b2 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -3093,7 +3093,7 @@ static int __maybe_unused ccs_suspend(struct device *dev) if (rval < 0) { pm_runtime_put_noidle(dev); - return -EAGAIN; + return rval; } if (sensor->streaming) From patchwork Tue Apr 27 10:12:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428212 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 2ABD7C43470 for ; Tue, 27 Apr 2021 10:13:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C9C061623 for ; Tue, 27 Apr 2021 10:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235435AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235225AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D95A0613C3; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518430; bh=yher15YM7h61KHb/hY+EJ/RRJANP10wcnUo8G05kfG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T3XWa01AwHvFFDXxPmHCkXGTpu38NkeBQsMzh+aS2GAQnXF2qtZeFHRaKoIlsegp/ SoD9/IACexeeo1blB8Ydt5o2Pr5A+/JjnLgHUMiatdPxv5kvpVMW4vm71eIVQv5hCh Oi779nfJAbRT5NrWcSD6CNptFxLtS53RXam/B7/PFki0PRWY73hbkr8J9wh71R1GxF bdNiXKvSYNH+DdhdKr/wemLCbawzsQmTK0PwbnwnO8J/Sf2FVoP/gs18XWZgm3rpGV GR21XcsN/zuvrf3TjsPSg6zuDTCuDlHTo85570h1FRhV3GBVubaizLJkzO9WzTlsky sDyIsDwW1ZNyA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4j-Aw; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Akinobu Mita , Hans Verkuil , Jacopo Mondi , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 03/79] media: i2c: mt9m001: don't resume at remove time Date: Tue, 27 Apr 2021 12:12:30 +0200 Message-Id: <5a5442f20a8ddfd18d1231c1f33356729dc8c9c1.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Calling pm_runtime_get_sync() at driver's removal time is not right, as this will resume PM runtime. This is clearly not what it is desired there, since it calls pm_runtime_set_suspended() afterwards. So, just remove pm runtime get/put logic from the device removal logic. Fixes: 8fcfc491c6ca ("media: mt9m001: switch s_power callback to runtime PM") Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/mt9m001.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c index 3b0ba8ed5233..ac1b380e6c03 100644 --- a/drivers/media/i2c/mt9m001.c +++ b/drivers/media/i2c/mt9m001.c @@ -834,14 +834,11 @@ static int mt9m001_remove(struct i2c_client *client) { struct mt9m001 *mt9m001 = to_mt9m001(client); - pm_runtime_get_sync(&client->dev); - v4l2_async_unregister_subdev(&mt9m001->subdev); media_entity_cleanup(&mt9m001->subdev.entity); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - pm_runtime_put_noidle(&client->dev); mt9m001_power_off(&client->dev); v4l2_ctrl_handler_free(&mt9m001->hdl); From patchwork Tue Apr 27 10:12:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428211 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 0F78FC4360C for ; Tue, 27 Apr 2021 10:13:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D1D33613D4 for ; Tue, 27 Apr 2021 10:13:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235446AbhD0KOh (ORCPT ); Tue, 27 Apr 2021 06:14:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:34514 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235133AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D0FCF61185; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518430; bh=5AHhx16DJL5gdJqgumKoh72s5QcxkeHszhw8tqlTmq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NTA2S1Sonleg150UpGEVecKnFYj5RHSvkQVL4DvMeWJhOWgWc473mJZuzHMDM+8cb AOdW6pRJjU3f/SXMbU/eAdTCp3cL4Qbw+Ikdbe69CsKulaLFTh/KREbaWdCAofyzrw G9u9zDZNSZwrbax1s1S8HwDL1p89TAxuI3vEXQDmGACKYeFV3owAqx3l4LowUw9E7u 0cz3kVwhEi6r0FhH3WszSczzCYMHeJoDbNsUgj6FwV7BvLk5D3oM78ONjVT2mdU+U/ sxeNIrFFaweUH3XMZRM1o3fixW2EgDeTxns4KkX+7dkyBaXWayHIa9M3tsTNZlP7OH KNH6mdRPWjGWA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4m-Ce; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , Songjun Wu , Wenyou Yang , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 04/79] media: i2c: ov7740: don't resume at remove time Date: Tue, 27 Apr 2021 12:12:31 +0200 Message-Id: <7d310b4db4f7b24bd187d76ab21eabc36e4a7856.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Calling pm_runtime_get_sync() at driver's removal time is not right, as this will resume PM runtime. This is clearly not what it is desired there, since it calls pm_runtime_set_suspended() afterwards. So, just remove pm runtime get/put logic from the device removal logic. Fixes: 39c5c4471b8d ("media: i2c: Add the ov7740 image sensor driver") Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/ov7740.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index 47a9003d29d6..ed6904b2e8f5 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -1165,10 +1165,8 @@ static int ov7740_remove(struct i2c_client *client) v4l2_async_unregister_subdev(sd); ov7740_free_controls(ov7740); - pm_runtime_get_sync(&client->dev); pm_runtime_disable(&client->dev); pm_runtime_set_suspended(&client->dev); - pm_runtime_put_noidle(&client->dev); ov7740_set_power(ov7740, 0); return 0; From patchwork Tue Apr 27 10:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428210 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 4CF28C433ED for ; Tue, 27 Apr 2021 10:13:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A805613DC for ; Tue, 27 Apr 2021 10:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235459AbhD0KOi (ORCPT ); Tue, 27 Apr 2021 06:14:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235304AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE919613C6; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=7cvQL/2CEUShgMHfIXo5pZaMj/4OUeemdQZifBElsOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hq3COPd8OSGdrif9VHBXp6CRwrjlAlnTvk5/oCgS/5HkYgaF4txepgkMiS6npJqVG OzNYWc98VW1sp/SWYNQZYOq9Ip22eUE5+WTbe4UK8LQOuzkZTwqhod4l/4q9mWNtvf SzWMjNybANnSNDFxd6dGpUCyhWrnXduNZqs+PVDhX3NA/UFMItXV3G9MYGByljG4Gq TqOFedyOVqJ925bj5002+wOBOZvJbJP7jvB2VDu6BbjGrAMAsIykdltiVuwzSXqsOC SbcLMYf3Vcqg4p7v8cUw34i70CiAd2OQVhngcOxhwUbq5Ul0btt4cWoAdRYODFNsdo VeItlx8fMzgxA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4v-G1; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Alexandre Belloni , Eugen Hristev , Ludovic Desroches , Mauro Carvalho Chehab , Nicolas Ferre , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 07/79] media: atmel: properly get pm_runtime Date: Tue, 27 Apr 2021 12:12:34 +0200 Message-Id: <246fe06a2621c5945f474fdf357aa5e5a4e1fb12.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are several issues in the way the atmel driver handles pm_runtime_get_sync(): - it doesn't check return codes; - it doesn't properly decrement the usage_count on all places; - it starts streaming even if pm_runtime_get_sync() fails. - while it tries to get pm_runtime at the clock enable logic, it doesn't check if the operation was suceeded. Replace all occurrences of it to use the new kAPI: pm_runtime_resume_and_get(), which ensures that, if the return code is not negative, the usage_count was incremented. With that, add additional checks when this is called, in order to ensure that errors will be properly addressed. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/atmel/atmel-isc-base.c | 27 ++++++++++++++----- drivers/media/platform/atmel/atmel-isi.c | 19 ++++++++++--- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index fe3ec8d0eaee..02543fe42e9d 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -294,9 +294,13 @@ static int isc_wait_clk_stable(struct clk_hw *hw) static int isc_clk_prepare(struct clk_hw *hw) { struct isc_clk *isc_clk = to_isc_clk(hw); + int ret; - if (isc_clk->id == ISC_ISPCK) - pm_runtime_get_sync(isc_clk->dev); + if (isc_clk->id == ISC_ISPCK) { + ret = pm_runtime_resume_and_get(isc_clk->dev); + if (ret < 0) + return 0; + } return isc_wait_clk_stable(hw); } @@ -353,9 +357,13 @@ static int isc_clk_is_enabled(struct clk_hw *hw) { struct isc_clk *isc_clk = to_isc_clk(hw); u32 status; + int ret; - if (isc_clk->id == ISC_ISPCK) - pm_runtime_get_sync(isc_clk->dev); + if (isc_clk->id == ISC_ISPCK) { + ret = pm_runtime_resume_and_get(isc_clk->dev); + if (ret < 0) + return 0; + } regmap_read(isc_clk->regmap, ISC_CLKSR, &status); @@ -807,7 +815,9 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) goto err_start_stream; } - pm_runtime_get_sync(isc->dev); + ret = pm_runtime_resume_and_get(isc->dev); + if (ret < 0) + goto err_pm_get; ret = isc_configure(isc); if (unlikely(ret)) @@ -838,7 +848,7 @@ static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) err_configure: pm_runtime_put_sync(isc->dev); - +err_pm_get: v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0); err_start_stream: @@ -1809,6 +1819,7 @@ static void isc_awb_work(struct work_struct *w) u32 baysel; unsigned long flags; u32 min, max; + int ret; /* streaming is not active anymore */ if (isc->stop) @@ -1831,7 +1842,9 @@ static void isc_awb_work(struct work_struct *w) ctrls->hist_id = hist_id; baysel = isc->config.sd_format->cfa_baycfg << ISC_HIS_CFG_BAYSEL_SHIFT; - pm_runtime_get_sync(isc->dev); + ret = pm_runtime_resume_and_get(isc->dev); + if (ret < 0) + return; /* * only update if we have all the required histograms and controls diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index 0514be6153df..6a433926726d 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -422,7 +422,9 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) struct frame_buffer *buf, *node; int ret; - pm_runtime_get_sync(isi->dev); + ret = pm_runtime_resume_and_get(isi->dev); + if (ret < 0) + return ret; /* Enable stream on the sub device */ ret = v4l2_subdev_call(isi->entity.subdev, video, s_stream, 1); @@ -782,9 +784,10 @@ static int isi_enum_frameintervals(struct file *file, void *fh, return 0; } -static void isi_camera_set_bus_param(struct atmel_isi *isi) +static int isi_camera_set_bus_param(struct atmel_isi *isi) { u32 cfg1 = 0; + int ret; /* set bus param for ISI */ if (isi->pdata.hsync_act_low) @@ -801,12 +804,16 @@ static void isi_camera_set_bus_param(struct atmel_isi *isi) cfg1 |= ISI_CFG1_THMASK_BEATS_16; /* Enable PM and peripheral clock before operate isi registers */ - pm_runtime_get_sync(isi->dev); + ret = pm_runtime_resume_and_get(isi->dev); + if (ret < 0) + return ret; isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); isi_writel(isi, ISI_CFG1, cfg1); pm_runtime_put(isi->dev); + + return 0; } /* -----------------------------------------------------------------------*/ @@ -1085,7 +1092,11 @@ static int isi_graph_notify_complete(struct v4l2_async_notifier *notifier) dev_err(isi->dev, "No supported mediabus format found\n"); return ret; } - isi_camera_set_bus_param(isi); + ret = isi_camera_set_bus_param(isi); + if (ret) { + dev_err(isi->dev, "Can't wake up device\n"); + return ret; + } ret = isi_set_default_fmt(isi); if (ret) { From patchwork Tue Apr 27 10:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428206 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 076E7C43460 for ; Tue, 27 Apr 2021 10:14:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D03E660FF1 for ; Tue, 27 Apr 2021 10:14:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235598AbhD0KOt (ORCPT ); Tue, 27 Apr 2021 06:14:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:34866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235366AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6F2B613C9; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=XfZSeMotNFyXbfT608pw1ECU5JJkssXPopFyWbltzaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nr2lUUMOHAMasRjwlY5qX3qVA4oegZ5AgUvpL6usdP7kYYZZZM6TsC32yW50v4n6u tcvNRQPCPk6KdTQhVAuWpm8L6wfnAnIjOKNjBAs6jwHBPaBboSwVTtHXpbVHICzTcc 1lBOKpP8EbMRNwPR8QTTYS2F24GO8hT3AURqYHmbXcQqcXviY2sO/li0wDxoeiLi33 nc5lIPv6zUXjHIDqnptAPfdDLqX7OdAffVBQPSFke/Wxl7TBV7w+dNNYe8y48V1rZU mz502CLIOs0MXwwcj+kyRx0Ho46obWLtWanADRaK/TUGgaFs6xRbkw6cpbsKRwfj97 jsoJG5CIc2oSA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j51-J8; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrew-CT Chen , Houlong Wei , Matthias Brugger , Mauro Carvalho Chehab , Minghsiu Tsai , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 09/79] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:36 +0200 Message-Id: <36568b7ce611dfaf4abc3233c76018a137f934c8.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. Replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. While here, fix the return contition of mtk_mdp_m2m_start_streaming(), as it doesn't make any sense to return 0 if the PM runtime failed to resume. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c index ace4528cdc5e..f14779e7596e 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c @@ -391,12 +391,12 @@ static int mtk_mdp_m2m_start_streaming(struct vb2_queue *q, unsigned int count) struct mtk_mdp_ctx *ctx = q->drv_priv; int ret; - ret = pm_runtime_get_sync(&ctx->mdp_dev->pdev->dev); + ret = pm_runtime_resume_and_get(&ctx->mdp_dev->pdev->dev); if (ret < 0) - mtk_mdp_dbg(1, "[%d] pm_runtime_get_sync failed:%d", + mtk_mdp_dbg(1, "[%d] pm_runtime_resume_and_get failed:%d", ctx->id, ret); - return 0; + return ret; } static void *mtk_mdp_m2m_buf_remove(struct mtk_mdp_ctx *ctx, From patchwork Tue Apr 27 10:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428201 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 B0616C433B4 for ; Tue, 27 Apr 2021 10:14:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A786611F2 for ; Tue, 27 Apr 2021 10:14:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235716AbhD0KPF (ORCPT ); Tue, 27 Apr 2021 06:15:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:35166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235412AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88BAA61002; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=uJQR0czm+DeAW2PWQeBvZ4Rvzd+S5i8+90myFebensI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NiQvYMF7OEWPJzkJcicJ7WcKvB0H3GERIgYfA5qd0WtSjnaR0/nAV3hMCadwmEBnt 4Q0sn828e2ClzSrXWAtUuIDkwINCzefQc5ICV1bguILEAdRR66cv/1jXdl9aEvRcRD Bhx8pj/CKQr/EPlPqWchTGcwCLeQnx+qsO71Obg5pOpy0+39ert3POkP7ii32N1zeU XveXVnKAn9x/663ekqaHhQLsC16Ik7jDuulgkWxnbnMOCpwuwSCaBDoZ6iUKIiOLGH xkHRvRXlm6NGdmEAOPXnHv5P+44UCyanuBFz0MRONQIWQyeh8mwCBCsqWRTqxDSKDW SKrNb8oYv9xlQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j57-LA; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Ezequiel Garcia , Heiko Stuebner , Jacob Chen , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2 11/79] media: rga-buf: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:38 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/rockchip/rga/rga-buf.c | 3 +-- drivers/media/platform/rockchip/rga/rga.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c index bf9a75b75083..81508ed5abf3 100644 --- a/drivers/media/platform/rockchip/rga/rga-buf.c +++ b/drivers/media/platform/rockchip/rga/rga-buf.c @@ -79,9 +79,8 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count) struct rockchip_rga *rga = ctx->rga; int ret; - ret = pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); if (ret < 0) { - pm_runtime_put_noidle(rga->dev); rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED); return ret; } diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 9d122429706e..bf3fd71ec3af 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -866,7 +866,9 @@ static int rga_probe(struct platform_device *pdev) goto unreg_video_dev; } - pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); + if (ret < 0) + goto unreg_video_dev; rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF; rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F; From patchwork Tue Apr 27 10:12:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428200 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 8928CC43461 for ; Tue, 27 Apr 2021 10:14:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 61B13613E4 for ; Tue, 27 Apr 2021 10:14:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235734AbhD0KPI (ORCPT ); Tue, 27 Apr 2021 06:15:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:35230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235415AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 918DE6141E; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=WqKoYQevkaStNcKaOzNIvfyWSTMDPdaJk89Ynu0GOzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LoUuZ1TaQvQ5CxmEUPAH4lqIsqWPje2SWXVaMT/ZtNuDfR3nTI8ZWAsmwr41p2IMM 3z5seHicv+2UAiVd2MiUEchixXZRWwMB+hqJI78+10zMnyEU29EAhOhtUinvb8MGoq ixDj4arF48KriUB2ZlDwz59DGcaI77Eb661OQ3kRbGm0dh27eMsHsnxTR5djV4sSx1 aa6pT5jaxD+42cb2avrORk2voD1zCEF+Gzm9xQh/g/wH5DZhiDbL4Axet3h3E08OuX L/ZcTQiacEtoeseaM0YCvjBIStKyG5ImGvs+LialnnAcTyRvuiLvRUskwOkyICBiv0 O3Uc5it5DhGIg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5A-MC; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Jacopo Mondi , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 12/79] media: renesas-ceu: Properly check for PM errors Date: Tue, 27 Apr 2021 12:12:39 +0200 Message-Id: <442ba0816c3977dddf01212659443ee13f90bd5d.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Right now, the driver just assumes that PM runtime resume worked, but it may fail. Well, the pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. So, using it is tricky. Let's replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") and return an error if something bad happens. This should ensure that the PM runtime usage_count will be properly decremented if an error happens at open time. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/renesas-ceu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/renesas-ceu.c b/drivers/media/platform/renesas-ceu.c index cd137101d41e..17f01b6e3fe0 100644 --- a/drivers/media/platform/renesas-ceu.c +++ b/drivers/media/platform/renesas-ceu.c @@ -1099,10 +1099,10 @@ static int ceu_open(struct file *file) mutex_lock(&ceudev->mlock); /* Causes soft-reset and sensor power on on first open */ - pm_runtime_get_sync(ceudev->dev); + ret = pm_runtime_resume_and_get(ceudev->dev); mutex_unlock(&ceudev->mlock); - return 0; + return ret; } static int ceu_release(struct file *file) From patchwork Tue Apr 27 10:12:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428205 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 3330BC433B4 for ; Tue, 27 Apr 2021 10:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0E84A60FF1 for ; Tue, 27 Apr 2021 10:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235638AbhD0KOy (ORCPT ); Tue, 27 Apr 2021 06:14:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:34862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235369AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AC42613D7; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=ozAIBQhBgl4hYvo20eM4TXq01azS0FPBmDKGIed3VZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SuwsfLYcUi38xmu83GyBHZLxUohbg1NqqupeRKfqB3+/nM99vKRGZZezvrhVoh8iI e4CcnC4riQ1gOlnXfX+xChGqaPaNwQfEef+9eDfMnvHnctwkFhTXh5JM6PIHY/ld4F WHayV2J9qR4bhDdtkw55iYIdOrdIfg+xH7/nUGVIZxfz0duBTGvXDjCp2l06oH7F/n ctA5RGU3WEANvjfiqvO+czngubNbQVPMn0iMG7FIjvVxyqb28XgXnJLIQJzWRVZXeM 7kLdNabtcr51VayI4eqV8Qsqo6AC/f/CUrxYKjsZ9HUIZDS0uqrVUI2dhh5UsvSqu2 zmJijurrDoDFA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5D-NB; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Hans Verkuil , Marek Szyprowski , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 13/79] media: s5p: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:40 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. Replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. While here, check if the PM runtime error was caught at s5p_cec_adap_enable(). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/cec/platform/s5p/s5p_cec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/cec/platform/s5p/s5p_cec.c b/drivers/media/cec/platform/s5p/s5p_cec.c index 2a3e7ffefe0a..2250c1cbc64e 100644 --- a/drivers/media/cec/platform/s5p/s5p_cec.c +++ b/drivers/media/cec/platform/s5p/s5p_cec.c @@ -35,10 +35,13 @@ MODULE_PARM_DESC(debug, "debug level (0-2)"); static int s5p_cec_adap_enable(struct cec_adapter *adap, bool enable) { + int ret; struct s5p_cec_dev *cec = cec_get_drvdata(adap); if (enable) { - pm_runtime_get_sync(cec->dev); + ret = pm_runtime_resume_and_get(cec->dev); + if (ret < 0) + return ret; s5p_cec_reset(cec); From patchwork Tue Apr 27 10:12:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428183 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 0D1E8C43460 for ; Tue, 27 Apr 2021 10:15:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC1CE611F2 for ; Tue, 27 Apr 2021 10:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237801AbhD0KQN (ORCPT ); Tue, 27 Apr 2021 06:16:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:34780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235592AbhD0KOs (ORCPT ); Tue, 27 Apr 2021 06:14:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 38FC561923; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=v3oOn6uPHJX4lDQc2LG+Rn/44BbALYGNkVgzHn1PdbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QYf5fRS1/rmz22chlWb+8rQj+/GJB9Pbz8xRaWgozmM98EQdsWSk/e47nrliLEVH1 GP0SmZ7t/GmzxEVU/i1oTmsCNTylnviKazpS63GKE+a6D6C/PBG8xYz3KPqEwO9Zt9 yrnxQOJZdZfglalRIIs6EIWFLtGQLtpHTCi1yfNn9dv508Xcbu6LHo9YYYZLg9rRrR 7+LCkoBCqj8litNqIwBaxKkVWsiVZKef9KT/M/HJW0Wkqng9NaW8b++Cu/EM8wfr9Q 2ZIxyRig0h4Ce3x0qPMUatkV8NuIvx6H/f+XPgdw19+fbMk46R8UmmaYSv3x/cyj8Z g22ZunrliBA6Q== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5G-OH; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , "Lad, Prabhakar" , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 14/79] media: am437x: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:41 +0200 Message-Id: <98c638ac1c2c85c08afc14d63cface1cdbc508bf.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. Replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. While here, ensure that the driver will check if PM runtime resumed at vpfe_initialize_device(). Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/am437x/am437x-vpfe.c | 22 +++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/am437x/am437x-vpfe.c b/drivers/media/platform/am437x/am437x-vpfe.c index 6cdc77dda0e4..bced526f30f2 100644 --- a/drivers/media/platform/am437x/am437x-vpfe.c +++ b/drivers/media/platform/am437x/am437x-vpfe.c @@ -1021,7 +1021,9 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe) if (ret) return ret; - pm_runtime_get_sync(vpfe->pdev); + ret = pm_runtime_resume_and_get(vpfe->pdev); + if (ret < 0) + return ret; vpfe_config_enable(&vpfe->ccdc, 1); @@ -2443,7 +2445,11 @@ static int vpfe_probe(struct platform_device *pdev) pm_runtime_enable(&pdev->dev); /* for now just enable it here instead of waiting for the open */ - pm_runtime_get_sync(&pdev->dev); + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret < 0) { + vpfe_err(vpfe, "Unable to resume device.\n"); + goto probe_out_v4l2_unregister; + } vpfe_ccdc_config_defaults(ccdc); @@ -2527,10 +2533,11 @@ static int vpfe_suspend(struct device *dev) { struct vpfe_device *vpfe = dev_get_drvdata(dev); struct vpfe_ccdc *ccdc = &vpfe->ccdc; + int ret; /* only do full suspend if streaming has started */ if (vb2_start_streaming_called(&vpfe->buffer_queue)) { - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); vpfe_config_enable(ccdc, 1); /* Save VPFE context */ @@ -2541,7 +2548,8 @@ static int vpfe_suspend(struct device *dev) vpfe_config_enable(ccdc, 0); /* Disable both master and slave clock */ - pm_runtime_put_sync(dev); + if (ret >= 0) + pm_runtime_put_sync(dev); } /* Select sleep pin state */ @@ -2583,18 +2591,20 @@ static int vpfe_resume(struct device *dev) { struct vpfe_device *vpfe = dev_get_drvdata(dev); struct vpfe_ccdc *ccdc = &vpfe->ccdc; + int ret; /* only do full resume if streaming has started */ if (vb2_start_streaming_called(&vpfe->buffer_queue)) { /* Enable both master and slave clock */ - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); vpfe_config_enable(ccdc, 1); /* Restore VPFE context */ vpfe_restore_context(ccdc); vpfe_config_enable(ccdc, 0); - pm_runtime_put_sync(dev); + if (ret >= 0) + pm_runtime_put_sync(dev); } /* Select default pin state */ From patchwork Tue Apr 27 10:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428208 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 59BE1C43461 for ; Tue, 27 Apr 2021 10:14:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D55C613C8 for ; Tue, 27 Apr 2021 10:14:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235525AbhD0KOo (ORCPT ); Tue, 27 Apr 2021 06:14:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:34780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235353AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06263613D1; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=dO1gD2vCTyNaQMmr4CD5RrufRsq5HOpPc9z13n0Rohk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kreVFPQyyC+gt6dxASA1KwIHM7ks8tRyxNcLuXn/lmMuigpR+ad9uCR0tmJJFUZOC MPZLTG9gNZ2+lQzLNVApsxsJS+GTaIRD8vhzg8lXUqwGmjoQ8ZlOEqXoag/sjjtxWv uO6jW1O6Sa57Xnj2KY8FgESId3A3y+jwy4eXq6/9wJvZbgM4+oxcre+ReRdGj3nqT4 0+CXXauGBWEmSZ/coF+VvxP7CJ3X23rxuQsVj6eisjF2AuBcf5L3Tc/79RcXEbzoBm Kjp+Gm+nH3MSvIKCO98uEPJ1b/BSDX/cGVMzBC3CbcY+MX/F79B8L6xKXbcbrTUl3W YLmslc9I4mHnQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5M-QV; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Tiffany Lin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 16/79] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:43 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. Replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c index ddee7046ce42..fe096fe61c9d 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c @@ -92,9 +92,9 @@ void mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) { int ret; - ret = pm_runtime_get_sync(pm->dev); + ret = pm_runtime_resume_and_get(pm->dev); if (ret) - mtk_v4l2_err("pm_runtime_get_sync fail %d", ret); + mtk_v4l2_err("pm_runtime_resume_and_get fail %d", ret); } void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) From patchwork Tue Apr 27 10:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428207 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.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,USER_AGENT_GIT 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 D7AF0C433B4 for ; Tue, 27 Apr 2021 10:14:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A50E61185 for ; Tue, 27 Apr 2021 10:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235570AbhD0KOq (ORCPT ); Tue, 27 Apr 2021 06:14:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:34772 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235351AbhD0KOe (ORCPT ); Tue, 27 Apr 2021 06:14:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0708F613D3; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=cJmIogEt8DtaRrLuirE0smJSOENxo/aAnd7cgWYfYDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZp74C/N3xULsOG1NcjGyCnHrQUbBn7L4C6SjULa6jlIkjkwb4uQjAmyz7MBIatyJ 8aZXyLOROj+YrO2pBurSY+F68uEs1Jq7JH8uqCwePJcN1IGEgiLVpmyxerCcjGmQIf ZTmIUdmWmE3sxwJyOEeTKlY2LM2tJP+uzh4xlcCEuQ3IuqdQWKS9j1AdkFOrYN6Vor RafH87t0RcMEZ2XSQQBWv5wtqRM3l8dW6T/m2a2MOTN6eezeZbhPil2BAoyM/Z8ZFK 9q5GHr2H+784p6XQXO43aCpof7AgRGZF/J7/LD2TXJKgfIX/Wx5n9U0dNdaQ39pRd9 JuMWqXSUso+VQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5P-RZ; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrzej Pietrasiewicz , Jacek Anaszewski , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 17/79] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:44 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. Replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. Reviewed-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 026111505f5a..c4f19418a460 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2568,7 +2568,7 @@ static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q); int ret; - ret = pm_runtime_get_sync(ctx->jpeg->dev); + ret = pm_runtime_resume_and_get(ctx->jpeg->dev); return ret > 0 ? 0 : ret; } From patchwork Tue Apr 27 10:12:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428204 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 03ECCC433ED for ; Tue, 27 Apr 2021 10:14:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C4772613C8 for ; Tue, 27 Apr 2021 10:14:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235498AbhD0KO5 (ORCPT ); Tue, 27 Apr 2021 06:14:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:34910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235380AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 45F64613F3; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=ZOYDC8nizVOemN97ng0w67F2uxMXkIsqLhOdGgCw1ys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ltbs4haX77wUTaNgOEPnkCkZ5mFTCSyn0QYu8/7qqZBV13a09lu4T5A0rYj/ZEpEP uzX25/iWkZqaoIM3h6qfKibVdPRayUV6uk5aeUCYsa65+azmLIb/8nxuGqFF3rzlKL eTMBve+MVtSJ+HMcNJgxZA+LAgeV0Zya1jy9xtyxvmbBl7QVUP8zsgG4cgo+PbJ0Mh CSZIR0SdezMrSGvkzVTicfJGFnYJklNBN2DBgnYFk+I02MSYtoLfUqDboUaQ/7iR5t RigO9HTjK+mSMEKIt/M1CCMj6czpg92eFlYHoIsip98CwhCrwcctX+KoUPRKeJJmNe 5xnxUBEEGSTRg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5b-0M; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Greg Kroah-Hartman , Mauro Carvalho Chehab , Sakari Ailus , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 21/79] staging: media: atomisp_fops: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:48 +0200 Message-Id: <6db5624e2d137349965451f66bc47bbde357c60c.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/staging/media/atomisp/pci/atomisp_fops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index f1e6b2597853..26d05474a035 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -837,7 +837,7 @@ static int atomisp_open(struct file *file) } /* runtime power management, turn on ISP */ - ret = pm_runtime_get_sync(vdev->v4l2_dev->dev); + ret = pm_runtime_resume_and_get(vdev->v4l2_dev->dev); if (ret < 0) { dev_err(isp->dev, "Failed to power on device\n"); goto error; @@ -881,9 +881,9 @@ static int atomisp_open(struct file *file) css_error: atomisp_css_uninit(isp); -error: - hmm_pool_unregister(HMM_POOL_TYPE_DYNAMIC); pm_runtime_put(vdev->v4l2_dev->dev); +error: + hmm_pool_unregister(HMM_POOL_TYPE_DYNAMIC); rt_mutex_unlock(&isp->mutex); return ret; } From patchwork Tue Apr 27 10:12:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428203 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 71C3DC43461 for ; Tue, 27 Apr 2021 10:14:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40FA361002 for ; Tue, 27 Apr 2021 10:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235192AbhD0KO7 (ORCPT ); Tue, 27 Apr 2021 06:14:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:34658 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235388AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5558D613F8; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=9FSuKWFuUqPUC2dP9taAm5sC7kLWnC4fEOP9jl+QpYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R47c1M22tqSI8Jnfr6aBep3cHvKDHKV42ga5GGGwTWOomTRX2sd1VLlytHRTxVtxU jk/z6gS3yclr+k/GXUtG2dfJ3ZO11CMWy7CT3kdrK3/SY0H7msDqE9+xYY0LsZtPun iNYoxyIcwB0udC211DxVJ8KS6fizHfV/ozy27r8W+sJXzgbjI+iNke5WSVpIvW2eN0 rxQ1QddStM19J+El0ECTiAhRPZsSWCd22Bg8siolMAwkR+34Em0BR/hnepCNnDNpt9 uV/ZxlLPNmZZnnglVehEA7FVuu57ZR62gtt9q5mWwFNlJp3jGIpXlcpe1sE/54IYEg U100Kis1f3jQg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5h-3f; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Bingbu Cao , Greg Kroah-Hartman , Mauro Carvalho Chehab , Sakari Ailus , Tianshu Qiu , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 23/79] staging: media: ipu3: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:50 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- 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; } From patchwork Tue Apr 27 10:12:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428202 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 93E54C43460 for ; Tue, 27 Apr 2021 10:14:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59AA7613C5 for ; Tue, 27 Apr 2021 10:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235696AbhD0KPC (ORCPT ); Tue, 27 Apr 2021 06:15:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:34668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235398AbhD0KOf (ORCPT ); Tue, 27 Apr 2021 06:14:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 67D4D6140B; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=eeb2tTMTeECwFCJsmdUEhrGisH5F5adY0i6Xu5Zdqhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KExWx6rx38YnCkcfolMEeFFyC3f1GXJQvNGjOa8ISkbR1/jXcHswuOaPWK3laj6eV tt+pFqegEsZAdeviptiJOw9VCfKsCNbx2+MgXFGhQs5noEb5rkJP3m1hw+p9iqJofK rhCFOkmcpLsaPSr/wIlK7zdmr2bsOJVytIIhT2Z9OKvSV0hEshOvzH6lyd6K1o4SsO k6xxJzUCmJVj4MLfedSVbX2lXO9sq8h9TS+Avkw1cYti/1+TNpExRUMgIkYjFeVR3P Uk0fA3aSskJvOk/fxln8CRVBHdUUahj3tHLe4pF5YQ8MbFbVImnqsNFYpxlaLWIosK Fmk+pGKIlDyog== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5n-7g; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Dmitry Osipenko , Greg Kroah-Hartman , Jonathan Hunter , Mauro Carvalho Chehab , Thierry Reding , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 25/79] staging: media: vde: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:52 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/staging/media/tegra-vde/vde.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/tegra-vde/vde.c b/drivers/staging/media/tegra-vde/vde.c index 28845b5bafaf..8936f140a246 100644 --- a/drivers/staging/media/tegra-vde/vde.c +++ b/drivers/staging/media/tegra-vde/vde.c @@ -775,9 +775,9 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, if (ret) goto release_dpb_frames; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) - goto put_runtime_pm; + goto unlock; /* * We rely on the VDE registers reset value, otherwise VDE @@ -843,6 +843,8 @@ static int tegra_vde_ioctl_decode_h264(struct tegra_vde *vde, put_runtime_pm: pm_runtime_mark_last_busy(dev); pm_runtime_put_autosuspend(dev); + +unlock: mutex_unlock(&vde->lock); release_dpb_frames: @@ -1069,8 +1071,8 @@ static int tegra_vde_probe(struct platform_device *pdev) * power-cycle it in order to put hardware into a predictable lower * power state. */ - pm_runtime_get_sync(dev); - pm_runtime_put(dev); + if (pm_runtime_resume_and_get(dev) >= 0) + pm_runtime_put(dev); return 0; @@ -1088,8 +1090,9 @@ static int tegra_vde_remove(struct platform_device *pdev) { struct tegra_vde *vde = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; + int ret; - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); @@ -1097,7 +1100,8 @@ static int tegra_vde_remove(struct platform_device *pdev) * Balance RPM state, the VDE power domain is left ON and hardware * is clock-gated. It's safe to reboot machine now. */ - pm_runtime_put_noidle(dev); + if (ret >= 0) + pm_runtime_put_noidle(dev); clk_disable_unprepare(vde->clk); misc_deregister(&vde->miscdev); From patchwork Tue Apr 27 10:12:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428196 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 47FF7C43461 for ; Tue, 27 Apr 2021 10:14:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19A8A613CA for ; Tue, 27 Apr 2021 10:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235364AbhD0KPP (ORCPT ); Tue, 27 Apr 2021 06:15:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:35422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235430AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C6D8161442; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=Brp5bgVOD7UqAef4tVuj+33Q8jgTwnd/UQoPNRzNrhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a2OZ6v1gRfGGO3OQiD+Tb33Z+AHzcj0dztciHtEW+Cj9G3+tjVJRzCZj37ejEPzSX Yx0k7N7+rmSl/KYCFWqVXyGpWjkDpjBNkPBbblDdw3NBsrpHPzqJkppNx/oe6ehNMU +Q8DOhs5J3NXnoERt5w9HJx0LhhmnE+eYkcWrbMlfyuRLFOwr8Tc07uAUtoEjQbeFv byPg5AE34dheN24ErtSF/PxlJAskrJSTtdurfZ4INggqcjgx3EUap7qkH2SD+HqZ4I SagYnZOXbevqX5QGortcxmfQw7bNYXfcntUgKgThtWzp+Sz+4BR7lLWAcSozrqF4ha hPclnOX9XyxJw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5z-Fa; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 29/79] media: i2c: ccs-core: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:56 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ccs/ccs-core.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index b05f409014b2..8cce80557128 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -1880,12 +1880,11 @@ static int ccs_pm_get_init(struct ccs_sensor *sensor) struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd); int rval; - rval = pm_runtime_get_sync(&client->dev); - if (rval < 0) { - pm_runtime_put_noidle(&client->dev); - + rval = pm_runtime_resume_and_get(&client->dev); + if (rval < 0) return rval; - } else if (!rval) { + + if (!rval) { rval = v4l2_ctrl_handler_setup(&sensor->pixel_array-> ctrl_handler); if (rval) @@ -3089,12 +3088,9 @@ static int __maybe_unused ccs_suspend(struct device *dev) bool streaming = sensor->streaming; int rval; - rval = pm_runtime_get_sync(dev); - if (rval < 0) { - pm_runtime_put_noidle(dev); - + rval = pm_runtime_resume_and_get(dev); + if (rval < 0) return rval; - } if (sensor->streaming) ccs_stop_streaming(sensor); From patchwork Tue Apr 27 10:12:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428199 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 BFBF9C433ED for ; Tue, 27 Apr 2021 10:14:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99F03613C5 for ; Tue, 27 Apr 2021 10:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235794AbhD0KPL (ORCPT ); Tue, 27 Apr 2021 06:15:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:34656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235423AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B02D46142C; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=yvRexqPmybCXcMQCunEHPJjJgD+ZEwM3R67ntrsgrMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N48R0GFKuE9aS9VZ00xqIAnZ5la2kqQKiP/4X0Qp5Yyt5HtGfGM1IbN0/zkX8FGLk 4a81uocMMblj/95zyrWreBFQPPrsVQpGmVGfXEFV6GoQLc6G8qD6g8pQNtXny5MtyX 62PTMvSfsxlorZHR4uL2mBAENrMjhcTokXsvx5f7XfyDSGDzpGR8U2ktTk/2K2FXIe fpde5WJAXXcSO8fo6J7Ov49iYjsBU/3TqC4ZqpsOfejbolb9RXA67kXolXZFh6xAI8 an8SDqMC+ZwGzdMiz3MCWlNrXHuM7iZ8AimK/BhyiExiUVa6x01GdZ2w6EXOypXz3O kwao0D2OgpLIA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j62-IH; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 30/79] media: i2c: dw9714: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:57 +0200 Message-Id: <8021ba367d5bd9ae02a8ae0d18323d3181ed2644.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/dw9714.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index 3f0b082f863f..c8b4292512dc 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -85,15 +85,7 @@ static const struct v4l2_ctrl_ops dw9714_vcm_ctrl_ops = { static int dw9714_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - int rval; - - rval = pm_runtime_get_sync(sd->dev); - if (rval < 0) { - pm_runtime_put_noidle(sd->dev); - return rval; - } - - return 0; + return pm_runtime_resume_and_get(sd->dev); } static int dw9714_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) From patchwork Tue Apr 27 10:12:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428198 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 3CB59C43462 for ; Tue, 27 Apr 2021 10:14:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16AC0613D7 for ; Tue, 27 Apr 2021 10:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235824AbhD0KPM (ORCPT ); Tue, 27 Apr 2021 06:15:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:34864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235425AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B4FF461433; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=0+qUTNue9hnyAq3YJfJJPyrh70EsjiwzWG3y47ywjxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J4ONUu70heY1RZmS/I3mxnEG/VIJ856b0NmRgjgVlVaABKOTYSy19WX/Rou3RI6TZ Dj3rh+h8FahVzN/UQARVcBGNw3g4Lq5zbO/cTaMKT26NtseHWBXT1pwPA3WCI5em2P KE+/o1hfqQv9E+VQjl0QLpTefmTm5QtXtOrhYbnhKfXnNWj+oEnwPFY5S7Oq+rq74n c/gBxW6lEQfmzXggv+1A36vRjqLF1IhnMKIVh9lvd34fbLz8is/6ojhEf/HAkN37CI kH2KXbpplN1X46PtVXtrnAIn+BKvdXTKJhcqBd31j//DeZGqHHrbNszEgN+8xlpXcU N2lV3S3IConIA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j65-KC; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Dongchun Zhu , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 31/79] media: i2c: dw9768: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:58 +0200 Message-Id: <951f9765516074475e30e10dd56ab7184873e77a.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/dw9768.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/media/i2c/dw9768.c b/drivers/media/i2c/dw9768.c index 8b8cb4b077b5..c086580efac7 100644 --- a/drivers/media/i2c/dw9768.c +++ b/drivers/media/i2c/dw9768.c @@ -374,15 +374,7 @@ static const struct v4l2_ctrl_ops dw9768_ctrl_ops = { static int dw9768_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - int ret; - - ret = pm_runtime_get_sync(sd->dev); - if (ret < 0) { - pm_runtime_put_noidle(sd->dev); - return ret; - } - - return 0; + return pm_runtime_resume_and_get(sd->dev); } static int dw9768_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) From patchwork Tue Apr 27 10:12:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428197 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 95164C433ED for ; Tue, 27 Apr 2021 10:14:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 74D4A613CF for ; Tue, 27 Apr 2021 10:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235970AbhD0KPO (ORCPT ); Tue, 27 Apr 2021 06:15:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:35420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235428AbhD0KOg (ORCPT ); Tue, 27 Apr 2021 06:14:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B90D061434; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=8oeNDL2f6ftikmJG74aEJuwd7JVkpDOtWW3l23y+D78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqesKJyKrMAdTssMF7Aa8+Ek9CtV9tgitsOLduPiW/WYrOB8jQOrSiCzY4J1t+7yx KINzdGrbpIxuQqp48Sz3mtNdvD8MIux3CNKenoYKVZ920TdwZB4idanqwWyPYWDuxk QQ6xaWiHO8AH2AJ8vGW8NTDXCFsMEajz94fO39YSzqvpUyDtFmrf6U6UtQSwzpv3ju PBraetRoank1nM7DnkYFxDgUE3MwhARoHqyh53ySCYFXOHPLpxDulgZB46Ufiv8wEg 5BR2CikO08hSbWlZ8tJzVtO5HfIaLyUDVMtyVCUW+21fIrQSvof2WkTAIByzDRE/Iz H23GU8Tjptu4w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j68-MC; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sakari Ailus , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 32/79] media: i2c: dw9807-vcm: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:59 +0200 Message-Id: <7c146960ca8dc8f89b70bdb419d1dad51f686e3e.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/dw9807-vcm.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/media/i2c/dw9807-vcm.c b/drivers/media/i2c/dw9807-vcm.c index 438a44b76da8..95e06f13bc9e 100644 --- a/drivers/media/i2c/dw9807-vcm.c +++ b/drivers/media/i2c/dw9807-vcm.c @@ -130,15 +130,7 @@ static const struct v4l2_ctrl_ops dw9807_vcm_ctrl_ops = { static int dw9807_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { - int rval; - - rval = pm_runtime_get_sync(sd->dev); - if (rval < 0) { - pm_runtime_put_noidle(sd->dev); - return rval; - } - - return 0; + return pm_runtime_resume_and_get(sd->dev); } static int dw9807_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) From patchwork Tue Apr 27 10:13:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428195 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 80FA5C433B4 for ; Tue, 27 Apr 2021 10:14:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 56E4761185 for ; Tue, 27 Apr 2021 10:14:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235603AbhD0KPS (ORCPT ); Tue, 27 Apr 2021 06:15:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:34882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235443AbhD0KOh (ORCPT ); Tue, 27 Apr 2021 06:14:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 104C861451; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=nPYpAR91E3rgdblnM1RIaAoqqFVi+fAvcFwJJ6A4j/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nyB7zNaYGZV4naMl/LDAOORTpR91EAqBlvt0LS0ik3sdNk7RtxwJ+auTC0lI5nRoO pAA/5g7xCxr1fwn0XCfeGxu6yY5BRWLO1ie2M1hB4k/rxhpbl/Nl3WKmudUyFqBwQo sSFoiVIj+WjEaFifqL71B7K06MfMPpqcVjgmY6Na7x/6Kunoej8tnrywf5fpuuJQ8q DmCf2Crusd8EMQ9k3C81MVmLdcFJc/X7kBN0EJ2iUaH8ErsUjpfqaG21S6ywV/6o8N th481aO8jWp0YwHn1Q6ATUJEnmEhVBMUsTLmufHKDyeA58HzfYRh5AstGIniguHOH+ puWq4rbDC5akg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j6H-Rv; Tue, 27 Apr 2021 12:13:49 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Dave Stevenson , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 35/79] media: i2c: imx219: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:02 +0200 Message-Id: <7766f23539a0a12f8e76cc01477cbcdc6013574d.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/imx219.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 1054ffedaefd..74a0bf9b088b 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1035,11 +1035,9 @@ static int imx219_start_streaming(struct imx219 *imx219) const struct imx219_reg_list *reg_list; int ret; - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) return ret; - } /* Apply default values of current mode */ reg_list = &imx219->mode->reg_list; From patchwork Tue Apr 27 10:13:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428192 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 3CC24C43460 for ; Tue, 27 Apr 2021 10:14:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0A296613C3 for ; Tue, 27 Apr 2021 10:14:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235631AbhD0KPc (ORCPT ); Tue, 27 Apr 2021 06:15:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:34862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235436AbhD0KOh (ORCPT ); Tue, 27 Apr 2021 06:14:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0800C6144E; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=RKkiGoCDSW3lMHxV9n7JS+4PruB0khbogVRD1m+DqBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W6VDr6dwIJolCY10j21zp1uwzMJ0eHGRXGAUPe0G3g76CHmhQ4dcPDDS0WKLBzjKr azh3dTGR8k4GrtVdFU7HGW3hwLAKDrnjnF1i06zvSblzjZ+NBuHUgsB6ZPTeJGU56j AUWBd67x3D4W0YwsBHly4M5V8nrnOZVj06Zw0TgRv62SAaSWYeLDu6XJza6dt4zeQc cekbm5ps+D+8ZxMVq10zcsaCXw1kcuhUPBh3VgJ3gc9YIcujOUFQAoNxb+YfxDIS0N rbL8GgQtiAv6Tc/0dNfEHrOEy3p+5ufIvJFzJT8RYkqN6RGiOI1kRTSHJLvZYvpTVl AfzW1wZ6uMQDg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j6N-W0; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Leon Luo , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 37/79] media: i2c: imx274: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:04 +0200 Message-Id: <85bafd645269ad1e5392e7e113483563e28a072f.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/imx274.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/i2c/imx274.c b/drivers/media/i2c/imx274.c index cdccaab3043a..ee2127436f0b 100644 --- a/drivers/media/i2c/imx274.c +++ b/drivers/media/i2c/imx274.c @@ -1441,9 +1441,8 @@ static int imx274_s_stream(struct v4l2_subdev *sd, int on) mutex_lock(&imx274->lock); if (on) { - ret = pm_runtime_get_sync(&imx274->client->dev); + ret = pm_runtime_resume_and_get(&imx274->client->dev); if (ret < 0) { - pm_runtime_put_noidle(&imx274->client->dev); mutex_unlock(&imx274->lock); return ret; } From patchwork Tue Apr 27 10:13:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428186 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 43267C43460 for ; Tue, 27 Apr 2021 10:15:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1458160C3D for ; Tue, 27 Apr 2021 10:15:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235542AbhD0KP4 (ORCPT ); Tue, 27 Apr 2021 06:15:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:35440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235558AbhD0KOq (ORCPT ); Tue, 27 Apr 2021 06:14:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E942161864; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=6SWDMHkSlrYNzq7GtPd5DH9pbQJCAbHbxO2AKYAv8vU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MK11RwPeirCdiAyVUeqqhauMMB1T+1sNT0tn7okuvx+uNHbHNP9KJ6+MPTKTqAnwI mVbYJFubDdrYxX0Cato53OfyH0hn4syrPQoKowBGLkPR47JVzeYYlHWEZKJYUE5zkw Fd4Z65y9BIvDIpHzb9j0fNpbAY6RsyPyNc1xEmGUIBDVi4gm/yDklFrLuxtvqgQP2K MrrRoTvlk+cpjQpuRhiy84ZOlAxM8JGhwrDQWu2/qUV0siPS8MWroN76+Jo3JYcRKo ULHz1o9nIJQa6q9g0pC8762lzZ2j5Zfag5E9DwxG7Lrqz12oKjSzs/N3CjV5lDDhve f2zD/UKPoafpA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j6T-3i; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Bingbu Cao , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 39/79] media: i2c: imx319: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:06 +0200 Message-Id: <7dc45e7be7d808d638029dd515e972f9ec184f04.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/imx319.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c index 38540323a156..4e0a8c9d271f 100644 --- a/drivers/media/i2c/imx319.c +++ b/drivers/media/i2c/imx319.c @@ -2141,11 +2141,9 @@ static int imx319_set_stream(struct v4l2_subdev *sd, int enable) } if (enable) { - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) goto err_unlock; - } /* * Apply default & customized values From patchwork Tue Apr 27 10:13:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428194 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 2B934C433ED for ; Tue, 27 Apr 2021 10:14:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBFFF6101D for ; Tue, 27 Apr 2021 10:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235319AbhD0KPX (ORCPT ); Tue, 27 Apr 2021 06:15:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235461AbhD0KOi (ORCPT ); Tue, 27 Apr 2021 06:14:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7914C61481; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=3LPMYGviydz+wxD+uX1CWPHMq2PRxZGRtXrIww4fEeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P4/sMCZmQma9tcVvBc4t9EiLg6Z7EutWJstWPyPLYZs0vmruKhH86XLPF+7PHB0Xf +UOjDCvloUFlj0PSKUjXqL9whebZ4iwYVejxNmLWF29XgXpJvus8lH9cDSsR9LB906 mRnLPr4yuinFa74nbjytbDZGioxYvkQe0yAs/tsdnNYRaz46SuykdZj43A1fITgG2L pHbHz8E3PBsX8ndg+SSyFnUpARaULxBLHeK0rpfc0Cw7vBCzz8EGqVsDYNG19HIplZ OEW4P117Jbts+nbclxj5PNlCuAnLRgYUbVt5luxvubtILktZKDpgciaHQs7BTlDeNH 72A3WlGbEg3+g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j6c-9V; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Hans Verkuil , Jacopo Mondi , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 42/79] media: i2c: mt9m001: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:09 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/mt9m001.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/mt9m001.c b/drivers/media/i2c/mt9m001.c index ac1b380e6c03..2867f64e357d 100644 --- a/drivers/media/i2c/mt9m001.c +++ b/drivers/media/i2c/mt9m001.c @@ -217,9 +217,9 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) goto done; if (enable) { - ret = pm_runtime_get_sync(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); if (ret < 0) - goto put_unlock; + goto unlock; ret = mt9m001_apply_selection(sd); if (ret) @@ -247,6 +247,7 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) put_unlock: pm_runtime_put(&client->dev); +unlock: mutex_unlock(&mt9m001->mutex); return ret; From patchwork Tue Apr 27 10:13:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428193 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 BC7B2C433B4 for ; Tue, 27 Apr 2021 10:14:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CBFE61185 for ; Tue, 27 Apr 2021 10:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237250AbhD0KP1 (ORCPT ); Tue, 27 Apr 2021 06:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbhD0KOi (ORCPT ); Tue, 27 Apr 2021 06:14:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C63161483; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=rXQEV5ur3+5U6VOB8wAB6dlcXqNLqRBsrKFm5rfs1io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=szVe35+bLgjyH6l1NqRVWynHhvytkpdYReylGWe3GRQZMyhZ/vlKDhmWM1puNJVpW BrCUAceuJ8ssd3slAfF5+m5LAsTaY3r/SZQp2r1rqSnu0Ra8rNrQbuFVFnklrg92vL noKJxUBGz+hGhpXdajy8vzMcrGpsOk1KJcTEGeg9EtLATK0E5zzyrt4Zo8kLUO4zlT QUQt43j2aikmCdvsygC2/xBd/3Bsua2DDbsdPgEwI1+/PlA6r/0Obxi1/dJV/22dhT 9It0w4zN2n1J2Avc/i5a+nSVElnNLrO2KiWCGCCnxHWe54izZhtHFaYD2eq6h2TtY7 YISNkHSECuW+g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j6f-At; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Dongchun Zhu , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 43/79] media: i2c: ov02a10: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:10 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov02a10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov02a10.c b/drivers/media/i2c/ov02a10.c index c47b1d45d8fd..a1d7314b20a9 100644 --- a/drivers/media/i2c/ov02a10.c +++ b/drivers/media/i2c/ov02a10.c @@ -540,11 +540,9 @@ static int ov02a10_s_stream(struct v4l2_subdev *sd, int on) } if (on) { - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) goto unlock_and_return; - } ret = __ov02a10_start_stream(ov02a10); if (ret) { From patchwork Tue Apr 27 10:13:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428191 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 EE09AC433ED for ; Tue, 27 Apr 2021 10:14:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5064613C6 for ; Tue, 27 Apr 2021 10:14:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237463AbhD0KPf (ORCPT ); Tue, 27 Apr 2021 06:15:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:35166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235488AbhD0KOl (ORCPT ); Tue, 27 Apr 2021 06:14:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8591661494; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=zHjujpboN+Iu7V2XpqIB+1lLAb+rrUx5c1q69NYA2sw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7u+rAp/uxjkX46X8E9ZzzGAMoslnLL7F169mE61VT+kX/ZRdhf7ZnF5sd+d/HpmA 5r+5N6/7U1L3JUZMBLeNez6D2RRHcIOCXHnPYirPdhQvzyXemdsQcA1jGeN9VfnAGs qe3NMhqaYvAxszbN0P45tQ4tPa6lMAcLesoPyX2mLwMihD4ceR6NzqN8rod0CrYJy1 /+82ptY9RNJouCWBQDQ/77A3GNYnIPO+uj7k8MfXuquGC43it6G6R2YuhMvxVcCgVQ 2LzaSASZDdvEh9bOsKGMuXqoxSzF/9qinF1LXxM/g4PxRuYOiRUwxwkxQe12Mn/GAQ KUlza7FxtNNew== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j6o-GB; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Shunqian Zheng , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 46/79] media: i2c: ov2685: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:13 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov2685.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov2685.c b/drivers/media/i2c/ov2685.c index 49a2dcedb347..2f3836dd8eed 100644 --- a/drivers/media/i2c/ov2685.c +++ b/drivers/media/i2c/ov2685.c @@ -456,11 +456,10 @@ static int ov2685_s_stream(struct v4l2_subdev *sd, int on) goto unlock_and_return; if (on) { - ret = pm_runtime_get_sync(&ov2685->client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&ov2685->client->dev); + if (ret < 0) goto unlock_and_return; - } + ret = __v4l2_ctrl_handler_setup(&ov2685->ctrl_handler); if (ret) { pm_runtime_put(&client->dev); From patchwork Tue Apr 27 10:13:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428190 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 22F1EC433ED for ; Tue, 27 Apr 2021 10:14:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E633861185 for ; Tue, 27 Apr 2021 10:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237490AbhD0KPh (ORCPT ); Tue, 27 Apr 2021 06:15:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:35230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235504AbhD0KOm (ORCPT ); Tue, 27 Apr 2021 06:14:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9329061554; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=umqdpGp1oSGyna8Ojn3AGfbapFLyE4ZVzg1c+rmxXd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/QaYm0kr8vX9BgjUd02/cY1pWxgrNsO+MXcd0JupGjgj77iwV8BkWJvCpqmAIruQ hmDJFLHdTdk7QD5iroeoNefI8pi3RTTjDK0ZG34edBFTNItxX8YFbfnix2Yc9ASZjN oMYGiYyq4zOofDXNb7UtbEt+NFZG4xNtvDA6VTwvpg8Goo83f7AbHPDUFbUTCnzdxW 8P81dTjNzts0IdtAN99ft8QLWJT3ipr0YC0/n/Bur3SRIQHvkR7ICjhkYRZc2XrQcc JJoSJwejv5GWzILATevpGnDfmiwT2d+Kctd0EKP+qw9FSjT/M8kfcCXSq+KV7GNp/R c0eZ2XCjiQYMQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j6r-Hu; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Bingbu Cao , Mauro Carvalho Chehab , Shawn Tu , Tianshu Qiu , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 47/79] media: i2c: ov2740: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:14 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov2740.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index 0f3f17f3c426..54779f720f9d 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -751,9 +751,8 @@ static int ov2740_set_stream(struct v4l2_subdev *sd, int enable) mutex_lock(&ov2740->mutex); if (enable) { - ret = pm_runtime_get_sync(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); if (ret < 0) { - pm_runtime_put_noidle(&client->dev); mutex_unlock(&ov2740->mutex); return ret; } @@ -1049,9 +1048,8 @@ static int ov2740_nvmem_read(void *priv, unsigned int off, void *val, goto exit; } - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { - pm_runtime_put_noidle(dev); goto exit; } From patchwork Tue Apr 27 10:13:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428187 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 8A4C7C433ED for ; Tue, 27 Apr 2021 10:15:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53CA76101D for ; Tue, 27 Apr 2021 10:15:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235717AbhD0KPu (ORCPT ); Tue, 27 Apr 2021 06:15:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:34866 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235547AbhD0KOp (ORCPT ); Tue, 27 Apr 2021 06:14:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B3CB961629; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=k96A/wu5csXQdkebmEvDXUWzQhtBwXxGUFyh7/8ot0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hw4dgbLVADycQmdwmHlF1MyUVQiS1hu3Vu2aRwx9iTTDx3mYKwdlTkSei6anYnR4i MFm4eXqjy/rWXt0RFHjilmUhBOGp+lYq/j5iC5rEUjuQzrmqa9J4KN7F0I2mvut6YV DwW5NfxLCTE0VoPjZKpArSziwMXVrwvsGDc8zCBwsCglTCjmYhDxl7VDDbYa6kUrxm j3IRqHWb2JafB3MYxx72259pIiLtOWBNJDg+0Va7AVyrlxIwPzzyjbSE7Lty2J38TO xm7sUJzfMfDWdwyIpFL7uwYm7t4WLkw7H3G9pTj/c5tafKwIw+OQlXd+4dVVUA818P GmFiti49uZctg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j70-Nf; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Chiranjeevi Rapolu , Hyungwoo Yang , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 50/79] media: i2c: ov5670: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:17 +0200 Message-Id: <1e549236f4e48a6ab8dacbf0d3e19d059f11fa51.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov5670.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index dee7df8dd100..182f271f118f 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2347,11 +2347,9 @@ static int ov5670_set_stream(struct v4l2_subdev *sd, int enable) goto unlock_and_return; if (enable) { - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) goto unlock_and_return; - } ret = ov5670_start_streaming(ov5670); if (ret) From patchwork Tue Apr 27 10:13:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428189 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 26B7FC43460 for ; Tue, 27 Apr 2021 10:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F0ED36101D for ; Tue, 27 Apr 2021 10:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235639AbhD0KPi (ORCPT ); Tue, 27 Apr 2021 06:15:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:34660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235530AbhD0KOp (ORCPT ); Tue, 27 Apr 2021 06:14:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A3D3961606; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=9V28x/0yZtyv8nyV8uH7fSioPt4mARji1tVhL7JUs2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdxzXEI5OVxGEVs1HfWhvEf7coejpuy3bX1jNgtvmn0OaL2G9p62heiGIexGShTLy isnzKD6LG6KNfE/XNSvLJ4k6sL7UzMcdbKog6b86iju9Q7gsBQihvcyq3cHG9RTC4M Wh3jcydfUA3KOueIv05a/Bg3ONeNam7TxWGWoxDWLKMn+OzMrUq1lA803wwKycM+T1 TxnrVlOzQFgt5IlFQXM5zmxCSmZnO4ivJnuWhHuSAR2NXFppSPLuEqNIKzMK//BNEp QEDaCltVZn5VrWPlZtXIbr3V/5FizPlydJVjJB2nU5BP3GtZ72IqijLY8nKA4hiD3v gHKp56BqoSFEg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j76-R4; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Shunqian Zheng , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 52/79] media: i2c: ov5695: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:19 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov5695.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index 09bee57a241d..469d941813c6 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -946,11 +946,9 @@ static int ov5695_s_stream(struct v4l2_subdev *sd, int on) goto unlock_and_return; if (on) { - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) goto unlock_and_return; - } ret = __ov5695_start_stream(ov5695); if (ret) { From patchwork Tue Apr 27 10:13:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428188 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 B75F6C433ED for ; Tue, 27 Apr 2021 10:15:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B03B613C3 for ; Tue, 27 Apr 2021 10:15:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237658AbhD0KPr (ORCPT ); Tue, 27 Apr 2021 06:15:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:34864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235540AbhD0KOp (ORCPT ); Tue, 27 Apr 2021 06:14:45 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB6BA6157E; Tue, 27 Apr 2021 10:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518432; bh=jUMHPV3bIyEEarOloeBBF8gl6HQ5pp77fQglK6LRWcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIb7+lce1FnQh5HyJ9fE7hXJYauthNRRWT125eY/rKxqY4mA5g/ayIzEvuax1XvIW CYllTa6MKMaThVXXVDxCTMr32RKUTi5SVfSR1OLFrkOWX8QrdvJEO3Pc2cLIl5+Kk9 Tr5PHldCihlHiNqZDzoWJurSqXtyBwANLW8cPNXzxOQanPX8rAgQwZhLQ/aY/DUZ2B fIFS1HoKXg5xG0OWpGjAEEt6t/H2EkxTmmN/FVua/Xt+HJAXXsc5lx4i1R1D35OXv+ bdnbYOYbDcsMZzEhZIZ2ayHEHUm9lsfCehQbeajUBzIOdBBup6roz+JLCkGyRn/MqM 44L8p7lkMtTbA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj0-000j79-T2; Tue, 27 Apr 2021 12:13:50 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Wenyou Yang , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 53/79] media: i2c: ov7740: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:20 +0200 Message-Id: <1e08b1b29b49c9c390d29718328f6e53c9310798.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/ov7740.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c index ed6904b2e8f5..74219f67f245 100644 --- a/drivers/media/i2c/ov7740.c +++ b/drivers/media/i2c/ov7740.c @@ -624,11 +624,9 @@ static int ov7740_set_stream(struct v4l2_subdev *sd, int enable) } if (enable) { - ret = pm_runtime_get_sync(&client->dev); - if (ret < 0) { - pm_runtime_put_noidle(&client->dev); + ret = pm_runtime_resume_and_get(&client->dev); + if (ret < 0) goto err_unlock; - } ret = ov7740_start_streaming(ov7740); if (ret) From patchwork Tue Apr 27 10:13:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428185 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 E31AEC433B4 for ; Tue, 27 Apr 2021 10:15:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB88F6101D for ; Tue, 27 Apr 2021 10:15:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237759AbhD0KQE (ORCPT ); Tue, 27 Apr 2021 06:16:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:35522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235577AbhD0KOr (ORCPT ); Tue, 27 Apr 2021 06:14:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FC1F61883; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=hgVIRXIaDP3qryP6Ow1GN4bGxSo94x3BXa49gnOI5oU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLqoAGCfIL2OxVF4O1wFYsX4vv+YDrtXpUlPSG89NjnuWXuWVfchPC9BvNe1g4nW0 d2WMATiDQbGC51S+BV1vqBiBKSkssy/SwRZge9UDOl7Lh9m3dn/8zZycicXvMCSh1K baePTv9eIiGJE5e16PRSv+b7SYKcQFJ7RFj7q6Zs8kc5Ze42Steiztc6kXJS7ujIbS USJYcXCqXjNCZBXuDDwTvz88yjMYUMJuRQ4KQYnA/Mx7U4NH4342I802FtBupvP3WQ 6rx9zSlKmgc7UEhA7nDLPoiG31ZgNqu7nMGFhbwGH7F+EX2QaPlhuAGpX7OnU/2R7P MVqMUU9c42uVw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7O-7G; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Matt Ranostay , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 58/79] media: i2c: video-i2c: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:25 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/i2c/video-i2c.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index c9a774f4c8d2..910a139c5e14 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -286,11 +286,9 @@ static int amg88xx_read(struct device *dev, enum hwmon_sensor_types type, __le16 buf; int tmp; - tmp = pm_runtime_get_sync(regmap_get_device(data->regmap)); - if (tmp < 0) { - pm_runtime_put_noidle(regmap_get_device(data->regmap)); + tmp = pm_runtime_resume_and_get(regmap_get_device(data->regmap)); + if (tmp < 0) return tmp; - } tmp = regmap_bulk_read(data->regmap, AMG88XX_REG_TTHL, &buf, 2); pm_runtime_mark_last_busy(regmap_get_device(data->regmap)); @@ -512,11 +510,9 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) if (data->kthread_vid_cap) return 0; - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_noidle(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) goto error_del_list; - } ret = data->chip->setup(data); if (ret) From patchwork Tue Apr 27 10:13:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428184 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 CD89FC43460 for ; Tue, 27 Apr 2021 10:15:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94C1860FF1 for ; Tue, 27 Apr 2021 10:15:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235747AbhD0KQI (ORCPT ); Tue, 27 Apr 2021 06:16:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:34910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235582AbhD0KOr (ORCPT ); Tue, 27 Apr 2021 06:14:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 205886191E; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=WMp2TYCwNpx5gqoBY3FxSLCFIcbo/CZW59R5D62z+MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lf0kshXPK/rxqeTBI355c54YmL5dHtYmnPWjeN34v1sBREFxEAlBS1lNBlb2PTjq6 di2EqkvfryMOgFlSKNQfzSWGSkQA5FkD4TnFZToTpWQCQOYALVk/PRkQZ8poivnKNj qoSP9BAt9wZpojA4ExnskRHcRjy/YaaGmfffGAMPoXEyZhKJthkPPA8dFXO55IHAVn EAfSraa5n4DVu6KaxADyMkldS0dWdNalNSe5jlWJbeNvthXLN+V5dfzn7MviVmeCnq 51xPZdBmtA58Ob0j4YE6jqAdMsTGijzJOWp9vP8c4RM3lJKGnXNwWPjBQD8FKWLNfX apErN54b7iO4w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7U-Bj; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Bingbu Cao , Dan Scally , Mauro Carvalho Chehab , Sakari Ailus , Tianshu Qiu , Yong Zhi , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 60/79] media: ipu3: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:27 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c index fecef85bd62e..ca8040d1a725 100644 --- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c @@ -975,10 +975,9 @@ static int cio2_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) cio2->cur_queue = q; atomic_set(&q->frame_sequence, 0); - r = pm_runtime_get_sync(&cio2->pci_dev->dev); + r = pm_runtime_resume_and_get(&cio2->pci_dev->dev); if (r < 0) { dev_info(&cio2->pci_dev->dev, "failed to set power %d\n", r); - pm_runtime_put_noidle(&cio2->pci_dev->dev); return r; } From patchwork Tue Apr 27 10:13:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428182 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 07202C433ED for ; Tue, 27 Apr 2021 10:15:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2A9461185 for ; Tue, 27 Apr 2021 10:15:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235401AbhD0KQT (ORCPT ); Tue, 27 Apr 2021 06:16:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:34668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235596AbhD0KOt (ORCPT ); Tue, 27 Apr 2021 06:14:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4995C61929; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=TKtKuWw4arj9gE1QW5A97zHnmgQIngfUHjaR8gvLIr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXnGRQfdAOPG4LJPaz3UjdbjxgfUeP8HomujIYINFkYzY4GB4o8CWCVIW2GR3ELGc 5VGBnYyV04LVREAkDn5MotNmwlQp6dsIqISTpDhAd0dhDLLIGNBe2Gjae0SAUi4ROq mGKXux/PbUCtrheYJMPCFBkmymM9RYnDn7xFnsaP9dFf5uBgC8V34u5OROpWfcBFAd fGqm160n6TzCGEFuhYSOSkSzR9TUP4iZTOz7JlU8tNCOFCEkc0S2vMUYHbZbwtWV55 OcMo3vIL2HzqIFRk11Kbv5ZxQXw7dRpm98Taptk8whbD+RAHd8tH1iIy/UOaMML6X5 KN+ZVDA5jsD6g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7d-Gj; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Ezequiel Garcia , Hans Verkuil , Krzysztof Kozlowski , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 63/79] media: exynos-gsc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:30 +0200 Message-Id: <6ba2ed04d791b8a1529977920bcc3930c2f3238e.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 27a3c92c73bc..09551e96ac15 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -58,7 +58,7 @@ static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count) struct gsc_ctx *ctx = q->drv_priv; int ret; - ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev); + ret = pm_runtime_resume_and_get(&ctx->gsc_dev->pdev->dev); return ret > 0 ? 0 : ret; } From patchwork Tue Apr 27 10:13:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428181 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 37A5CC433B4 for ; Tue, 27 Apr 2021 10:15:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 01997613C3 for ; Tue, 27 Apr 2021 10:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235921AbhD0KQW (ORCPT ); Tue, 27 Apr 2021 06:16:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:35166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235644AbhD0KO4 (ORCPT ); Tue, 27 Apr 2021 06:14:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7270461938; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=yFrbiuMzKmSO2EB59CqfXqOC55Rsmsoj/bKyqfWPoH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M6FF5nC+bkkrAbystgc6xb3f1/hUtUmxxHMXYOfIJJVgBktpkIRnnedcMu4/kPpGE f88qodmBkmiDfCCTjFK+Bv42nGV3tbXucCfSS9aSnDjyJVY/r4gTlU0gzvxFPYK702 IKtIkGyJ9CFM8VYiJt6VXNhGdPbwm+SHCzloEO+SgyIuxPNxP5U6swIfO3jvtmbylt jnCiWQDoQ+ENNIp+PpWap4i126F549gc0Y6WA2zlPZ58Vnp/ci6Pu2diU6jp4m2bN4 U4FKkUMcUwvVTwrbXP3KpiWnlZ5iZZS/JwF77v1gaO4xt6+heMOm9hlfGt5JC0JwCJ aap35BmXi0Xlg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7m-Le; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 66/79] media: venus: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:33 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/qcom/venus/core.c | 30 +++++++++---------- .../media/platform/qcom/venus/pm_helpers.c | 10 +++---- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index fe63b9ab5b20..52760f045e1c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -84,11 +84,9 @@ static void venus_sys_error_handler(struct work_struct *work) container_of(work, struct venus_core, work.work); int ret = 0; - ret = pm_runtime_get_sync(core->dev); - if (WARN_ON(ret < 0)) { - pm_runtime_put_noidle(core->dev); + ret = pm_runtime_resume_and_get(core->dev); + if (WARN_ON(ret < 0)) return ret; - } hfi_core_deinit(core, true); @@ -110,11 +108,9 @@ static void venus_sys_error_handler(struct work_struct *work) hfi_reinit(core); - ret = pm_runtime_get_sync(core->dev); - if (WARN_ON(ret < 0)) { - pm_runtime_put_noidle(core->dev); + ret = pm_runtime_resume_and_get(core->dev); + if (WARN_ON(ret < 0)) return ret; - } ret = venus_boot(core); ret |= hfi_core_resume(core, true); @@ -313,21 +309,21 @@ static int venus_probe(struct platform_device *pdev) pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) goto err_runtime_disable; ret = of_platform_populate(dev->of_node, NULL, NULL, dev); if (ret) - goto err_runtime_disable; + goto err_pm; ret = venus_firmware_init(core); if (ret) - goto err_runtime_disable; + goto err_pm; ret = venus_boot(core); if (ret) - goto err_runtime_disable; + goto err_pm; ret = hfi_core_resume(core, true); if (ret) @@ -359,8 +355,9 @@ static int venus_probe(struct platform_device *pdev) v4l2_device_unregister(&core->v4l2_dev); err_venus_shutdown: venus_shutdown(core); -err_runtime_disable: +err_pm: pm_runtime_put_noidle(dev); +err_runtime_disable: pm_runtime_set_suspended(dev); pm_runtime_disable(dev); hfi_destroy(core); @@ -379,7 +376,7 @@ static int venus_remove(struct platform_device *pdev) struct device *dev = core->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); WARN_ON(ret < 0); ret = hfi_core_deinit(core, true); @@ -390,7 +387,8 @@ static int venus_remove(struct platform_device *pdev) venus_firmware_deinit(core); - pm_runtime_put_sync(dev); + if (ret >= 0) + pm_runtime_put_sync(dev); pm_runtime_disable(dev); if (pm_ops->core_put) @@ -411,7 +409,7 @@ static void venus_core_shutdown(struct platform_device *pdev) { struct venus_core *core = platform_get_drvdata(pdev); - pm_runtime_get_sync(core->dev); + pm_runtime_resume_and_get(core->dev); venus_shutdown(core); venus_firmware_deinit(core); pm_runtime_put_sync(core->dev); diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index c7e1ebec47ee..9e32ec866af7 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -486,7 +486,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) int ret; if (coreid_mask & VIDC_CORE_ID_1) { - ret = pm_runtime_get_sync(core->pmdomains[1]); + ret = pm_runtime_resume_and_get(core->pmdomains[1]); if (ret < 0) return ret; @@ -504,7 +504,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) } if (coreid_mask & VIDC_CORE_ID_2) { - ret = pm_runtime_get_sync(core->pmdomains[2]); + ret = pm_runtime_resume_and_get(core->pmdomains[2]); if (ret < 0) return ret; @@ -990,11 +990,9 @@ static int core_power_v4(struct venus_core *core, int on) if (on == POWER_ON) { if (pmctrl) { - ret = pm_runtime_get_sync(pmctrl); - if (ret < 0) { - pm_runtime_put_noidle(pmctrl); + ret = pm_runtime_resume_and_get(pmctrl); + if (ret < 0) return ret; - } } ret = core_resets_reset(core); From patchwork Tue Apr 27 10:13:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428180 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B2F6AC433ED for ; Tue, 27 Apr 2021 10:15:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AA7F613C3 for ; Tue, 27 Apr 2021 10:15:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235453AbhD0KQ2 (ORCPT ); Tue, 27 Apr 2021 06:16:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:35230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235648AbhD0KO5 (ORCPT ); Tue, 27 Apr 2021 06:14:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 783856193E; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=73B6Lks3AupUDrJCPSyBZhCBhq2sPf760XjzihM5LGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNaehuD9JL4nqBubNhvLrPbf5J1CSN6dWfCnz1EQzrzNAA0Tx0IROSrYfl+slfsop enTk1twl3CduQlgCpYUvrdPfnca3pFdlOo50REg5O0ONgKDIuWnUYOVKQPmD7IvrFc ksGL/TgoNbcEgChXyXxi7i0inXCEomz5wTogxgj279hB1ZOH/YT9Hdj7qR0d7E1Wg+ 9FVUW5pgTww6tpbf/qCZr0DpgT+Ry5TFchNwpDOvNuWBZ1azjnHKFj9acOPfiL1GUo w42tWSfQYsz+ccnpqH2N0x3bUXXMMlBOXQ90ire7MiqkKT73+CUj8HAJLgEQaIvjgE z4jYExZg8rsew== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7p-NZ; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 67/79] media: venus: vdec: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:34 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/qcom/venus/vdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index ddb7cd39424e..347e533ea673 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -568,7 +568,7 @@ static int vdec_pm_get(struct venus_inst *inst) int ret; mutex_lock(&core->pm_lock); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); mutex_unlock(&core->pm_lock); return ret < 0 ? ret : 0; @@ -601,7 +601,7 @@ static int vdec_pm_get_put(struct venus_inst *inst) mutex_lock(&core->pm_lock); if (pm_runtime_suspended(dev)) { - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) goto error; From patchwork Tue Apr 27 10:13:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428179 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 3BA9FC43460 for ; Tue, 27 Apr 2021 10:15:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 18A65613C3 for ; Tue, 27 Apr 2021 10:15:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235410AbhD0KQb (ORCPT ); Tue, 27 Apr 2021 06:16:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:34660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235745AbhD0KPJ (ORCPT ); Tue, 27 Apr 2021 06:15:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E67F61948; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=4l0wYnfzYi1h956EsgOdlzJmS/W0qfvo5eSm9fSkn9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dTj5/2g+IuretA4WWeKDmoFHFHBjS15TGHAABgAT6vT1tjWvN2eyDuu49l3Gwt2da TOXSj3AYurMZUu47PRrPLR35UWjYK1oTF2OQDM0SVSYM+x/rcSfkQUw/n+2AfIlvJU sCDCyJRycpNzbyQygvFVMBA1eNdadXIBsGULVeG/GTQzugoKvlBwSoKD+dE4938M9e qu9YoMveKc1YY7XA2veI4VIhBc7zsPnRTgp6zqZshJN77GRIa3/Tn4TlwACTv9yljW bZGUqzbVtPGxv4fSb7BDDauM28XU+hupk7UJ6AmARKC7KIgEvXMxMmo6sLbaYu3QeI NhNi5KFGegjVA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7v-R6; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Laurent Pinchart , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 69/79] media: rcar-fcp: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:36 +0200 Message-Id: <64bb917e946815f1c77bf2bb36614ff950a98631.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/rcar-fcp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c index 5c03318ae07b..de76af58013c 100644 --- a/drivers/media/platform/rcar-fcp.c +++ b/drivers/media/platform/rcar-fcp.c @@ -101,11 +101,9 @@ int rcar_fcp_enable(struct rcar_fcp_device *fcp) if (!fcp) return 0; - ret = pm_runtime_get_sync(fcp->dev); - if (ret < 0) { - pm_runtime_put_noidle(fcp->dev); + ret = pm_runtime_resume_and_get(fcp->dev); + if (ret < 0) return ret; - } return 0; } From patchwork Tue Apr 27 10:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428178 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 08250C433ED for ; Tue, 27 Apr 2021 10:15:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3439611F2 for ; Tue, 27 Apr 2021 10:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237838AbhD0KQd (ORCPT ); Tue, 27 Apr 2021 06:16:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:34864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235314AbhD0KPK (ORCPT ); Tue, 27 Apr 2021 06:15:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A85186194C; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=rChg/pXG2Qjbehywcb/+z5hE6+LFH66GvNnoCtLFEBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XSkxcPymxCcHvHCHnPGNTKlIe7N/iWkE12x5+iF06VhEniD4QeFLHL9o7KnQB+6gf z4w6rnmCHtOLpZfpsniFLxW1j67cKbiF5B3xZQMPX5VM+R6ZNBmTJnvUqrk+yUC9KL 25AEapb+FpzGnfeGIkYNUyaLx/9e0zpGHp6v2p2bMvObUY8EyraseE1M4pdSdy7Bxk drk2/1vsmSUype/gw8qJUaMh17jCJiAZmGkIge8RsuRJs+WJy4bkTwPUIlUOWMEMLf Nyxv9LZ/Zaq1kI+6vFlRV9c7q7XiWJWFVt3MBptI/LPv1d3x9yScwa3SsWg2HzjRab T5IhMmxNp2Uag== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7y-Sx; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Dafna Hirschfeld , Heiko Stuebner , Helen Koike , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2 70/79] media: rkisp1: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:37 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index 5f6c9d1623e4..3730376897d9 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1003,9 +1003,8 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) if (ret) goto err_pipeline_stop; - ret = pm_runtime_get_sync(cap->rkisp1->dev); + ret = pm_runtime_resume_and_get(cap->rkisp1->dev); if (ret < 0) { - pm_runtime_put_noidle(cap->rkisp1->dev); dev_err(cap->rkisp1->dev, "power up failed %d\n", ret); goto err_destroy_dummy; } From patchwork Tue Apr 27 10:13:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428177 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 5CD83C43462 for ; Tue, 27 Apr 2021 10:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EA7860C3D for ; Tue, 27 Apr 2021 10:15:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235652AbhD0KQh (ORCPT ); Tue, 27 Apr 2021 06:16:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:35420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235766AbhD0KPK (ORCPT ); Tue, 27 Apr 2021 06:15:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BCE7E61951; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=ORhYQV8MaIIM9QGoq0fv1DmSrG26N8/lfMtTN/XnDlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggOlyf1YNtPBHjycx93XL7+9/FJpqcXn1RjwwVtuYy1ppTBb8ut9ATtgAjEu8VsMg dWrKgO7UTs2MCJW1N6VISg4AC7FY/0wiaaiazic1WRTgT80Z/NS8jYHOO0qS2R31+J hMOrgznyM+GpxW3q1+L5g7lEKn14q7QYELvGFeUy8HBkH4HuK7XV8+5TcHl1uA+z+9 hQI2tiIwFeUBNt1vKOwUZBhM6BRIlZcOp3khK6HiPYabOMGMay6v113afJvBRGMOX7 6iOvJKql8hN36/6AgC6NaA3+A2zKAW2C+ArY7/nJQlgsMmJe+zEzHkaQ0V02zK2NSB qSnTGug2neRfA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j81-UR; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 71/79] media: s3c-camif: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:38 +0200 Message-Id: <77cb3497163bedc3a75555b4cca4cb980c7756b2.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/s3c-camif/camif-capture.c | 2 +- drivers/media/platform/s3c-camif/camif-core.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c index 9ca49af29542..62241ec3b978 100644 --- a/drivers/media/platform/s3c-camif/camif-capture.c +++ b/drivers/media/platform/s3c-camif/camif-capture.c @@ -547,7 +547,7 @@ static int s3c_camif_open(struct file *file) if (ret < 0) goto unlock; - ret = pm_runtime_get_sync(camif->dev); + ret = pm_runtime_resume_and_get(camif->dev); if (ret < 0) goto err_pm; diff --git a/drivers/media/platform/s3c-camif/camif-core.c b/drivers/media/platform/s3c-camif/camif-core.c index 4c3c00d59c92..e1d51fd3e700 100644 --- a/drivers/media/platform/s3c-camif/camif-core.c +++ b/drivers/media/platform/s3c-camif/camif-core.c @@ -460,9 +460,9 @@ static int s3c_camif_probe(struct platform_device *pdev) pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) - goto err_pm; + goto err_disable; ret = camif_media_dev_init(camif); if (ret < 0) @@ -502,6 +502,7 @@ static int s3c_camif_probe(struct platform_device *pdev) camif_unregister_media_entities(camif); err_pm: pm_runtime_put(dev); +err_disable: pm_runtime_disable(dev); camif_clk_put(camif); err_clk: From patchwork Tue Apr 27 10:13:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428176 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 34D75C433B4 for ; Tue, 27 Apr 2021 10:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0A42611F2 for ; Tue, 27 Apr 2021 10:15:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236731AbhD0KQj (ORCPT ); Tue, 27 Apr 2021 06:16:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235790AbhD0KPL (ORCPT ); Tue, 27 Apr 2021 06:15:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCE406195E; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=/R60wucnhMxzatTcaaq6aX+wA4KyHRrla+Ogrsx7GxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZ9IAMfTbC6VCIWCPQlVZ4eZKImP4UuqT9UAattBwUeM/l8qVA4Noq1J7332fl49c ug7YMVGmUJ0d1CgHbsv8SOYob4GcnKR1mdjUe128o5oRbp/PHT9sjwKcANpAzOt9GC 8TUDuldsBLF9F+f6rkbpa8VVrYGzLE9DM0AFV6pUGs/cV+trIcFZD1Q9tINtrZ29Ai RU4FmZTlQdW+xhZ7w6ktbcDzef+/f7qc3xjYo31aaPkzZc4UdCCpmGPVTlnbGdjlBk h0FBsIog30AT+u8t68xZs81J5kjlh94OMVu05Zc/tofpbeqZIjOiW5Rfw0XSpSrd3C TtUvtp88E1l9w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8A-3K; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Alexandre Torgue , Hugues Fruchet , Mauro Carvalho Chehab , Maxime Coquelin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH v2 74/79] media: stm32: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:41 +0200 Message-Id: <138647d154e523f6e0ff04af1dd94e8bd0facff3.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/stm32/stm32-dcmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index bbcc2254fa2e..5f4e1db8cfcd 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -723,11 +723,11 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) u32 val = 0; int ret; - ret = pm_runtime_get_sync(dcmi->dev); + ret = pm_runtime_resume_and_get(dcmi->dev); if (ret < 0) { dev_err(dcmi->dev, "%s: Failed to start streaming, cannot get sync (%d)\n", __func__, ret); - goto err_pm_put; + goto err_unlock; } ret = media_pipeline_start(&dcmi->vdev->entity, &dcmi->pipeline); @@ -848,6 +848,7 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) err_pm_put: pm_runtime_put(dcmi->dev); +err_unlock: spin_lock_irq(&dcmi->irqlock); /* * Return all buffers to vb2 in QUEUED state. From patchwork Tue Apr 27 10:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428175 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 727B1C433B4 for ; Tue, 27 Apr 2021 10:16:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54417613C3 for ; Tue, 27 Apr 2021 10:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237083AbhD0KQl (ORCPT ); Tue, 27 Apr 2021 06:16:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:35522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235858AbhD0KPN (ORCPT ); Tue, 27 Apr 2021 06:15:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF8AD613DB; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518434; bh=Q1WsziPcbnwAb2cpqQFZbO8zttZnZQq1oIpn6yJZI+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOxoBc6fX8LQ3nxyOd0t2RIx/rdGgjYfc5pU2Uogwl6kdtZa9v7rIkXdJ8X2UMoUR 9xe3yaHftnVjn2wEnD7orANu+Te1STBrC6bv+8Cri6rd2+yG0ELK1JCNedgn8KmRl/ F6UNsw4VGQWvXFr75BgLHPB8fxn5YaGoLwOE1Ta0gsE6V9AqQoK0M9AUkI/u0DHXI5 2LS85OiasiI5qkpnIKKnPiEpWc0LR/AiQCSw9kdGTI1Ss5uPanq6LQx+G58VlLgL1U PNq8KwYSg7mrpWYTzWyazSwmh+bfQIV2VqDmKo1wXajK+FzJ1eH0fFxJnjhyaInjhj dPoD7fly50gVQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8D-5T; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Mauro Carvalho Chehab , Maxime Ripard , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 75/79] media: sunxi: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:42 +0200 Message-Id: <8c9d978dfc49ea2de6a1b6cf5b3a9d647e6b1cbf.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c index 4785faddf630..54b909987caa 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c @@ -206,9 +206,9 @@ static int sun4i_csi_open(struct file *file) if (ret) return ret; - ret = pm_runtime_get_sync(csi->dev); + ret = pm_runtime_resume_and_get(csi->dev); if (ret < 0) - goto err_pm_put; + goto err_unlock; ret = v4l2_pipeline_pm_get(&csi->vdev.entity); if (ret) @@ -227,6 +227,8 @@ static int sun4i_csi_open(struct file *file) err_pm_put: pm_runtime_put(csi->dev); + +err_unlock: mutex_unlock(&csi->lock); return ret; From patchwork Tue Apr 27 10:13:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428174 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 94811C43460 for ; Tue, 27 Apr 2021 10:16:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 605B3611F2 for ; Tue, 27 Apr 2021 10:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237884AbhD0KQn (ORCPT ); Tue, 27 Apr 2021 06:16:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:34910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235942AbhD0KPO (ORCPT ); Tue, 27 Apr 2021 06:15:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1700B61968; Tue, 27 Apr 2021 10:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518434; bh=HzlriyHzqlZAHsYOJEVourXS9CSW2DolwRX6O+Dbyqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J5cpkI1Qlep4gAdUE4qBI4ZNx6+hd1seEK/CICW3B85BWgCm2lMSWzseaXUPQe/uX 5RYajuL18Bpdj1iUMcupp0yxEK4NyK2WTRCAhqalYBtgCP+chu/RmMlaC1ek6zFZ5i 1ytXSg/mrycAk2IjTDYxZHHxbqNP3oqRG4WOLmw5mOIhQ+fHxeNdguB06OEA467LJG HKJXBf18OAdGMv8wSYZEXdB/1GoA6kdBaxSiwkQ6Ks7LgTQQtbp3lJQMDAUdGpddAa W9GT6tyWCHRRUe6D3rPXXAhBRKG+YNlE24bAqE5RVdJMXUWuRa/wt5lXE6ZexoqjP7 KHtMtI3aI8Ntg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8J-9i; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Kieran Bingham , Laurent Pinchart , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 77/79] media: vsp1: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:44 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 --- drivers/media/platform/vsp1/vsp1_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c index aa66e4f5f3f3..c2bdb6629657 100644 --- a/drivers/media/platform/vsp1/vsp1_drv.c +++ b/drivers/media/platform/vsp1/vsp1_drv.c @@ -561,11 +561,9 @@ int vsp1_device_get(struct vsp1_device *vsp1) { int ret; - ret = pm_runtime_get_sync(vsp1->dev); - if (ret < 0) { - pm_runtime_put_noidle(vsp1->dev); + ret = pm_runtime_resume_and_get(vsp1->dev); + if (ret < 0) return ret; - } return 0; } From patchwork Tue Apr 27 10:13:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428173 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.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, USER_AGENT_GIT 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 3B8ADC43461 for ; Tue, 27 Apr 2021 10:16:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06E55611F2 for ; Tue, 27 Apr 2021 10:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237304AbhD0KQp (ORCPT ); Tue, 27 Apr 2021 06:16:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:34780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236134AbhD0KPO (ORCPT ); Tue, 27 Apr 2021 06:15:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E020611ED; Tue, 27 Apr 2021 10:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518435; bh=ef7IZ30lWjyFTV9EZRM5TkDA3zgk8AfGs9/mdIqlXQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RB3Q5l/+RxAU8Jsd4tjtOWG3kz+K+KNeI0F0TYSc68vmC/Y9CU7c+TXrc6Js29jDr nRymjCPnKpJo4cDfNU7p4MMKKKZ7JewDJzQ/1XC/TB45YnTBJW6fQgdohfcitDLNIW Y+4h8BajogEp6yBzVlSt99afe7ZS3/CIR9zhRqJ6FK6t9B/0TAK227JqwSrZwqrj2I KC/DvyHDzx3OTOY7OnUsV3L7YTy5JNpMG4bmBdewOuUyMD9lEFFVe68kStsGuMDwDD K9APVYPUfpZGgv4vStvVCYZeXcWcloWaRAP+SLfTF3GL7YMCgrLsz/TGJ6PJ378ysJ c3HR51tTcDLVg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8M-BJ; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , =?utf-8?q?Niklas_S=C3=B6derlund?= , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6der?= =?utf-8?q?lund?= Subject: [PATCH v2 78/79] media: rcar-vin: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:45 +0200 Message-Id: <9ebf042135b50dedc6e1f654e4c8487602645d29.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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. Reviewed-by: Niklas Söderlund Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rcar-vin/rcar-csi2.c | 6 ++++++ drivers/media/platform/rcar-vin/rcar-dma.c | 6 ++---- drivers/media/platform/rcar-vin/rcar-v4l2.c | 6 ++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c index e06cd512aba2..ce8e84f9e3d9 100644 --- a/drivers/media/platform/rcar-vin/rcar-csi2.c +++ b/drivers/media/platform/rcar-vin/rcar-csi2.c @@ -408,6 +408,12 @@ static void rcsi2_enter_standby(struct rcar_csi2 *priv) static void rcsi2_exit_standby(struct rcar_csi2 *priv) { + /* + * The code at rcsi2_enter_standby() assumes + * inconditionally that PM runtime usage count was + * incremented. So, it shouldn't use pm_runtime_resume_and_get() + * here. + */ pm_runtime_get_sync(priv->dev); reset_control_deassert(priv->rstc); } diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c index f30dafbdf61c..f5f722ab1d4e 100644 --- a/drivers/media/platform/rcar-vin/rcar-dma.c +++ b/drivers/media/platform/rcar-vin/rcar-dma.c @@ -1458,11 +1458,9 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel) u32 vnmc; int ret; - ret = pm_runtime_get_sync(vin->dev); - if (ret < 0) { - pm_runtime_put_noidle(vin->dev); + ret = pm_runtime_resume_and_get(vin->dev); + if (ret < 0) return ret; - } /* Make register writes take effect immediately. */ vnmc = rvin_read(vin, VNMC_REG); diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 457a65bf6b66..b1e9f86caa5c 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -870,11 +870,9 @@ static int rvin_open(struct file *file) struct rvin_dev *vin = video_drvdata(file); int ret; - ret = pm_runtime_get_sync(vin->dev); - if (ret < 0) { - pm_runtime_put_noidle(vin->dev); + ret = pm_runtime_resume_and_get(vin->dev); + if (ret < 0) return ret; - } ret = mutex_lock_interruptible(&vin->lock); if (ret)