From patchwork Tue Apr 27 10:25: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: 12226089 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 3F01EC433B4 for ; Tue, 27 Apr 2021 10:30:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3052613C8 for ; Tue, 27 Apr 2021 10:30:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3052613C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nB5aRkzAvy/YRcjKCK9/Fy9Lt4pxuZAbFR8TyOv/0ZQ=; b=jSr89Cb8iXZ98F1IdrKAxFKs/ Lf8wRtKQRzvnlBG35BUHeRbhXDmi3TE7qLF0MIAlmm9eNqmCPFVi3s1+BCgLXbKhJSJMcwDvWCRC4 QVFN4IIZ6ivGLCXcEX+NAaLEyptSsDfPkgd58Qtv4sbpSKovePxZag3R4/MiY02DNpkiElni/FtAw yUZzBEFBSug+nPtn4NfkUVuHKWCWOZBaJnLAFk8TBgqNcmxjpmKxNld3hjugYamG4YtXUvSRUClMh pf0KNHCnK1Td7kHul4Wv50u1wN8zbQF5eNCbR5XbsLmvfI0NPWiaMI97eQ55OiwVR0eSGjL6rbnhr J/HfTf7fQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKxi-001NOU-0M; Tue, 27 Apr 2021 10:29:02 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001Mz2-D4 for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=79dWgd//jb1ogaDGIhMBJ4K4q3CzJDbVFoiHLI9HXdc=; b=WprjmjXSxFS1FKTF/c4PxlCdo6 ZIvUPxOFEoKqpnrgvBfajZUUFpXl5UUjjDfJPjapjOBgrmJsZcebySmJfE9ajmNsLptgZIXEOQiem jSF1/B2/AEGXQBIkueGqsbBcBeJnDaXBpglH5iHHWMGFutndBLsklgPCNRZkIQ2X8jafDiqHZdiGo UWmInmAhCOx+uSdIxB/fq5CLvXREb6eSe0VdumFYsgNW1Iu/kCnXR0YchcaN0wIUmi98Ef0d/elbU LMSJJMSZy5S/FKl6pgwpIcdIiC0z2qjjEd0/CzzdfwBeFo2nsPz1ju2mnIeUtOYQIp7nBtMS90B2q y9eWEutQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw5-00GdBI-HG for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:24 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26551613DC; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=f7qp1inQpFhzLXGKfN6L+okBW8R7Adck1d72J+XCiZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nk63xs/U5+H50yDNDVtINBdbnbVjdI0k1ER0vB6Hueg8zEeM20wKRYFpCgZB6IzI6 4DgCSqWfQuKbb+nAiQOEuJi+2A4CAVyRS+61A0W7pDU4zZmZaMOZg2ld/q0xsLEd5E A6PnPJqgPN/61bhxJgGkIJ/mmX4qVJNpH0hSlCDv2hvWNvtwEqBz6IDuhcyYs+h8/p mkwJQ+WEp427ZpNOk1w6SEqZtGBTTkf82tdvOKiU4Dtrg+5m24F+LgZIGUdVSqzfrt 5HLBeRQfWE3CYhPOGIep8lw7SSmxc6CTu56a0PI0XPkjlG37DtPhmlQy2QWc+FKR7V oH1idtQg/J8dQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000nzV-3G; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 06/79] media: exynos-gsc: don't resume at remove time Date: Tue, 27 Apr 2021 12:25:56 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032721_660654_4E9F2C00 X-CRM114-Status: GOOD ( 10.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Calling pm_runtime_get_sync() at driver's removal time is not needed, as this will resume PM runtime. Also, the PM runtime code at pm_runtime_disable() already calls it, if it detects the need. So, simplify the code by getting rid of that. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 9f41c2e7097a..70e86cdc1012 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1210,8 +1210,6 @@ static int gsc_remove(struct platform_device *pdev) struct gsc_dev *gsc = platform_get_drvdata(pdev); int i; - pm_runtime_get_sync(&pdev->dev); - gsc_unregister_m2m_device(gsc); v4l2_device_unregister(&gsc->v4l2_dev); @@ -1219,7 +1217,6 @@ static int gsc_remove(struct platform_device *pdev) for (i = 0; i < gsc->num_clocks; i++) clk_disable_unprepare(gsc->clock[i]); - pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); From patchwork Tue Apr 27 10:25: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: 12226085 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 2CE87C43461 for ; Tue, 27 Apr 2021 10:30:27 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 640C2610FA for ; Tue, 27 Apr 2021 10:30:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 640C2610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IehM+3cjkknDykziyDCAf3hB3jivrnxeyDq96+WvBWo=; b=XcIWE4wr0Wi6ArGbI+/+swOvT OmmzCrveN0tx0zFPJL25VA5obNVnCacvFInv1jd6AHvQgloRcC8o1vCOlQLq5UgtCgPKnzk+GG8jb C7D37RMPKqDGM/fN9AEwc7c4qdCefMNzvHHIXXrJCpH7ZxwZmUuxjm8iLA/lvAMW03n1Irk1g6IYv iLOFxkwMokRSzhN3x29vz4agzBzKyxzCvld2F1bNFvkxJ3mAArWZTcPt6cNYAiAvd1sIkzPP/MWTf DpMZO2kvEufG5w/HrpDJj3gLogr1v6gOwHQGvXXHabh13mtJiJNckLquWIKzsNHDN9//f8JhGYAxA JRuM9DPFQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKxN-001NIM-Jk; Tue, 27 Apr 2021 10:28:42 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw8-001Myl-7m for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=jEITpg5PVFjzGLluAxPMynipaClS1/3Jo4C972zlT7Y=; b=LZ92y/9XG8012xc4Y6KTz2jq02 mQglKmXy7xx6hpd57nsEFPWlGyA/Ey9AZglXe/WAjbzXwCH7FTuWk+HZt2ZLBMfIJ1HRD2A/wclEb niTn+zH0QFeNM5KB9xB9WWZMWbQlrqIhzy+RQqJmtDDAy5dKjGR4AB8qeF/GcT5xmdVKWkErHxGRy pqlISRariWG47q//Uf2xcm772WQpmQU4U+87UvOztCZIRJhYDTzFybyCvWBEOmYP3zUyH7fXxvPDb XgE06UK095Xh/u+uIRoFtarfY1xoSkjxODrOGt17u9+CceQRmMolpeFKEiEu6wDCuIaWupY0Kn21m mv4G4h7w==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw2-00Gd7q-He for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:22 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4426B613EA; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=7cvQL/2CEUShgMHfIXo5pZaMj/4OUeemdQZifBElsOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WycUNygp6P/3tN8hyVAUOBK7IBkSSnazg3XY7J+/XtQ2pzXZ60SD6NEIGS2cBfpVo ld5TgAiy6agzqm3f+DqunlH6qabduzlureGledcla8B5lAUxWq7JZpZ6Gvr+8v0LnS MpTUvggTfBaELmE4x11sqCeP9eKgSvKb31Ne1jYhY8iJ0NEVgDOpv9gCpvnz9I2bN4 eJZiWnjmIoZA3mJLLBgEwMp4oS+5G4J/Xv3dluTu0wt7RINiuCtUqMMDc3XDYkH3Wz FBnIdTZ9AXYeABUWoxirilvBZjb0MJGeRmvJxPkEZHZLupPNj9MCgZD3fSR5OILWpJ L3jCyPNdr5zjg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000nzY-59; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: Subject: [PATCH v3 07/79] media: atmel: properly get pm_runtime Date: Tue, 27 Apr 2021 12:25:57 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032718_722604_A2100403 X-CRM114-Status: GOOD ( 20.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linuxarm@huawei.com, Ludovic Desroches , mauro.chehab@huawei.com, Eugen Hristev , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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:25: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: 12226091 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 F19ACC43461 for ; Tue, 27 Apr 2021 10:30:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ADB62610FA for ; Tue, 27 Apr 2021 10:30:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ADB62610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3CsOjT2zzL3uMfFyjGcmdGJhXM28IeHBEf9GRa1NWMQ=; b=msrLMekY/ujjaXEpOjI3yTD/T mbv/K85tMB+Nyrk0xOq3EO/T+ai0m/3Zs6OPKuq4xlTnw246+vbDe690VISl7n4KaPkUJfm15T9f0 yTl/91DCEVA9QrHej3tf9ueFtoXs7pcu5NJsvJvk5mX/1P9eBv7xb0WIUKBoUtDk6kNk61dzxYeLB FbkFBX1jGO6IaDATZ5NYzW19av//ZpbWX2ljBUUjcAH9GIWVepRRkLrUXP1hp1jXgfde5iDiNBaEG T/EQAlheTS0MD5VUcpcG3MQ5//2kICzqTivzRIMXYEjqDeWPk4JqlibNeHR6yVJgfYPm0eMcXjg0t 9Ih4PmZ6w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKws-001NBe-1r; Tue, 27 Apr 2021 10:28:11 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw7-001MyZ-P1; Tue, 27 Apr 2021 10:27:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=CkzDiRgPy8iejVwPrfGJj8JwW/3IpRiOAho8UUQxXuo=; b=pa7hZqyi+fiVH+o7hlCc0t8n/2 0cvFPNBrgtxYjCo1zg9FGnbabAQIkQ4fSZmGkWKRX6A46vIG072suBH3XWHltsgW/vt9KkdUqIIc6 EplmArN2TjT4TB0GkrIpSNaWmk6cXu2YJrqN7dV18gtLyrPAOcDErFvqTcsUQ+WwnarZwin53Ss47 Ao7E3ggU7uDt+x8ZqJS1RhApUhyNiylD4ydkXWRr99lIQ3k3c8kCgS9jTSz6H9FgeTUFCmMPwCPhe uGrxMz7VgGUGH1TRVuPi+uJgqKk3OdKLYyj5UVovWUU0BtFQR6K27nifSfOmk96Nkx7qyP8gzPW9+ Vz/5VlQg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw2-00Gd7l-Hq; Tue, 27 Apr 2021 10:27:22 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DFB3613D1; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=XfZSeMotNFyXbfT608pw1ECU5JJkssXPopFyWbltzaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rpva4pFFX1xfT9Qib5p16t22Qy4kyDXU+xli54LmAHrWSU6MjllDO6dkdX6bUVwZ3 XoLxwUwncX8bHFaT1feMahtZ+mAAcCgw9eMbJTJMhv6vDhZT+n1hUnlfhyZNW6QpuX uuxSjuz+fpGbgDKpIH37kIytUd/fGeWmhKhmQg5QFKDuY5Cmh1qS4tZGW0VvvUXxth oriZ4yCj0cUbddMeU6OXQk9fijw0kueq02+0pTVgm7RzpgEpdKWiAgbCeANvwzjfBY MamIJdt/Tc8Zb3cUxVSGkFcdxolaDIRv0mmt4Bm7h8EAvOgY/7VZPekBppXj6EqtwA tJ+uYfo7qWX6Q== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000nze-9a; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 09/79] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:25:59 +0200 Message-Id: <6f2e4b112f845f9be1de07cb8d73ff3173dec01a.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032718_755427_FE375DC1 X-CRM114-Status: GOOD ( 12.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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:26:01 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: 12226093 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 6CB10C433ED for ; Tue, 27 Apr 2021 10:30:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA560610FA for ; Tue, 27 Apr 2021 10:30:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA560610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cQhgr9zZFFizlkUN/vdECA+oFM4P7OEN+nhgIfUYRhk=; b=HN839caY95hvfLh1YNAHKk5Jq b6ct3KOPUXz6UsUkAjukWboADJt5ziP+in6WoBmn4Wpk75ukMcUAsqHx2q4Nl2vhzFahz5Y1mM/Mo xvE0li3yqg1bX0iqnG8sEyzgyEPJMF7mV+lDUm82pS1Ypj0UulLwG3irEaX7cU47RDRsG2Ywu9Krq VLsJzeBZdPF7r0beJsScKr6CrpBPIDmr6ESg72+WzmX3h1QN9i0shH+Ic90Mo+QNg6LLb0/dbHD3I xPoAUVsqB5hRYI/qzMD5u8I/+Wz+GDUow7oW+JlPtYfO8v2n7jrH+C8s+etDz67BVda8rioWP69DA gGr3m2tnQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwc-001N9v-PG; Tue, 27 Apr 2021 10:27:55 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw7-001MyX-MP; Tue, 27 Apr 2021 10:27:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=k/JT4xNc8q+xgw65KVZhdHtvOyVt1/eDaJCw7AtYUJ4=; b=ec9FGY1raNPljVKO5M65twyI3k cEgLjBXnfRkpBzcZi50DE1IE/TDjh7yDC5T3EMcbxcD9pyZwAKfp54bMDWYzEphyqJsHIcPbQZMJf QheOLTtlaAq6MEioxWi+5s8mFvvsG4mo2jojrJWVDpKWyBhRJB2ihRmxqwuoR2D4Mez2EX7TcBoTE ivSnzcjAcM2wVKhg/6tUp1MK5kqS8iPixFq7xEovLPgT7Id08vX0cBlNWBC24xsO+SMmSpXZ90OUh yp0mo2WI1Ych+ftQy+97M/zrLf5vnMyYcMMeXTP4zHB/kOBew75qCR6G1kuz5PMlu2pAQVxCbeXMr oKPjy4qQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw2-00Gd7p-Hq; Tue, 27 Apr 2021 10:27:22 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 487C1613EF; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=uJQR0czm+DeAW2PWQeBvZ4Rvzd+S5i8+90myFebensI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jVnwnb5PZqgl+8wS3a81LGuG33LLQQG5gU+krefP1JpsPHclKD/qXIjYqGWDhXj55 33ZRf6pF3l25eqc23Gs5pQdb0PDVHjURu+5v6pv2wTDR2k3uuNt6odSP9+6BpqCcYd d/3Degiy2aE7zY3jDL0nmMN6wAYcVoY24xda0SeYx6pUfEfpJCXrXpLKzBsi3uUBHL pVypllmFBWs0zwfTFOHdkx9Da4ikdpe+ma+x5heSsVnA874VjASk5gH6YgAulNQ3WA BufVzIeVNbWeGsNO45wpB2uYN9PNZRI/HwQ2DqN3hKdQKXTVe0cPNGxufc13iTQ33+ pdjzD89XjIGGw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000nzk-DU; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 11/79] media: rga-buf: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:01 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032718_742861_2966571C X-CRM114-Status: GOOD ( 12.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Ezequiel Garcia --- 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:26: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: 12226095 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 41699C43461 for ; Tue, 27 Apr 2021 10:31:04 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1715610FA for ; Tue, 27 Apr 2021 10:31:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E1715610FA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FrONTeQhtUyKWBgTpAZzuJ4nbRrXH6NkYuifmfG6ngY=; b=myUYN1zK3snZr+BTCPisi5bc2 sRteFdVBmjAagDgKhyq73me/eDbQ32383pdbe8P36b2BxfRLDvCG6/yF/UopmX6H9JVljNsWyt/Vw LWIr1A0g9gQ9wDI15SGAw7DrrvCCNgvBLn1aQRa2hxyCa2qg1seuQw1ApzqeDrq81uQQwMNxZu7iQ xVMHXhEClSv+2Ojz1ETga4VXQs059iDT1EE9jBLBXG+EprJp9z8oZuzLPZAJed4R8dWVfJbywExaB H5oVQnkKglw81wBjFRuqO7fdmfbEqk2KBrbU+IYUMqF7E7GrquC/X/zEwqAvVTd5BPdl9+ry6rE4g zWKXxreTg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKxx-001NTQ-72; Tue, 27 Apr 2021 10:29:17 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001Mz3-GW; Tue, 27 Apr 2021 10:27:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=uvxTCk9qFVRZeWu4OWV5nbuso6Js4+D7jvAIh37TJlk=; b=F3UFsXyCCXYAVrmGOmUBET5Hkm IoTWQhQY0Eq4+zfHTQVUAiBkupGuYeFBUMhe315TO/3/BnpYNrycZmUxqKhGKc7Z1BiIhGr0QoKGg lRETLRXtuE6jimz0xwUZW5AIErnam0IW0g3YR00k4t5gvQ6CftO1ErDJHCxljKSa/HlKyiiNIf165 RpshU09ebQ2U3mbso1Je0bSebWqRr1B0Sj95GpJwcexcayz0iZi3xM28jfrwhHIZqMylaPbM2ZNOm uYywrc1qByl4UFbI/uZ8QGeWP9y4x6Knryuc83FUBSQt0RT5ji+B1KCn0Ne30fKz6m4bcYz0q8woo svyN6Z5w==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw5-00GdBE-HH; Tue, 27 Apr 2021 10:27:24 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57DE2613FB; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=dO1gD2vCTyNaQMmr4CD5RrufRsq5HOpPc9z13n0Rohk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbWvtVHWTAey+hipESaA7D/+JGsH4iHUJ5QUnJWbaQ90t2lqsJR8DxjhYJ4tZY9NE 7sUWaQNJ58a/gx21g/v8U9+dTCqhpPqqvyzXz6440q615rfHwbz/ngOS98Gv1aUW1e 6F85UFHzWeu9qFsabeZwnEBYC2YHI8XMNNVPWrkt/LdI19wuwtWCzlfILd1kFofYH6 ZJwI2DHv0V03BLexWkLKicITH1k/ksrp8FrP+wEaIPMwLy8+d37OwN/pVWARJFLSgO m8PZs/ofoceMQDgm+qgcZRXyBjxHu7KWFqlqaWUu3rXaTFPxccq6ndoUYBczc2Vo12 VxGae3nG6bBwQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000nzz-NK; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 16/79] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:26:06 +0200 Message-Id: <5ecb7c839255ae1b74a4f623cad05cc1a1ed3efe.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032721_680854_1012EC11 X-CRM114-Status: GOOD ( 10.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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:26:07 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: 12226083 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 B0383C433B4 for ; Tue, 27 Apr 2021 10:30:25 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 64358611C1 for ; Tue, 27 Apr 2021 10:30:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 64358611C1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6YwpU7rTm/c+dRsUkUmQN/VbVXtO8UAqp7ITLugo4b8=; b=buzRu8v01EF40aFYV/mdTGDG1 GWwgBUNoamIOLvzGBcAT2CqXCeiOJVyRlWY9dZzJPpq9vlK26tJ2nrh5HjtqpYz1S1PAJM+ATxjlG 7vAiqlxh0j3JLg4fRBcCkOs42wG1RJlEmCaEhJgmLOHbkWZnIudrtrXtM23ujtfcngENrTjfjG/w3 xwXWtPgl2M2wSEmSoqxktUK2mOvbqRwIX2FXy/+1dsHvqLZmn6YxaLsw7xqjmLM1OLskqrwv3HtD1 GJJfzjVOByXcRojmMjM79+qTpfbLnHx5aJ1kJJznHPnemkuqkskyr8pGPGMtCedUVHL7zf0XKO6is 4lZMh4FJA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwB-001Mz1-Si; Tue, 27 Apr 2021 10:27:29 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw6-001MyH-Fs for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=jRs3kCxj+As+g9pcmhKqvb7XbS7lWnL6DNo95j2Z3/k=; b=20ptcRN1qoWYZo6442rTP2uVZM pWqokKqspSmX/s9gEqI94pq6FDVNdZ9DkoYe6ZsG3xDbGL/SaUqaRfLC7u1WezQQZ5NOn6My2C1WE HtNrAaIBc9CJKmci+pjCHLM9iEJkUwQCv3r1WRRrv7yfmiChFUzZ5z9+jTdWVBg4XYWr2nqAHWS7M CC69RpPJJCTsbQsAn6Jkum09Zl5KNdjsBmZPlbvjoIS23TYlkEI7pMcGNZ7sEbhMcDZTCRXarhvxp f0CHNdX/qCFwxTbyFYRVE41F3gwLja3deo3fUEgTor2a80vX5qnJq4DwSsMfAx8gqixClWffZfXKp 8FXV5M/A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw2-00Gd7f-Hd for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E9EB6613B0; Tue, 27 Apr 2021 10:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=cJmIogEt8DtaRrLuirE0smJSOENxo/aAnd7cgWYfYDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=an5zXV4X4Z3N7pCHC/a/6eYE7scIqU4vlkIl+I7UH2FlGFBDBxKWTw6XmhfMDOITS VHft04reu6+NJE9JmenhS5NxnuekX3RtZ0ipRFGENclmNwHrveYuRGAo9cES6dQH9S YF87XkXE25CYGMNoRznmrPZ5amfrFy6Qk3y8Q1ulo82EJgWa33cVg2d9IuE5Aci9e4 NJgU+orRAJb4ucqo86+R7URiJqIE9D25KyNAsmM7t7b8LZRpKbUt8w+ue7pu2lBBN8 FdFl6ZnFLoOO+DWqn2dLwfKiZloqt1IyvR7K/XTcrOvcT8fzRaITg30hlt7aDtcqqU FYpkEtiYCZkHw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000o02-PS; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 17/79] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:26:07 +0200 Message-Id: <7ef9d9ec7810a6d2ff53ba8685fcc91a952bbbb5.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032718_649945_E20D71F6 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Acked-by: Andrzej Pietrasiewicz --- 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:26: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: 12226271 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 93C33C433ED for ; Tue, 27 Apr 2021 10:32:54 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46CF961168 for ; Tue, 27 Apr 2021 10:32:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46CF961168 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=077xZdvrpMMoyZ27XKHRc6R9KVsVfrd0XHQQI3Ac7WE=; b=b0ezY58u3kRIvJVKnllcEmB88 7SF9CRQM3xHAGkN5ekBpOVJV9QJQ8ct0rywQgfrFIbYOB7ByKQm7jpAL9RXDxXS6k/8qA6v9qyDkT WSX48rON1Tta6QQkkPii2RItc4dUNQDkcU76iDzEP1mLJrPW47Q6djlbNBfrPLGFOX5h038DKXJuT CUv143pDw78Yci0dmj/+ZKm4u4sZw5BBffh6w0oj9kTlxm2cKJQWK9hx0m7EvPhuVmx53KzzKNZfg hp66ltvjPpfBhoUDBC4QS+oF7Wbp5yyVPQaPDYDOuyKUN3W9s0NmQ568T0jKvLl3rDkqV1hJ5Zwf2 jrkW0KfUQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKzV-001O2y-Dj; Tue, 27 Apr 2021 10:30:53 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwB-001Mz2-Hn for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=UfqjQEksWt8M3LbdegcX5y2dPdTX6smEgNNd5wbgyV4=; b=UHZzfkk3naoXsc/oW0XOzeg1fH ooQTf111ofQPR+2LLFtctN+dkrtzB7TVkFbeia54x9D7A7JBfVEexGbBS5JRyXOKUo1V1ePpd69rU yQ8gTexu4tVcar63oBD7ZJt7XIXhjrhmBc3Uaj4zKMfEphEQBXBrbRjgk4xiDuzsURTIP1SNah9sb StjR6juInyuiQFl94XuHmFUlKqNJk5wgS6dTu2Jg5gfctzpk8sefrgQJyqS/LjW62uyMXI/5+N1Wz 0jELr7j9fFxZO/iSYUZbV/sixoZwCamSHymwNbDOGG7sV1WfqGQmYQ7k5ln0879GRZ7sqgn+QykBZ mTft9ejg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw5-00GdBF-Pd for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46FCC613EB; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BLF0JIKVcHE2UEV6cQv+g1qO4yemGW2SKFuM3SYd7VqD2ys05vpnP0xMOJK9EWXy3 prT6gwlMxkUUseGLNvpXTSxdtlTuFwVkNPzQMphS3YVaelsMJzsSjRnAUYdZ+ts2TB aR8fWmDd1Kax/uaqORtgaYE1TGAoHly7Xj95nXrOxBFslL2/cwDXbPNI6mHoDKS8K1 NpKvkWpuv+i9pEGF0X9vt8g105thpBgU/k+SQJSkcJfs8Ooz0Z42f4pzJd01XIvfLk 97DJo3kLZL5XOzRqCur/njG3atGe4kpuCsPq4pAXhAGLAeFb7D+RG9VvwbCxrxfqWG E4O8FvLQl5sEA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvv-000o08-TE; Tue, 27 Apr 2021 12:27:11 +0200 From: Mauro Carvalho Chehab To: 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 v3 19/79] media: sun8i_rotate: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:26:09 +0200 Message-Id: <2ea29dfab3849fc6856f6a196850ae711a61d4a8.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032721_951155_9D8F0B6A X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); From patchwork Tue Apr 27 10:26:12 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: 12226277 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 7BAB7C433ED for ; Tue, 27 Apr 2021 10:34:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AF7D60FF3 for ; Tue, 27 Apr 2021 10:34:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AF7D60FF3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=k4ncuRLh+kMXFY+tI1Opkrni7XJobtbJI/MNTJezb64=; b=JDlfgzxdRJ0nezr+lhwmooX7+ t3RyAqujA0VgalPmxB37DHkWJI8/Qvhz+azs9/fp/VCMatM6O82s8hr7XB/K5NyBEHICAzW2U7DjG 8Q1Ei2LL2IQN1898wmEmhAMJyX1Rsf9K5QLIYpcO0+r7IZ/YufW58OnJ6CYvqX0vpME2nZo5gTZ5H nUny/O4CDZYi9xkGU1azt/8VZ1VCMkH2u1nuWs2lI+Kel4xLob6342U3Xr5fWjF5HIA1OOQhc5RDR I3nkgI3vobEYHvjbwN/2oflanpbejg4lZH4GK2MxDsd9A+YNQs48nrRJ+SGdR4H5poRnZ6fQ6pX6Q a1uYzgNIQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbL0N-001OLE-EW; Tue, 27 Apr 2021 10:31:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001MyT-Kl for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B08056143C; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=WwdunTEPlspSuJNcgiz5VlTq6QqTmYyotSIBFOxVREY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NZm6zdW+FKzxb+LsjX/Lv3L7az1xSznYI/RONnb1cXePK21Nj4oLvZmIGqx+5LALk +66OR7pZFcaY+DFAtLTiBLuo39vLrTjzoB4/nZSDLcNBE6YtqNjPB7JTGltmO6E18L UchD071kXo4eZnoYnyjz80KsGTsBunYbSShzyOdI9WzwH5NKKyzGmV3mvlUC8vYfOk aUWwBs2uJAkaGi0SZleGmhwU4AYdVPAnwOz43JpE9PTJ8a2DNCXD6vHpwFmBa2ByQS j9PT5G/0kNVTmyL1H4ZA+0hDf8I1fRfltZiBcp9Nqh2pdLCAeCvQSw5t4ILDQE1qlD eT8TShmndMtVw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvw-000o0H-2p; Tue, 27 Apr 2021 12:27:12 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Fabio Estevam , Greg Kroah-Hartman , Mauro Carvalho Chehab , NXP Linux Team , Pengutronix Kernel Team , Philipp Zabel , Rui Miguel Silva , Sascha Hauer , Shawn Guo , Steve Longerbeam , devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 22/79] staging: media: imx7-mipi-csis: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:12 +0200 Message-Id: <706a63dc9019ebea7904acedc6d40ae44cb706b6.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_112727_549979_CC2CADA1 X-CRM114-Status: GOOD ( 10.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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. Acked-by: Rui Miguel Silva Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/imx/imx7-mipi-csis.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index 025fdc488bd6..1dc680d94a46 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -695,11 +695,10 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable) mipi_csis_clear_counters(state); - ret = pm_runtime_get_sync(&state->pdev->dev); - if (ret < 0) { - pm_runtime_put_noidle(&state->pdev->dev); + ret = pm_runtime_resume_and_get(&state->pdev->dev); + if (ret < 0) return ret; - } + ret = v4l2_subdev_call(state->src_sd, core, s_power, 1); if (ret < 0 && ret != -ENOIOCTLCMD) goto done; From patchwork Tue Apr 27 10:26: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: 12226087 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 64FA1C43460 for ; Tue, 27 Apr 2021 10:30:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08DAA611ED for ; Tue, 27 Apr 2021 10:30:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 08DAA611ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iQ3GoKXd52fl4kIgF5ZnZdPVBTNLdr0gXR3cQwcKg0A=; b=RmPKX3l2ukjV7iKWkeJJYtHLa hBVbv5IBEt45ATEO331V2exjXXiCabTzCPbBy3yIhh5JwHn4KRD/XfCONHge4yCRc793Tij+NIFFf FxyIw+2QDUwt/xxE/gamCCavqUXyePOcud9pbzLQTT8GFEzrGVTMIvSEXDe9uIYgQihp6tFwKK8th qm4Wzv71A9G0WsjdZpbvYC1n4UvBa1dXcVjsrWDV+TQwSlMVSglt/1HOzS2qYgadq5cpYLwSE3UtP LOpZeit7cZqVgjlBmaJQ1NdJVOtwxV4ku4f3RecSbjK4Cbpp6u2qBEDoKxQPFVygRAlUfiPOCGs5F TWrj45h7w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwQ-001N6F-Qk; Tue, 27 Apr 2021 10:27:43 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw6-001MyI-Fr for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=sXS9N7lOxdaSuaR1jnhTDEntcWdQ9KSZnVkdsdKbNS0=; b=FJLk1X76jiN/qbbPMFuECsN1uB 3iMnK2ktKKzFZKaZUJSE8M/b7Nzy75S9OycLGAktnrzTDMsWV7G4D80Ye6kRgJ2PiC5EhXAdoAfmJ iOxVJ0KfuDEd38uizEZtdtPWuj0w8kOjdUPxcazZwR2+LfOFEnqiBAucfNblBdBgomo9W6789lMMd Fcggft6Alp4EkBK/46oD2iV57VVKBbzO/FUFumJjBugvu+HzqM1gUq/Xom+52ca18CyICU4xvbe+K r5swY2wp9zFsyCdSEYXLXqcK8hdDqeB2tOHzrQe4lA5JIm1vOlYwL3/ea6XEzy1rc6betrqHYV3vi DOfsVYQg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw2-00Gd7o-Ha for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06AB1613C9; Tue, 27 Apr 2021 10:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=P8ySBvxIssOsYGuosUcRi8p/mrvcDEnJfSep5KVO8S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMkCLvyRBYSYTkhDOyp4uEi+XyTwkxe4+r00fVlVDME2C4PbtgKrgOGwIP61fbThr TZqAO6mrphnoVFdSRn6D7hSY3QHjYrGcCkX7anEx7b76HWe+A/3fyMOI58a5h6S+M8 KZNl70IzqQkfBl8iHVhmfD1cibe9wavoXBLsQV46Vy3ku8oNqBV8An3jv90pGR31P9 TDGLviO/kPHmmeJEMnc0rl/ri0NPt5WwGHqYvONhp18vF4dntXQotItmqXyuIAHdOR MyHrsn5zZQF6be9pQcCKpwagOZ1N0RlzONmzArOr5z9kfrQPJo6awblllhlTErYuR1 o8a3qdZ2K5sfQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvw-000o0N-6t; Tue, 27 Apr 2021 12:27:12 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Chen-Yu Tsai , Greg Kroah-Hartman , Jernej Skrabec , Mauro Carvalho Chehab , Maxime Ripard , Paul Kocialkowski , devel@driverdev.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 24/79] staging: media: cedrus_video: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:14 +0200 Message-Id: <991f59e8ff469c6b0e410db2aca6a1d3885b03d8.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032718_655098_C649D97C X-CRM114-Status: GOOD ( 11.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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/sunxi/cedrus/cedrus_video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c index b62eb8e84057..9ddd789d0b1f 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c @@ -490,11 +490,9 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count) } if (V4L2_TYPE_IS_OUTPUT(vq->type)) { - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) { - pm_runtime_put_noidle(dev->dev); + ret = pm_runtime_resume_and_get(dev->dev); + if (ret < 0) goto err_cleanup; - } if (dev->dec_ops[ctx->current_codec]->start) { ret = dev->dec_ops[ctx->current_codec]->start(ctx); From patchwork Tue Apr 27 10:26: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: 12226279 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 778A7C433ED for ; Tue, 27 Apr 2021 10:35:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 01C89613DD for ; Tue, 27 Apr 2021 10:35:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01C89613DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nPLaIaclxpi14T17avn54VwZOvnhllPQ9xqHSgdFt+I=; b=q8TZB6NYv3L62DzPBaCgSVrXR SP1uh27qKIUWe7prmCkvy/2H0wqyEtVZP6xwz85oXMt64l8hD4cx7Zov/x+848EDcaJ1oVVRrPrzw VnQt0QN2D7DduP6LerzK2euqP36NiYB90bfiMuI/iwXDG0Y3DtXD8a/JHEcMaXk23huhpcp413d1E eKlIxakC5t1PGq+2sthuZ3Y9/Q/bYqJ5ZVoqqlAMt5vb8+ddv1ChZiWRajZSCW7/D+NFdl4PFph/7 2aBq2hZIyzxlp5VUmg1JM5imX5dvddbL0rIsPGaqUMwXOCOs2+yYeEGR0+IhISc6tYvoxKi5e/Nsk thgooq8yg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbL0r-001OTy-AE; Tue, 27 Apr 2021 10:32:24 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwE-001Myl-6T for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=JGMzFK5pj8GmyWgHqubT/I8/fNs6Y/LAlUxCKRM6Q/A=; b=wld9xPeJxLXRYvAt2n8kN6iUUS J73ktkj3IFTIyQlCJ8Ro7anyjqbfqjjQLKzOadaxBaZ4qGVoEEaX2NEzxSzsr5Jqi1d4oRMppbCaJ TfCiH1Hlp+ySSXKBiTtqZCLsug5yCFvoVou+0a2AqrggK1qa9U1GJ8EZpzEik2fVbyLVm8i4fDYCd nDVxRokUua4LuA+BM9ekvrB+QDfH4EP/ayqYh1ePx+k5ZFUAqgXezIdFCCwRLWpq1em5UcQN0rQC1 bJLH71QVH4eYWwNOGOioE70o1sUjXFXPvA3TSvp+djjAmbfS2Feuf/mgLcfjeE7TfRrD3X7WHDhms +NRMmdTw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw8-00GdBI-AL for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:29 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 98B9261429; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519237; bh=vqCg/VqSgTT9WFZipquUww7WREOlNkMrO5HLAuTAHyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=itp3WSbWletAQ14jr15/JCK46HjrrIMAccioMAWp0h5vaS3ot2kqBeaJllL8CQYvA eCIbrgpaVUbU+lpmwq8EKksaZ1eIlt2hmqbuTPMXXViu85DJIyIvlVHOsk1b/X/YSS LFbIQA1tUvECsreMQpqklmyfC4O1tM7TdsA/0reb8SVTxccBHJ3Aq+W5A9m0Nc7OIT zQqv4MLoANgUfMyz18hynaQRW3CNnzXdoqHZslA2pKmmQoyKbMGo7m6zhnyDgNpES3 lo5+c4TYSqOFv1kEjjGOFItQh1Ltej2KU8ZNmuoCmScvCMtnGi9/aOdgBI/fh6DJKm czXbZma2d03Yw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2D-FS; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Krzysztof Kozlowski , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v3 62/79] media: exynos4-is: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:52 +0200 Message-Id: <834b16534ae8e18a29c734956e3eda671d455451.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032724_425189_66C8BADD X-CRM114-Status: GOOD ( 17.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Sylwester Nawrocki --- drivers/media/platform/exynos4-is/fimc-capture.c | 6 ++---- drivers/media/platform/exynos4-is/fimc-is.c | 4 ++-- drivers/media/platform/exynos4-is/fimc-isp-video.c | 3 +-- drivers/media/platform/exynos4-is/fimc-isp.c | 7 +++---- drivers/media/platform/exynos4-is/fimc-lite.c | 5 +++-- drivers/media/platform/exynos4-is/fimc-m2m.c | 2 +- drivers/media/platform/exynos4-is/media-dev.c | 8 +++----- drivers/media/platform/exynos4-is/mipi-csis.c | 8 +++----- 8 files changed, 18 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index 13c838d3f947..0da36443173c 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -478,11 +478,9 @@ static int fimc_capture_open(struct file *file) goto unlock; set_bit(ST_CAPT_BUSY, &fimc->state); - ret = pm_runtime_get_sync(&fimc->pdev->dev); - if (ret < 0) { - pm_runtime_put_sync(&fimc->pdev->dev); + ret = pm_runtime_resume_and_get(&fimc->pdev->dev); + if (ret < 0) goto unlock; - } ret = v4l2_fh_open(file); if (ret) { diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 972d9601d236..1b24f5bfc4af 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -828,9 +828,9 @@ static int fimc_is_probe(struct platform_device *pdev) goto err_irq; } - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) - goto err_pm; + goto err_irq; vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32)); diff --git a/drivers/media/platform/exynos4-is/fimc-isp-video.c b/drivers/media/platform/exynos4-is/fimc-isp-video.c index 612b9872afc8..8d9dc597deaa 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp-video.c +++ b/drivers/media/platform/exynos4-is/fimc-isp-video.c @@ -275,7 +275,7 @@ static int isp_video_open(struct file *file) if (ret < 0) goto unlock; - ret = pm_runtime_get_sync(&isp->pdev->dev); + ret = pm_runtime_resume_and_get(&isp->pdev->dev); if (ret < 0) goto rel_fh; @@ -293,7 +293,6 @@ static int isp_video_open(struct file *file) if (!ret) goto unlock; rel_fh: - pm_runtime_put_noidle(&isp->pdev->dev); v4l2_fh_release(file); unlock: mutex_unlock(&isp->video_lock); diff --git a/drivers/media/platform/exynos4-is/fimc-isp.c b/drivers/media/platform/exynos4-is/fimc-isp.c index a77c49b18511..74b49d30901e 100644 --- a/drivers/media/platform/exynos4-is/fimc-isp.c +++ b/drivers/media/platform/exynos4-is/fimc-isp.c @@ -304,11 +304,10 @@ static int fimc_isp_subdev_s_power(struct v4l2_subdev *sd, int on) pr_debug("on: %d\n", on); if (on) { - ret = pm_runtime_get_sync(&is->pdev->dev); - if (ret < 0) { - pm_runtime_put(&is->pdev->dev); + ret = pm_runtime_resume_and_get(&is->pdev->dev); + if (ret < 0) return ret; - } + set_bit(IS_ST_PWR_ON, &is->state); ret = fimc_is_start_firmware(is); diff --git a/drivers/media/platform/exynos4-is/fimc-lite.c b/drivers/media/platform/exynos4-is/fimc-lite.c index fe20af3a7178..4d8b18078ff3 100644 --- a/drivers/media/platform/exynos4-is/fimc-lite.c +++ b/drivers/media/platform/exynos4-is/fimc-lite.c @@ -469,9 +469,9 @@ static int fimc_lite_open(struct file *file) } set_bit(ST_FLITE_IN_USE, &fimc->state); - ret = pm_runtime_get_sync(&fimc->pdev->dev); + ret = pm_runtime_resume_and_get(&fimc->pdev->dev); if (ret < 0) - goto err_pm; + goto err_in_use; ret = v4l2_fh_open(file); if (ret < 0) @@ -499,6 +499,7 @@ static int fimc_lite_open(struct file *file) v4l2_fh_release(file); err_pm: pm_runtime_put_sync(&fimc->pdev->dev); +err_in_use: clear_bit(ST_FLITE_IN_USE, &fimc->state); unlock: mutex_unlock(&fimc->lock); diff --git a/drivers/media/platform/exynos4-is/fimc-m2m.c b/drivers/media/platform/exynos4-is/fimc-m2m.c index c9704a147e5c..7c1eb05c508f 100644 --- a/drivers/media/platform/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/exynos4-is/fimc-m2m.c @@ -75,7 +75,7 @@ static int start_streaming(struct vb2_queue *q, unsigned int count) struct fimc_ctx *ctx = q->drv_priv; int ret; - ret = pm_runtime_get_sync(&ctx->fimc_dev->pdev->dev); + ret = pm_runtime_resume_and_get(&ctx->fimc_dev->pdev->dev); return ret > 0 ? 0 : ret; } diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index 13d192ba4aa6..9346d44a06c2 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -512,11 +512,9 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) if (!fmd->pmf) return -ENXIO; - ret = pm_runtime_get_sync(fmd->pmf); - if (ret < 0) { - pm_runtime_put(fmd->pmf); + ret = pm_runtime_resume_and_get(fmd->pmf); + if (ret < 0) return ret; - } fmd->num_sensors = 0; @@ -1291,7 +1289,7 @@ static int cam_clk_prepare(struct clk_hw *hw) if (camclk->fmd->pmf == NULL) return -ENODEV; - ret = pm_runtime_get_sync(camclk->fmd->pmf); + ret = pm_runtime_resume_and_get(camclk->fmd->pmf); return ret < 0 ? ret : 0; } diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index 1aac167abb17..2a6afb78a049 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c @@ -494,7 +494,7 @@ static int s5pcsis_s_power(struct v4l2_subdev *sd, int on) struct device *dev = &state->pdev->dev; if (on) - return pm_runtime_get_sync(dev); + return pm_runtime_resume_and_get(dev); return pm_runtime_put_sync(dev); } @@ -509,11 +509,9 @@ static int s5pcsis_s_stream(struct v4l2_subdev *sd, int enable) if (enable) { s5pcsis_clear_counters(state); - ret = pm_runtime_get_sync(&state->pdev->dev); - if (ret && ret != 1) { - pm_runtime_put_noidle(&state->pdev->dev); + ret = pm_runtime_resume_and_get(&state->pdev->dev); + if (ret && ret != 1) return ret; - } } mutex_lock(&state->lock); From patchwork Tue Apr 27 10:26:53 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: 12226097 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 6E352C433B4 for ; Tue, 27 Apr 2021 10:32:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11C3960FDC for ; Tue, 27 Apr 2021 10:32:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11C3960FDC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Rwj3hmwmYaWGgVBUzjCW7h84Uau11P/qqu60sBlTlJg=; b=nTktGqfASBchP6he6J8BZgFpD LemPkqbF40YTkbuBSLdrJEfqg19IB9ipzQJuApWIyQGfJ6QLBENpiURk0eAJpwCViVcDTBb2G1tYF HWOs2VVqISG4D0kf35HDSRAPR2+P+u/JNHSDyYLGbpksbQ4ttQ4Vmc8Z07gD+os/Ifi3AeweHqhX0 TOuU2Eob5yRVJsZrfIVno7ubbgaC1kL9fsJ2GBTNbaSJxu1zXbG4UwzsIEqPgalTnEsBuRkc6fy2W S1uDK2qCSyiq766Ob9xVY8/xKMbwJ2GQulCQq1Gc5FtI5OoxmT+dJXWuYNdGjRRC5RgfXLyABlIJt 1NawTMMbg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKyZ-001Nhw-SK; Tue, 27 Apr 2021 10:29:57 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001Myf-Ko for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:28 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CA386141F; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=TKtKuWw4arj9gE1QW5A97zHnmgQIngfUHjaR8gvLIr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rUr3XgQuedmLRMxjU5/vIt9xq3JpbinPSkcPt7Dz1Nr7mpIwQU54XeKkV2+9fauMg UtwDc1uiaw4jUHBLclcuWpvNy7kKe/oIedeoS5hRLUKpLKCyQ0pFkMvOQH22vWhCTR gtT9bNbpZuSJNag3ObXD/ra+CB3+kP2q9tBhMoTJfZscEh7B/A9HY42AXeKkfBYKgT ZEZHvMbEEJq8/S9BMQAIv+ptY+MyDDODXUxs8X31QH1/1dLZixmyRieoCnXGGo8gXe eJ1mFW1Si0KDKVNyKkvCfk/+hPAIwPie8MgfkJ91EGfb7sG8jysDUPg4Tus9jmR/DI izVJtK3Pm7u9A== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2G-Hs; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab To: 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 v3 63/79] media: exynos-gsc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:53 +0200 Message-Id: <5a8d3ca13956feb5e611cb1fe08195966be5edf2.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_112726_998177_EEFB6866 X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Sylwester Nawrocki --- 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:26:54 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: 12226099 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 DA5E0C433B4 for ; Tue, 27 Apr 2021 10:32:28 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9BE61611ED for ; Tue, 27 Apr 2021 10:32:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BE61611ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vU/UP2sbsKQOFHtnXZJlh7KCkEFT2j8cmoRE0BtG8ZE=; b=CnNQDiQ+hmrxSW0X83+yYdcQp ACxux90ZFlSj+LABmR7bni/nWZOAKADBoAh1O/nIBSodBkl+zati6xjn4CEUoIJtAdlysNhvejby1 Lpm+6SoJ+TWho/zBr4ZWRqCmDWN9irjVDWAKpGYRIwpZa/hT2hMKLXjTMCdGeE69d3uS4Otk7tZiv xg0gm5IGz88xmIiyh8qR3im5UV9JWE1XZaEGMJZNjyFtPbUzrx5VYIwtj3ctEqxlpCk8unmLMubHy xeGjtayFJvHpUpimj0Owxcqx61k1VNpC1iAzQZiPg/HnrP5XipkYAb9mytJtpHHG65JW5jY9ZWuWb kloM8fIIw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKyu-001Npx-Ab; Tue, 27 Apr 2021 10:30:16 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwB-001Myl-2O; Tue, 27 Apr 2021 10:27:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=6tWS5AWeHgEG14BxYeaqs+XN0hv2Iox9SZeAydDvL1Y=; b=cE4tXBRCVXCAPm04+d+6PGkJJU KJh1oiJ+GJvg9NeHCWDKRJmTTR9dK+VpF/8cQc+enT9y52QgSHpGjKZC0SYG4sUQKd3XqNSlTor9l hS25SFiV3H537ir+oGUzBv3HCuLLzUaa/+BH0va0rifWzTrH41bXe7VFWmCg6iJ65GTOi5vnrR3bg T+H/H+ror8Mfu65gNJn1bCmNJcvxuqCkXDY6oNHsEcaois8kknONeRLEQ0Y9hF6xRQPfTtj89XufD Y8IqgjD/C1OVqMZarMCaKfgYwxqnQQiSZ0diP4FTYuvj5sKNK8xYHKeUwyy9nF3fUpUj/oqGYEgzd MhUdyNzA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw6-00GdDo-Sv; Tue, 27 Apr 2021 10:27:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C2176141E; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=tu2hhB6CHAZbCfvPd96Qq+9zsUaGe3IxV7AH+2XbuEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pWCJ5+YzV+LcsvBasttI5OaUINWopbWyj5/ga5/WC9JOzN7NxnwTRnzkoR7yiIP3M +PJcHT2kOzktyDUf+En6mdaLVD47HSRIUekSKGttv24KunrF/o7IWKUQgRHxBmRmxP NAKUYCWxqb2ukUddcCcWJe/3opHkQSJ1dpwhkJOnO2HzTPUY/+PvRjKo7uC0AJ/lYE mMICK4o0IugbeRbRrm+pqk6xcnDCcGjbzvzPuJxm4d09/tBaTO7XGgbv3oFX0coXZp kXMCdv3dhLDoUl1ET24dOAze3Z4SUP89d10BaIGokgAoVe1ecYRQdNporXx9cbZbGy UmAxT+47WFBhQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2J-Jt; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Bin Liu , Matthias Brugger , Mauro Carvalho Chehab , Rick Chang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 64/79] media: mtk-jpeg: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:54 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032722_989598_4FF2697E X-CRM114-Status: GOOD ( 10.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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/mtk-jpeg/mtk_jpeg_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 88a23bce569d..a89c7b206eef 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -920,7 +920,7 @@ static void mtk_jpeg_enc_device_run(void *priv) src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); - ret = pm_runtime_get_sync(jpeg->dev); + ret = pm_runtime_resume_and_get(jpeg->dev); if (ret < 0) goto enc_end; @@ -973,7 +973,7 @@ static void mtk_jpeg_dec_device_run(void *priv) return; } - ret = pm_runtime_get_sync(jpeg->dev); + ret = pm_runtime_resume_and_get(jpeg->dev); if (ret < 0) goto dec_end; From patchwork Tue Apr 27 10:27:00 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: 12226275 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 1EB32C433B4 for ; Tue, 27 Apr 2021 10:34:22 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB398611ED for ; Tue, 27 Apr 2021 10:34:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB398611ED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3QfOJ76i2fofg1cByKYYEwTUBsRinSd6MjfaGqGRLQw=; b=SzKcoxoIENajIIfHdGMSfy7NH Ri3E2CfX047W011KTOSJpHyDVGgFe+rMUZXGiKg9a25NG3ITWt5EmLwAToX9yuka/xrWb4eH6fUyW zcs6yF0X3GVhTr9gStHw5bMSn4j85/aXrYB0AhSUgSm0TxyG4tE4hxVXaSt0NmZG2UMRSA4hLwnLo RPZ8RGgLpOnZbp8Ml0js8bWOVS70XGaPquMgIfJ+U2x3Si4yaOmPYbXjCiMB0SzPIxOv+9HjaWxy+ XiO1wOmoIOZ8lrQmVEJrUBZ6k4tU3H54abBq2r3knp92wcgJ7f1JcR03Xf9sy5CjEEQaxXUGpY4tg MDqTirRyw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKzr-001OBF-SX; Tue, 27 Apr 2021 10:31:18 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwB-001Mzg-N6; Tue, 27 Apr 2021 10:27:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=wNlWAJheWo8r305lpFRr+Xmq5CAdeEepltQZlmQJw8g=; b=LmKSsFmgKPLSGjTk3e9F8/yKYe zdhAU89sK2pYFE7yw9GlX6XnB0MmJV+/OoaXoouKELu+2/EnoO7o4b1/iADXe73Fn+cHpbICRKhuq Nwhx6E8g4O1ht2gPlXaxasJokyGSyUSRjSRqhjG5w3cuVJB2nEz8JjwzPKYtSCNtGAfBaoB821Hc2 VETTqJ2gzhQ3HaKt2aoZQp5ih6qyBAcefxSItZ0sIsYMFembGvsETyaLOdYMsutZjAWTvZe3Wnvdd mu2aJQOfRfIayTwWrAF2n07PG1OGUz0wVdD2OX6SeBbbyJg7LiJR4mSd11iVtUtFSjuFVr19I8Yfx aYarEs7Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw6-00GdDj-Oo; Tue, 27 Apr 2021 10:27:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 87AC76141B; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=rChg/pXG2Qjbehywcb/+z5hE6+LFH66GvNnoCtLFEBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QoTamJiO+JxWdt3o4Hs6vYrg2jgI81cjPn/kT0glZGbqmWBM9aOjPXJVl8cyWQmQy 26cQBTSG214To1rzhZwxEd8DWaeNPXaYCPNgx9TjugtyzxzqP17ni7VfGq7JyR1YGt eluVYYOH8buCEmvbeDPmH+SnnxwSJWplGFoFQrxxCI9hutBi63CEyGn6RHjyNcmng8 XOQDYhQy3IYrSTx5pqC/lwZGxHm+ZoMJ/+a3ms26yWuqp5hKZpmOQZhbIVa71JY/AP +H+DNnw5dL0SKM/yN62bnrs6zSaJHLl64PNMQR3QGkuJI1GUGG6sLkl/MVozaGldFl WaHNIK2jM2a8g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvz-000o2b-7s; Tue, 27 Apr 2021 12:27:15 +0200 From: Mauro Carvalho Chehab To: 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 v3 70/79] media: rkisp1: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:27:00 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032722_843674_1A42E495 X-CRM114-Status: GOOD ( 10.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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:27: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: 12226283 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 99B0BC433ED for ; Tue, 27 Apr 2021 10:36:18 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 420B661168 for ; Tue, 27 Apr 2021 10:36:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 420B661168 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F0d9XC9KP6FhjMoM0wM7L0CwHLPXq5crMgQIDj0aVXc=; b=Lcsku0u6ZQUbaHFI1/Ng2wIBS 1KJtQN/0ATRVgAew6R+dfq4ru32K3KX4mxM4+N3+recIN405tSBldab9zkrBkkdu4Wm2CqXtnOpHk DZMp3nKkRzxyjV+18ZqR8XByx5oNgAfDZo3SsLp1nGqG+xEAwENkQ8nfw53EqO3rHmN6LZSWZUdOP G0JkkxvIqyhns84OV6zc0XFGDGsxgodOlXnJZUNCDXNtqnrLY4qKeNk6dgLPPbtHQ30IXfh3SUSrL Tsa5BpzA2cjp/WRvJDQQXxVatFD/7s8kAjDOzam9fpxzmupVvqRfsTwwj+afWGgYyf2XyR3XZ6WKr kUcnFAf2A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbL1u-001OpP-1o; Tue, 27 Apr 2021 10:33:22 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKwE-001Mz2-IL for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:27:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=UuREguUnWtJMEbW22CUBV5mbM3OEKqZjCmRLeRWME90=; b=2SDMWJKvKJGj37rk+/6xA3pXuh gPiTUVPOsPsVM+kl5t35aU8qVh7m2DCcQ1lN/qDBw/4OJspxO3DJ9lrUhFiRpiuTkODwUBaNEt9Er n3ZnBVUQEzy+NtWwLu/C3uI1mOwh4FDWoai2rNaPf+m+u22nabNFtJzkcK+LbPSFBGUCqKAZ8qGaV UfN2MlrN2deMjpFDO6znVAOATfMIo3BhHwN1PhitkljULCICTZoQvhrFICPZkVWq9sS5v2d3g2bF5 fZ6otgNTB1rPFMRVqXTJmkLDK+QB1q2fJORgzjMPFvEOopKcpVLbniYwXPmPnJgMN+39X7qAJ3+/6 MvaEqu6Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw8-00GdBG-7B for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:28 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8752D61419; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519237; bh=GlCvanyZeZRx9KVkDMbg84X3Nl/epjQxFII8vak4mR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRuN6RmqcFQodREOCRy+jAcix/qZjUy416To91BdxH5zMoHBcQmajEmfcEo6zn/MV phXYNvAGOksmNSCVaFYle9I0HA7uZN26uSislFBXRhQwtl22fl/PNT5MnL/c6IDOvg DRYKld857KFGysrlb5dBhBZyQ8hsFcWZwmVxc5nE2iJddSdgjGfbxAI4kQGVFQLr6H klaPwaqqIHm5czFctc9hMQrrfr+QmZDLzmg/2PyNR9x0qsFnEBoQuEwWsygAqTmciH CrkkScMkh9ds1nVM6h72+WHtIEv0DEs8v+ub9VB9d2+s7kRdWLtOIbqNaUwQtdvY0l C8xePLL40BXPA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvz-000o2h-Cy; Tue, 27 Apr 2021 12:27:15 +0200 From: Mauro Carvalho Chehab To: Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andrzej Hajda , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH v3 72/79] media: s5p-mfc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:27:02 +0200 Message-Id: <828322e0f8b06ef2962b64a6f6f1b368eaecf7a0.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_032724_314582_72BB7861 X-CRM114-Status: GOOD ( 11.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 62d2320a7218..88b7d33c9197 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c @@ -78,11 +78,9 @@ int s5p_mfc_power_on(void) { int i, ret = 0; - ret = pm_runtime_get_sync(pm->device); - if (ret < 0) { - pm_runtime_put_noidle(pm->device); + ret = pm_runtime_resume_and_get(pm->device); + if (ret < 0) return ret; - } /* clock control */ for (i = 0; i < pm->num_clocks; i++) { From patchwork Tue Apr 27 10:27: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: 12226273 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 97D0FC433B4 for ; Tue, 27 Apr 2021 10:33:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F4EF61168 for ; Tue, 27 Apr 2021 10:33:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F4EF61168 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lnM9Bxro5Hp9T/5tgWLtRWYPUTVsWY3wAo6bNemM7RU=; b=BlwheQ+svN515sc70qKJ21iMh 8pIYOHM4PEmIpxIme7Re7Lu8IXCdMR5Bm0sGCV3A52b3u/KnQ+tXYEsmmHzsDr1p8eJ7Aqst/vc9m gh2KfKpl4PvDc4Voqm84Sx2NEqO1fFr4958PZh+VtHsM0gvIdcUk+W/a/HpK4MEPmDNI9H5J+LuSL 8phfzRPzvFVaZBjLAsu2TwcVDl+XDkKnIQh8oidmhRGGQ+vSutwN9V2aaEGMsD4JJHMsboyh00jRG gBojOKXhnI/WEFAIGfa/BY21IL2o365E4TBk7YColzGW5rIPGLVF++nU5nKQn6oEn9rkSVk8g4UdP +KjrvD85Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKzB-001NwW-7s; Tue, 27 Apr 2021 10:30:33 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001Myg-Kq for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:28 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 815A661415; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=/R60wucnhMxzatTcaaq6aX+wA4KyHRrla+Ogrsx7GxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P56zrL4Gg3jEUeTkZS2IFHj+uXqtpdhmLsJDUn92MY4jLzJjsQAryX6b1IuA4GpoC uiZVc1R9FxNaZE3nN2cCyZR0UT5MeNcBNUzscwoou2kUKoy+tWYKD1dG8VBteaq506 pIOcETXuU9PPpieZnMFlvj8nlszSsVh7Ty5l5thsp1lnQoM42oV9QGL94uNwZanFzZ EAipNbg4MFY7UlZWA3zXP3lxC3IeJxVDBrA121JQ14Ki3F0PsoxcMrpDJEnKDwRzmR QehK2z7aUj8zb2mpo7fTfROvJdt3jaPNmBdKvwFOtLjtKycARv1ZOUIaV88bhGhzyn 5xBT36E1ppv7Q== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvz-000o2n-Hp; Tue, 27 Apr 2021 12:27:15 +0200 From: Mauro Carvalho Chehab To: 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 v3 74/79] media: stm32: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:27:04 +0200 Message-Id: <7a01ab8c03a6778c6aeb9357a3807829c6dc91f3.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_112726_985700_9BC6CC33 X-CRM114-Status: GOOD ( 11.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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:27:05 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: 12226281 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=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 6169AC433B4 for ; Tue, 27 Apr 2021 10:35:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C9FF613B2 for ; Tue, 27 Apr 2021 10:35:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C9FF613B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NwuvZd28guh4FpuDkWUsLNNRYC6NoXcINwhq0Wabdhc=; b=aYkydE3M/H2xc9KDXXLDZEzt7 w0EH5A34pMOthDMX1Y89AHa1+NEr8gEq3nGn3Zj5/WTh7sJGQYhMt9vmG4W2R5mLp7MQPxdIGmey+ eTlmidr2ZHdLOXSpsVgwxqHx4ZGKHPhXB28EICz9XxnTB07UhLKAlwm4o3ilUHEVrFq3tRrOMwHpL giVxt/dCqhL+QTyVW7lGoMW7ebGhBfEjrntDf/jZQsBfuxTQf1fmJFjsv1JvxYZi0bbpUNkE7TuF3 3F5EKW6GwizOYBMKDY/ZhEj4jtxOQ8IKVdzNA0DKqTgx+Rj121sdh9Uu7BZ6tcMCFAyHnVKHmuIHB Up1S3lP3A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbL1T-001Og3-NH; Tue, 27 Apr 2021 10:32:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKw9-001Myx-Km for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:27:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FA7661413; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=Q1WsziPcbnwAb2cpqQFZbO8zttZnZQq1oIpn6yJZI+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unDnKlP9o6a+vxQh5qp31nQEN88CtW9mWtX/Ua4La5wmjMW1KGY78blmf7pj1Wyzu qOd5WCV5sohjttf/sTUtf/TFTmUB7bVJS60pepQ3fMX8QkcX166Y1a0xMCkZlVDm9g 6FK7Q97cE9jt2NrzFL1Znnbw60l7ea7hOWisMYSG1QCZV2IVSqS2r62lZ5FWloprq5 ubcfvLclPeOS5Cr6TkAs9PqHcykmOSm9xjyMvLsp+5caennZjML9l+hWjfMbDF2j0n Z9vVkjalJG50mw6RGDcTxUSSfXV+z9OBGleyf9GzxMqu0VvA3W0f3PyAI7IG/GmKoN x8KFr3FfvGuZw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvz-000o2q-KC; Tue, 27 Apr 2021 12:27:15 +0200 From: Mauro Carvalho Chehab To: 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 v3 75/79] media: sunxi: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:27:05 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_112727_001361_AF7E0160 X-CRM114-Status: GOOD ( 10.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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;