From patchwork Tue Apr 27 10:12:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225787 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 8AA32C433B4 for ; Tue, 27 Apr 2021 10:16:15 +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 37AE660FF1 for ; Tue, 27 Apr 2021 10:16:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37AE660FF1 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=RYkMfcdPW3HPXWzgj0eP3/L4E 0LTKyUueEZvVbWDOdfgFAp62MqBQlScVHZU7hfrell2Ak28oBbEem9AVy+lHqTm/PstLGPUhnqW1F +JWxjDebs3aHgY13ewmXSmCiYylr4WPHNkinXFhI5rPl4j4HcTQYlBh9XcBUy4xWZhi66De75q584 ujV4ETF4MY6H9L8mlzL/3huEwHYqbpW+h+/GZs07QHBv499gEc7k+tQMHaOe/8Ut7Od0/DKoCGZKh PMrAneBet/ph3MeszmTniujritnXBNS8McEvGy63s1l2C1IDozPKHoFUqDA4qfcwSEiOtUnU8HcYz 3QaNG+nLQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjC-001JCj-AY; Tue, 27 Apr 2021 10:14:02 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBT-LD for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:13:59 +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=2pKUE74kOVJGj6672eE6zE1Dhd PwQoI5MOKS8bqG3uX2zPG9Kbqcr8S//XQ0eqSDJ75Oto6qDSvpNtuqacXRtalrJ8vNCqiZ67czCiz Z7kqcHmH/+CTrqwRafyq+IsS0qB23sUG616RJPqfcb6aJ9nOu97c5pGC4sseTM/QjQQlGeuNbG1zm Ret4RTwdS03bhRV2GqCdMDpPeLNZwHcMIl4Ir3EsBuoZyhX7f7JJinDXN1ltPfJdfezBt94dZrZFM Yq2msdSOUPKxLm5pDlqdiO+li+0WJjKtefFZxudjhUUFuAKiCA9xR8XqiGZg6JCP0YXsGShw1lffz tNjMQK8Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj2-00Gbm4-QX for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:56 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6A47613C8; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=f7qp1inQpFhzLXGKfN6L+okBW8R7Adck1d72J+XCiZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LxNL0qj3rr1b2/nH8+UwBD8iLX4yyUe6p0kSfE5DZIeGha3gEC9iDUmCk6Jv/eP4/ dv2eQ/bK39W03llKAissmZssAou4xejK9aTKW/CBO+w8Tz46lh61VrsJlPy0m4pg83 ppBF7hmgdGAqv9p7BBkUql34pF3lBxeWxCz6wIkNfJFj9xPbmz6OWKGaDzgzpOhLiV KlC8BmTid9T5URTl1j9FG9g82aOlzv5NXKRxi2xCQOSRSzBeg3M3dbi63kwFfc6VdY F2omCVA2qbMyN7YtCqcZTW83u6fM31e7u2EKnGrbeQdj4QDjOC8yEnThgLPoHb80xa t/z07HtOn9U8Q== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4s-Es; Tue, 27 Apr 2021 12:13:48 +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 v2 06/79] media: exynos-gsc: don't resume at remove time Date: Tue, 27 Apr 2021 12:12:33 +0200 Message-Id: <7f29a390daf93c38c4d52b9ccdfb113df5ebace7.1619518193.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_031353_022043_6C4C09A2 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 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:12:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225793 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 C9550C433B4 for ; Tue, 27 Apr 2021 10:17:20 +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 28678611F2 for ; Tue, 27 Apr 2021 10:17:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28678611F2 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=ZhdVhrgLesH24T47T41tpsb+U mNXW52qdnYYOwH5Ts7XtzlpWELuyJZ3VT74/MTojmM7fXKic3LFQVCFRAYonLgGJxe7bVAByxiAxW WiWQoZwDRGiGgU0oTAKRAKSyM5CHMdDFhhlZ+w9o3OGS7Xwy5HKlc5HQsOHCJrhTwKFkBoBzy8VAb 5X1c5sxZsjVbH/sdszXcjXBgisPoK26SDjP3Sjv/VioV4U6ehP3hXGnKhTbQJJ2rI/ArSJShbg+/2 EYV49qNsGbuF7jTq41cquH6ZydLL6fBTGceQZkMnEifSUCfde6xtPgiubhLRcNaLT7d6piNCfCsaw JVTHhPBZw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKkA-001JSD-QQ; Tue, 27 Apr 2021 10:15:03 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBn-LE for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:13:59 +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=JK824bChYqO+vPlvI5LVy//Smo v0XenmcATEZvz4Cj/D8jx/vBv+yYDfpGuVRF4VruPY1E9/fjEcoewHUwfggNn6fut2Q0yeGhuR9Px nFwjqYBN5iwg84WWZ2yxuGOxlkcdWvIPq3C9OS8kHEiGvY0rG3TJ/Xp4uRzEPp99qyHVkV8b1ZnVZ Ht4blgptqbWLmTmv/kc4vr2Gg1h6lHQoeRtmgFVjQPX8/kK4N2VubYx1V7gJcgvQmO0eOpy2Bkodn UhjqAbD49JgT7O3aepSvOu/06FyAehsiZGVNdXdkxOzP4ZgHU4XCoPqMZ0NrGUoL1i//F8cihMDsr TOYBNBVA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj2-00Gblv-Ps for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:57 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DE919613C6; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=7cvQL/2CEUShgMHfIXo5pZaMj/4OUeemdQZifBElsOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hq3COPd8OSGdrif9VHBXp6CRwrjlAlnTvk5/oCgS/5HkYgaF4txepgkMiS6npJqVG OzNYWc98VW1sp/SWYNQZYOq9Ip22eUE5+WTbe4UK8LQOuzkZTwqhod4l/4q9mWNtvf SzWMjNybANnSNDFxd6dGpUCyhWrnXduNZqs+PVDhX3NA/UFMItXV3G9MYGByljG4Gq TqOFedyOVqJ925bj5002+wOBOZvJbJP7jvB2VDu6BbjGrAMAsIykdltiVuwzSXqsOC SbcLMYf3Vcqg4p7v8cUw34i70CiAd2OQVhngcOxhwUbq5Ul0btt4cWoAdRYODFNsdo VeItlx8fMzgxA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j4v-G1; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab To: Subject: [PATCH v2 07/79] media: atmel: properly get pm_runtime Date: Tue, 27 Apr 2021 12:12:34 +0200 Message-Id: <246fe06a2621c5945f474fdf357aa5e5a4e1fb12.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_031353_032733_5E77FE9F X-CRM114-Status: GOOD ( 20.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: , 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:12:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225997 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 BBD75C43461 for ; Tue, 27 Apr 2021 10:18:06 +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 74AA1611ED for ; Tue, 27 Apr 2021 10:18:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74AA1611ED 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=qco9SGOzXnzxpfXLZ2ODzHm0Q +gx81s2JuKcEFwaaNd+Co1Xojz3oYsTcSUHtePT7n8IEevub6gD0ndOKyPgGrpIOFKv3miHCn13q4 sKV/CW6yzVHnxd7QU6u7YL+ufTEq6B0muSfE+GfOIVv9vmRZRE9NxTgpLSaJcinJIgG6i8BFeW4Fm knyaeUyEtfKRwJKC5PLWBkK5lZ2u+k6e8MghTXfjMFq8ogS9yITXaS6xdWqPTQccO24lfYY5BFqic 1ad3pnEeKhviLw2oFGeGOwIH08tMUxTUj7/8K6gUW1RGqHVIVlTVzoerPE0KI9IhZQHT104ZS/Avi NZY6nO6fg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKkR-001JVh-E4; Tue, 27 Apr 2021 10:15:21 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBk-LD; Tue, 27 Apr 2021 10:13:59 +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=vhMDQLcclG25w1+7uL/BXRUL6p vGg0oP8oxahBpVmcNd7JA6DBoqdodVPbwrysQGszyLBMBw4PPm8FIq7lRhjH2qqcweW0n6+vH6dP7 ZEf2cpS5AgnY2wZ5RARl5btC+cG7I/MuYamg5pdaHSQNY2TUXbOHdozFsSEdV49DFzH2y60BR9yNB IZSoyCZ6+NiUdZXlTShUwET1WESkZLPqg/4r/SQK/DG6gNcqRDPZ0dWLuSqWWW0POVDIFqFcfRA0o xjV2c4f9ErblRrShBN0MQ5ybYBqRD7YrqgnKXPMMlVAhyHdes06/hEONoNTdgeOn8WFzQFTfXTXOb XIi8zHLw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj3-00Gbm5-3i; Tue, 27 Apr 2021 10:13:57 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6F2B613C9; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=XfZSeMotNFyXbfT608pw1ECU5JJkssXPopFyWbltzaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nr2lUUMOHAMasRjwlY5qX3qVA4oegZ5AgUvpL6usdP7kYYZZZM6TsC32yW50v4n6u tcvNRQPCPk6KdTQhVAuWpm8L6wfnAnIjOKNjBAs6jwHBPaBboSwVTtHXpbVHICzTcc 1lBOKpP8EbMRNwPR8QTTYS2F24GO8hT3AURqYHmbXcQqcXviY2sO/li0wDxoeiLi33 nc5lIPv6zUXjHIDqnptAPfdDLqX7OdAffVBQPSFke/Wxl7TBV7w+dNNYe8y48V1rZU mz502CLIOs0MXwwcj+kyRx0Ho46obWLtWanADRaK/TUGgaFs6xRbkw6cpbsKRwfj97 jsoJG5CIc2oSA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j51-J8; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab 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 v2 09/79] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:36 +0200 Message-Id: <36568b7ce611dfaf4abc3233c76018a137f934c8.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_031353_212157_F12ADC04 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:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226003 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 2351AC433ED for ; Tue, 27 Apr 2021 10:18: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 800F760FDC for ; Tue, 27 Apr 2021 10:18:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 800F760FDC 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=aUFlggCZaGSyP9LcK9dpfosGG EJkcr+gp+b4im3VPwzFY+DGeHMy4KnqYJJfgO6hzSLutZRD0NxZdVvBfdwB6KuSNZ7SFgNrtqOWjD XfUakRosDUTHOzFm6BiO2iLRsqC3QyMCEb6ZE3DK6dI1q4P4J/tZXVPZRMPUvx+fDhWzgfPXhOHIW sN62sQQC6ZUqVuocgYlJ6Zgv9C9WAaYn1tX3RilzRMq5RGEWKVYpND4A/O8M0pYe1NbWYsMxdIWuY x+VwFMhGNYbBRq2NztT2t3eKd5QSA+DsT5hMo3ua4R/QXXLSNnXAqFO3X9mO0taf9r8fdqnYq6R1/ rhW0k2XSA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKlX-001Jqi-SG; Tue, 27 Apr 2021 10:16:30 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjC-001JCs-2T; Tue, 27 Apr 2021 10:14:02 +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=WJdMX8BJv7l7gsa+WNDRce+HY6 DEQ4NMrX7iQvAKy0pFvOFUvQWdiUlezZ2HM+5Gvpybc02e72gP876jdniyJLlPd4lXTMN7ZgSx0ww KtDdaWokOCoot8EisPrZDSnou5DXERTaE08RYGx9Syk4OaOVMJPDl1cubo2A2xil7JsH8T5Mj/lOM aeYaGgxaBcqlfTLxE4VkaaGkuKpTsqeKqIo5AhayBNfT5uCfd15gYnLBBii9B8NRdrwna+H6fzxtE W02lWylPsTMNXpXsVziWYqncWyeQBK+IyxEKeo1XqVjcFySVwkgk4U0CVo7EVvyFlC+1aKExmOBAn xW+AJEiQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj7-00Gbs2-73; Tue, 27 Apr 2021 10:14:00 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 88BAA61002; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=uJQR0czm+DeAW2PWQeBvZ4Rvzd+S5i8+90myFebensI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NiQvYMF7OEWPJzkJcicJ7WcKvB0H3GERIgYfA5qd0WtSjnaR0/nAV3hMCadwmEBnt 4Q0sn828e2ClzSrXWAtUuIDkwINCzefQc5ICV1bguILEAdRR66cv/1jXdl9aEvRcRD Bhx8pj/CKQr/EPlPqWchTGcwCLeQnx+qsO71Obg5pOpy0+39ert3POkP7ii32N1zeU XveXVnKAn9x/663ekqaHhQLsC16Ik7jDuulgkWxnbnMOCpwuwSCaBDoZ6iUKIiOLGH xkHRvRXlm6NGdmEAOPXnHv5P+44UCyanuBFz0MRONQIWQyeh8mwCBCsqWRTqxDSKDW SKrNb8oYv9xlQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j57-LA; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab 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 v2 11/79] media: rga-buf: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:38 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_031357_320403_AB0072E1 X-CRM114-Status: GOOD ( 12.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/rga/rga-buf.c | 3 +-- drivers/media/platform/rockchip/rga/rga.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c index bf9a75b75083..81508ed5abf3 100644 --- a/drivers/media/platform/rockchip/rga/rga-buf.c +++ b/drivers/media/platform/rockchip/rga/rga-buf.c @@ -79,9 +79,8 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count) struct rockchip_rga *rga = ctx->rga; int ret; - ret = pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); if (ret < 0) { - pm_runtime_put_noidle(rga->dev); rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED); return ret; } diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 9d122429706e..bf3fd71ec3af 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -866,7 +866,9 @@ static int rga_probe(struct platform_device *pdev) goto unreg_video_dev; } - pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); + if (ret < 0) + goto unreg_video_dev; rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF; rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F; From patchwork Tue Apr 27 10:12:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225791 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 D3BBCC433B4 for ; Tue, 27 Apr 2021 10:17:12 +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 84FC8611ED for ; Tue, 27 Apr 2021 10:17:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84FC8611ED 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=KqSlgg4GkrEdZsGFjxuOOr/Gk PLYn3xT/fiNKm/RTYPsRLAK5AoahHRLP8p8YqrFU9h3Cojj3kMeU58qf7klotPQlvM0SEUMid4B2F /GVHVwlqHInIGUuV/TIDOkhykIj/hUIuWmoBUnApRhsbNBlbKvz87SgjkaxxbwzFcZ1tdDSIJv1g+ pl9Kv+suh7sqIGGvfNyygIWo/4BppuwVXdXUtYCmj7MHr3EYc9+QJRFWvK7rtSOI0K00qzd2d+pOx ENkyTsuhBT6ej7RVq6adPq276S/D2+bsWuUZMslxwyo996tcHKdiExAYF+SVMsUlQdmsg5OSEG5JA 0jTvvXtMg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjw-001JQK-TM; Tue, 27 Apr 2021 10:14:49 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBN-LE; Tue, 27 Apr 2021 10:13:59 +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=vvzihbN1sy/O7F4FRqC+uRnmh4 W+Cwi9mL5FNv8rkoZ8hedDOCjuEsUtCcFTiA1APmhhLg2RVCY5vzB7919QV6//d1T47DCer8y+3MN YJImB4YWdAFbmPiwt9sWgNBM2JLXikYCOWwjoqRMXEOZqX2/PwxU5xRjdhAylM7lcf3PJTQn1UviB UGesh8fuUGhp8Zg4Cy8R1A5rj5HVO7w1MIKeFMtx7Ks8YPT9TdRXXbuirzjyMLWQEUdrLiXHEzmW2 HvFR93Rv1Me5YrlzAZA+sgiRL34utb+pUiON47b+eKvAwuLHOuxsFYG+BfNx72k74XgbrffoCJtZS 5XKM4PEg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj2-00Gbm2-R3; Tue, 27 Apr 2021 10:13:55 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06263613D1; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=dO1gD2vCTyNaQMmr4CD5RrufRsq5HOpPc9z13n0Rohk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kreVFPQyyC+gt6dxASA1KwIHM7ks8tRyxNcLuXn/lmMuigpR+ad9uCR0tmJJFUZOC MPZLTG9gNZ2+lQzLNVApsxsJS+GTaIRD8vhzg8lXUqwGmjoQ8ZlOEqXoag/sjjtxWv uO6jW1O6Sa57Xnj2KY8FgESId3A3y+jwy4eXq6/9wJvZbgM4+oxcre+ReRdGj3nqT4 0+CXXauGBWEmSZ/coF+VvxP7CJ3X23rxuQsVj6eisjF2AuBcf5L3Tc/79RcXEbzoBm Kjp+Gm+nH3MSvIKCO98uEPJ1b/BSDX/cGVMzBC3CbcY+MX/F79B8L6xKXbcbrTUl3W YLmslc9I4mHnQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5M-QV; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab 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 v2 16/79] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:43 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_031353_029270_DB3E5798 X-CRM114-Status: GOOD ( 10.41 ) 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:12:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12225789 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 0BBF7C433B4 for ; Tue, 27 Apr 2021 10:16: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 B45736100B for ; Tue, 27 Apr 2021 10:16:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B45736100B 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=BGckuB/snDJfsboUinhUsc3ip n4vMPieiBb52R3iXIpYQNw4mO6ahsF32W9gPRmwDHnUIoal/fiGkjCGTz4IIIHU+1gNhCWGCzzm1d yLP9dWe+JCPlBR+W7e/Pblktt80+ZYAkDftfi872LgO064sLa+JcPI2mZxWjf7wIRL3EXJ9Op5RkS W4PHS2gutOigskmn8QzFdHcrykNsgGWjqZF3Z/GgkZhvcpLbLE67oCAT/Xwrp1qQfZsnBVSH2groW RHA0/aE6N8Dh5S39csebDQAab+I4CZPZcsDjvVcoN3OLjskk+nT2tGQDkb555t+pr81u3LZAaDbb0 1NnYrYjiA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKje-001JKo-77; Tue, 27 Apr 2021 10:14:36 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBO-LE for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:13:59 +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=rKUUiTxtj+QlrM+BbDJiQ1TwM4 wC/d87ZXe+V2wtSS0+z5p8+7Nu8R0CbV31ND2fiTRveakjSi4QTv1GBpZs9KCbFeJaBD5nq4D+hNc ilTSuoy0zaHZXxnFRxEMjejsEsej7jxgxvXA3gqwu4HRBHuVhiRPgN0ia5J9IPJIOKkpTRqYW3c33 DAq8ivPL+xnChnNQPXx6LvMdVDCIGVvtyqaIWAAgN7wtymmTEtp66tyhTZpZsAr9H0VJirZDyxgUq JBTk/H9v6Znmhi0Wd3QIhZdndtJmcfPVf3m76P+azcKKeRWEMcnrvZKxyI+Tup2cqR3GWtonoAsdN 5d0VXWow==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj2-00Gbm1-Om for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:55 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0708F613D3; Tue, 27 Apr 2021 10:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=cJmIogEt8DtaRrLuirE0smJSOENxo/aAnd7cgWYfYDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KZp74C/N3xULsOG1NcjGyCnHrQUbBn7L4C6SjULa6jlIkjkwb4uQjAmyz7MBIatyJ 8aZXyLOROj+YrO2pBurSY+F68uEs1Jq7JH8uqCwePJcN1IGEgiLVpmyxerCcjGmQIf ZTmIUdmWmE3sxwJyOEeTKlY2LM2tJP+uzh4xlcCEuQ3IuqdQWKS9j1AdkFOrYN6Vor RafH87t0RcMEZ2XSQQBWv5wtqRM3l8dW6T/m2a2MOTN6eezeZbhPil2BAoyM/Z8ZFK 9q5GHr2H+784p6XQXO43aCpof7AgRGZF/J7/LD2TXJKgfIX/Wx5n9U0dNdaQ39pRd9 JuMWqXSUso+VQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5P-RZ; Tue, 27 Apr 2021 12:13:48 +0200 From: Mauro Carvalho Chehab 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 v2 17/79] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:44 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_031352_868116_58802FB7 X-CRM114-Status: GOOD ( 11.14 ) 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 --- drivers/media/platform/s5p-jpeg/jpeg-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index 026111505f5a..c4f19418a460 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c @@ -2568,7 +2568,7 @@ static int s5p_jpeg_start_streaming(struct vb2_queue *q, unsigned int count) struct s5p_jpeg_ctx *ctx = vb2_get_drv_priv(q); int ret; - ret = pm_runtime_get_sync(ctx->jpeg->dev); + ret = pm_runtime_resume_and_get(ctx->jpeg->dev); return ret > 0 ? 0 : ret; } From patchwork Tue Apr 27 10:12:46 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: 12225999 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 C5A28C433B4 for ; Tue, 27 Apr 2021 10:18:24 +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 6BEC36100B for ; Tue, 27 Apr 2021 10:18:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BEC36100B 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=BSu2ZoRKfaQ+ExCCAzAm6Xnud akvNbKqcZ4vglOGQ2PiTFI973JVqb0zBiF7YfINwrtldmzaP8P5wTaRgdRfU3DDeoRVgoxhPYHBRz laU4kpFetZdKKOdAm7EbwqFYBt3zP58BLiuopaiEvdAu5M+C6kqnUUn3S1qF09C7oQ4b9t5J/8Sis 6G7uQJ/zSsWnTG1G8RpQiulu6eBCDHcQcmHiX4c3wPnCAxcbXI0gj0HQwB41PL8NO72zKHySWQ1zp jS1DhzpugfTYWpCT79tehLOBy0Agnbn66hj88cXqtYu8iiRd1HPVV+d2xxF5TVgYYebSms3pKFYQC SXRAy52kg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKlH-001Jke-5o; Tue, 27 Apr 2021 10:16:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjA-001JC0-9S for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:14:00 +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=oDH5wxod7AwgdzxvqaD04WYQox lvlwTnh6b5K7mwvn6AZSXdtzXkFxaH+jKtxCu3EYjKF8PuajXkg/pC62lM8VUk5FU7XSakVMbh+2/ bgNprueZx6CUqdntbU7Ep6qCSXuiltfQGlqe2Kzlhje/obP1SCxhCWRLiX0F8k7YKtiygnCetLSWx f0BZkSVX763eWOUmu/6EOf5UpncHyyIP8uNrOxldhQTdeQZs72q4gCV4+Sg3KuFm6kO/TSFpCGsyX oFu9Q0RNkURsRTbkYZANo7LjtEofo1l9XRyfaiWz8f+hO0EjoMVwXyVzIUWBGNDWLSR0XHnGihyWs xHJycAJQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj5-00GbpR-Om for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2C7F0613DD; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hl/iigHU0Oesf/zRgLXJO++yUuqv4vZAop3JusfzFYwsnudK1Vk+a+6STjFmKVJ5K a90uNH8biqOVfPM0kvWAOBbHAmIn0mMUy8D21LXMu+GjGo0NvEbJdAALGMhihek27N fKQsNlLivJ9Dcg3sPs/svUGoUTeSF1v1wTrrWiCh6gYzSp9x9yl+RyqZXmw24tJ3mp +w6itUbrY+OKDLexMH8dmcU1OwZkSlrLiwaNrtA3SS+kNrwmKfUHx2TCJQFMThaBQK SJHqjlKP/V7frEdSh8gPHjlTrr1dGBKARpKtq4RqDwet5P2vfGoy6GTPOVA9QM7fyr MLKKSSwnemUgQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiy-000j5V-Th; Tue, 27 Apr 2021 12:13:48 +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 v2 19/79] media: sun8i_rotate: fix pm_runtime_get_sync() usage count Date: Tue, 27 Apr 2021 12:12:46 +0200 Message-Id: <4e9d12ab641622cf2cd1721c257c12c52271cf05.1619518193.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_031355_970795_2B96D90B X-CRM114-Status: GOOD ( 12.72 ) 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:12:49 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: 12225995 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 890B4C433ED for ; Tue, 27 Apr 2021 10:18:05 +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 3BE36613C3 for ; Tue, 27 Apr 2021 10:18:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BE36613C3 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=Oa0aaom6MNtYnAeFl9TfjM9PQ lU1eD/E9B0fRnfvby977cGw83k62PaZ9CCOHFDDi2yP3IJbs96TFouY3eEf+qyj2Xtno7YEqrusv6 eWcTuH/+X+3yshXUdswuIJQwV/OTM1Am7x6VVuubsZdJUoX6E0fxAWt/SZIcn7BAy7eJRf9dbBmfh lY0NFuaY+s1Nu5169TkLVMUg9ZVgK7xhnPjW11F0YP4hso1AyN1jbZCEQjUUObp1i+tS9ZXy6IA1C 9ulkJxiMOz7sweKwOrEe/q5iXcRlnQ9HwQJLH6Xw5q/5PrPLabCdLAUTfQ1Q7iK2GRUTgpdu25Zyd mvxV/irSA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKkx-001Jdu-HW; Tue, 27 Apr 2021 10:15:51 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj9-001JBw-QY for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:13:59 +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=mRlhHz+TXhBYOhgqqW4JThrnHdpvqrv4T1yGT3S16Vc=; b=gaSQuSZ0hfjtKd/aKnP/j87tfw QXISaryULzrwQwvh0XghGG7VHPyx9IFQzj8TpqHicOJFYZFdDDnS6KmOCgfJRGIrla5ISXB8Cj/98 icqhzw/x09YMCIsOdH4NsUeqTULtD4Ckw2bnqaA0QcRlTKHsGVCvnZ1ZCBOhsyqow1WrabUpaiStQ TvhH5HPsBVzeUQL/9T2kiyaIKLbCvYr4XJQy9olM1yj46rGl4IQHD51O/G/cK6HB+07KAdUwRk/8E Mfw968YSpguSZeBiMP0skPgLGM4F/DjzUJDkM8nUfir7Z15goDe1YSs7dn9+qwsEnqJ92wHQkLmp5 VFpe4x7w==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj5-00GbpW-Of for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:58 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6276C61404; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=WwdunTEPlspSuJNcgiz5VlTq6QqTmYyotSIBFOxVREY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RtG8MWksBzzoyJ8f1T9mM9i2iWpOVxFMvdgZaznoqwOeoaF1BGLfN6hdQkAjTBmXG gb2wIhkMmOHaazVy75eeYno7XXgjTuDTo4qPz5ka6axbr96x+nj53BWjICe1um51TZ Ab2SEYW4bxlYb/EMBtKfknyNbdcyMBUMtn5cwqNvF53cmJ5coNHnmf55kcZuBwLfMK mdDcHBUCnS+i68sJTKVTgsL5OowpThLKgObLrRLqqp+Cgl4+UL2N7VTRjneXXG7SGn lbHNJ4HV7xV5mgvyn2gVH0+z2vWQ74G6QvtkK+B9ULi1pNuLp56InWHUaMNVebMj97 HV5QK/JmPrKRw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5e-1q; Tue, 27 Apr 2021 12:13:49 +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 v2 22/79] staging: media: imx7-mipi-csis: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:49 +0200 Message-Id: <9b52f8d9709e32ac129563f508beaec8ab321409.1619518193.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_031355_934562_E3169456 X-CRM114-Status: GOOD ( 11.24 ) 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:12:51 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: 12226001 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 D1C01C433B4 for ; Tue, 27 Apr 2021 10:18:43 +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 80431611F2 for ; Tue, 27 Apr 2021 10:18:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80431611F2 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=VC4knpilwOnlV8QxwrqSuw6TD h125Zh6mDf00QyDd/INefC22L3dPvoRMNmpW/p0V3C3yiLeT0bUHiskTjQrf9VISNY5L2KR3hz2XU tuTS4kTZQh1hNp/LwcULhjyDwMMMC2VJzESfenmC5kcU9r65m4coh7RYLBZ5qFqJy0MV6K2ibV33U 7TFRYtZ6RreUqPOF8tTQMrJQWuqQ3usGalBjt3yTf0GQtyLEVvr9AtENfDyEMGS2djD7rkhJN8jXb r+gg/ohprLe36ZjgESduzmg73GddrTo+jDhMveeCMkwmf8UvpS/XSYEXUBvsTKJ/t1cF1gm7nxEl6 g8zB2FGjA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKlp-001JyO-PS; Tue, 27 Apr 2021 10:16:45 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjC-001JCZ-DO for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:14:02 +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=vcgSgTddKeT5ZqTCWVDMjGIYwc 2htyStnZfGwENN85+RgWSU6F61l1P3HwiLT/D1jNlJnwjcYPg9zNHIpBVJeRCWcL2sibL6RpqprfX G0+6zHUB/wX5FmD4doNBArdcRDVREwvlrwtPdfinKoLhpqRfk1VvY+DbUY25tPJsjSvplB6aMfjrB mq/aj1cbHcdlKBAY/Y8DhPxwLaQYUWbnWYcbmKHq7S0zol+tr14woZJyYb1+Ra5TjDm/f+es+bVgN az0Kmg9/8NpAs0lkNWfuys1+NnM9Pw5J1/DT17fWWa79JOWwAL+QVljoNtLp+pl9c+XKuBFLUNhmc IRvFjtYw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj5-00GbpT-PZ for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:13:59 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6AECA6140E; Tue, 27 Apr 2021 10:13:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518431; bh=P8ySBvxIssOsYGuosUcRi8p/mrvcDEnJfSep5KVO8S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eONmV9/Mm7lWd/FtO3g4WINxflJmJtpHA4XFXzVRMKKfXnwgMPS0ZH9uy+mCadeGT 5QSjs7E/k4dNVQiEARQRV+kSDoxicT8oxEyt2F6E6r0zC30sPPs7hJncR+mzDYaK4K Xi6kseIxUJtpENi8mAnN9kYD+aj0msQWS6CXByKWHJVYCKVKJMGSMyNN8xoagrFhpe +9hw/9R2IbfXDmUz4bz6ZGtRRxxs8g7phPZipI9btpAMp9eHG6nHZGRoRAZsG6F53b jOsD2M+Z+er6R76BlY2N7x9vqtpaRTS91Nrz0UVyfW4cEmADsEirufNvvYEnrq9fFK YbIdlkb6tBtBA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKiz-000j5k-5k; Tue, 27 Apr 2021 12:13:49 +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 v2 24/79] staging: media: cedrus_video: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:12:51 +0200 Message-Id: <3c993a816dba970cf45d7d9ecbae8b13047ee18a.1619518193.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_031356_042297_30B50A6B X-CRM114-Status: GOOD ( 12.02 ) 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:13:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226007 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 D13D3C433B4 for ; Tue, 27 Apr 2021 10:19:23 +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 4E49E60FDC for ; Tue, 27 Apr 2021 10:19:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4E49E60FDC 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=EQPJ1CdgLGYAnxo+c3YL8nIlu Mwgi8NIPqfLnFJNf6oqVbTi5HVttuw24+GEPj4tmCL9EBsOKwrcvna4EF9yKM5GqCKo5Jj7FzTtbv ZpsSh9RDlTqGnB6oavSDr1ILU8qMNVrg16LDwhPzZ7mAUDGDB/1ObPsyUfDN6UKCjhQTZJ/Hu/maE zGlnZ5fETSPec2rOTIyundCZma5JxTeqpmctiZ2CaNBqFBrBd3ax8t1Ez5cd4sRcWWFZZn5N4AqHM Fd/KBGG/7PLrMb0kcgbSVv7QADVdG/8dZiGJtMwKTN3uavnmbdDlnpuNxcYvR6xYedrYnHxDwjtUu uXIZyv9LQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKma-001KHX-Tt; Tue, 27 Apr 2021 10:17:33 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjD-001JDJ-P6 for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:14:04 +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=M6ZX4dHI0yaa+U4NpbNuh0EAYR Al8AnvwR1wY/8hB+iMjzYcIyqHtYObZ+EnUsoARX7uV3YLdYNZnRkRciZqlZdkQnjAfKbTpCDAtOe PCmLV30pA3HAK632Om6Osbn8EeNvsAvU7uCinPAUW5C545JxWmVH7Bz0ZPr2n+KEmpg8nP8Hwlw+c GV/RHmyVj0Ylf3xdJSU92gueYmCDMenstjlQpzND+b9rUFpainHDiUI8Ivc3XIfsIE8hhc9GbCNsG U+XE4XuriWH5b30elk2KSvfOH6jWHmosVuO1IpgpK4i4U5PE+FuYvabzg33/fwjqc4I1ysD5cpj8r AwhgMz1A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj7-00GbsO-G6 for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:14:02 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 417B461924; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=vqCg/VqSgTT9WFZipquUww7WREOlNkMrO5HLAuTAHyQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ec7jCkiktrAFOKDsD6WO49JQ3NMdF7rHf47jiJUxfWvFeHIY6wItvaM/CO1CxLXZc mVWEHSU+eHS9oijLrtopjzkdh464OSazv5dTfMEkeZJubqSW3wSnJmFVeZiKVNL9I+ h/Ko+6LjgDI91bqPhDI4yoo/Pa6EK2ZdamzEfzY4nOvBLjQcx2glTqlao9Xhc4ZRY+ 1/gm0fxVX6JVcImQusYic5epwppK+LmENx0fvwExM2SylXEdTznFCiEUM1b+rv+vO9 sdSYI/uoa22o7VkTQHVZXcZLov9KpaEjE5JHMgvx8ZhoBP8YLn/xe7CVN1tSH5FTME zgt6IzZ2hnU/w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7a-Er; Tue, 27 Apr 2021 12:13:51 +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 v2 62/79] media: exynos4-is: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:29 +0200 Message-Id: <549d4b739a70d1b273590693a14cf9c0efefa8c1.1619518193.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_031357_625519_030D4918 X-CRM114-Status: GOOD ( 17.28 ) 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/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:13:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226013 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 CA6B6C433ED for ; Tue, 27 Apr 2021 10:21:24 +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 6C9FB610FA for ; Tue, 27 Apr 2021 10:21:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C9FB610FA 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=HqMTMuBeFg8TOo2NR1KFxPM+L 9c7EQVGrSeI8pO3s4mjFzSXUalzydiqxbZJRTzZdm/ghFG/YLV41Mqky6ABqarKzdA9H7bFdN80Bf VPikZLQhsmFmRgCKYhMr1zlQgmHxe2i712jpquiS13O5TYF3fSNXSAWCBjkxbpNe5HroRuOE98fSj LmuAVGJI/fdvDtotTpbZwmCgUd64NYoM07GI2tdEi7D+YNDzN0UrVe1UxWlqDei7Az7Fi4/x1xKRu OeeBYi9Z1RcvJGFjYYYu8PVBL0RiQ0Ju7ku/jDh3cp3dQsFpDXOitDY7A/mfvmOmxalSxvnplPI+r 74CF94MdA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKnU-001Kgg-04; Tue, 27 Apr 2021 10:18:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjE-001JBa-De for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:14:10 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4995C61929; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=TKtKuWw4arj9gE1QW5A97zHnmgQIngfUHjaR8gvLIr8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CXnGRQfdAOPG4LJPaz3UjdbjxgfUeP8HomujIYINFkYzY4GB4o8CWCVIW2GR3ELGc 5VGBnYyV04LVREAkDn5MotNmwlQp6dsIqISTpDhAd0dhDLLIGNBe2Gjae0SAUi4ROq mGKXux/PbUCtrheYJMPCFBkmymM9RYnDn7xFnsaP9dFf5uBgC8V34u5OROpWfcBFAd fGqm160n6TzCGEFuhYSOSkSzR9TUP4iZTOz7JlU8tNCOFCEkc0S2vMUYHbZbwtWV55 OcMo3vIL2HzqIFRk11Kbv5ZxQXw7dRpm98Taptk8whbD+RAHd8tH1iIy/UOaMML6X5 KN+ZVDA5jsD6g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7d-Gj; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab 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 v2 63/79] media: exynos-gsc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:30 +0200 Message-Id: <6ba2ed04d791b8a1529977920bcc3930c2f3238e.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_111407_930759_A80CDCFD 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 --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index 27a3c92c73bc..09551e96ac15 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -58,7 +58,7 @@ static int gsc_m2m_start_streaming(struct vb2_queue *q, unsigned int count) struct gsc_ctx *ctx = q->drv_priv; int ret; - ret = pm_runtime_get_sync(&ctx->gsc_dev->pdev->dev); + ret = pm_runtime_resume_and_get(&ctx->gsc_dev->pdev->dev); return ret > 0 ? 0 : ret; } From patchwork Tue Apr 27 10:13:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226005 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 45C4EC43460 for ; Tue, 27 Apr 2021 10:18: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 E2E9D60FF1 for ; Tue, 27 Apr 2021 10:18:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2E9D60FF1 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=AniJy0MDOPgogzgwzhA094NdR 5oObwG8YzYsH8nOc9eL9FESUwP4XRB50EOAYcxAkrYwh9LZx7+ZPsPJ3q9k1R5VhDlPWSTzwILI03 +8pOkDVLExnuud+KXvjwV9QY6i691KCRnLPg0GeAm/hMs8qE0MoFpG2Z0TIlVLiDw6iMvsbT0nuuW XWO/XuIqhoxtMxNe1fdIR/DfZZhZZ8vLKw0lan46hHL6pnJ+EGqKZnfaTe7grYWikYfKuI+CnKgVm mt3zDcULJxg8dqF3QIuz6p1doPvKloMGyjbhcRV3KDTTXcQe9KwvA5l+3qeEqJWKiRinVdFcituJW uJGVGlp/Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKmG-001K7w-Ad; Tue, 27 Apr 2021 10:17:12 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjD-001JCz-3z; Tue, 27 Apr 2021 10:14:03 +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=Tbq2h8KkLajLj48zAWAogMGBq9 6G8h0WMPlcg5VchzrzaTLsputwZQXyH0GubJMJ5slCVxNOSTxwmbNmXsj6evfQhb/ev6ZF/HQTsZ5 5fs604f3waBNZczacWXjr6D5tmEquDG2Z2VFomQZpvXtnX89n7LvrSWAsoSU8j78X8wR0dH5ZS02+ euwvY6rvZFVezV+cDBlUX45iPEfsyRI07cg0+Rfxfbv7SWeZkriUD3vY6erOBork2H1rMwjYFTtIw tkN0RnueCf7yU08ElJEk2QGjia6p+kXVxAmX8ni99Ir5lV+D2kiCJec1/bvmb0jcweEH98zewB7yH XhV9jv6g==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj7-00Gbt1-NF; Tue, 27 Apr 2021 10:14:01 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4F1D46192A; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=tu2hhB6CHAZbCfvPd96Qq+9zsUaGe3IxV7AH+2XbuEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8v5HNvwglZGfeJ/zanLqWX6BYRnlg8cTv+FYXIptUe5TPaBW5KTXFhjtUpwp2lHq siVH7DddVKZmRoNQIcCgcnlCJA7++C6asnFY7HEcj8RWi9GEBl7/SHhftU2guuh5N5 V1BAqbgUMDNac7KloMdVCUFtsXd4BAxVoLtr8vWrcr/Y9Uck2NGNWl3xP+GrwLFDcu 51iNqNVef1aaIDFapLKKAQHg/Vk+UqMJF9IX3+3mE8MZ1GuCgICk23tZHMdUxGK3gd jOCidh4U/Nwgl/hhpjIb3HWsA0nLVp+Rs8akCEdQxoOpQCo37tZSsVsTp0PRYXHLHu HSiU+z/0wgP5g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7g-IL; Tue, 27 Apr 2021 12:13:51 +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 v2 64/79] media: mtk-jpeg: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:31 +0200 Message-Id: <6b9c896cd16a090b334dd657f8937cd436288ba1.1619518193.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_031357_808939_1390F6C6 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:13:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226015 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 B040BC433ED for ; Tue, 27 Apr 2021 10:22:15 +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 4ABA160FDC for ; Tue, 27 Apr 2021 10:22:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4ABA160FDC 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=RV+E6aGjonZGcL01AMM9VAMTS d5J8k9kxIIo/uS8Kg77cuOOgF9H00bd84+x9Of+1GIOgC2qJLjPlPeWbvYVzQ6+tVOhlpUZ6/9PUx Ty4FORmfNHH49QjZnUNegu8nqQmq23AMsgwd1TKNHOGnFxcfq72xuOd6tx7xlDg4E0NW8TjUXpZxS A7V9QKBN0VSoAY8XQXEpi+wz+CYHbQZvchmJCJn+yktQFtlQxEL9kza5k4CiBhgswnL6PdnZ+muoY sf6eV/ulQTd5ECesdZWVARi3vbyelxdQ/MsxMVV0COkY6twrBv4C2VKnhApRk36JyuwQHFT9VI3Av ODZXoT1Lw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKoO-001L2b-AV; Tue, 27 Apr 2021 10:19:24 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjF-001JBm-Ha; Tue, 27 Apr 2021 10:14:10 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A85186194C; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=rChg/pXG2Qjbehywcb/+z5hE6+LFH66GvNnoCtLFEBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XSkxcPymxCcHvHCHnPGNTKlIe7N/iWkE12x5+iF06VhEniD4QeFLHL9o7KnQB+6gf z4w6rnmCHtOLpZfpsniFLxW1j67cKbiF5B3xZQMPX5VM+R6ZNBmTJnvUqrk+yUC9KL 25AEapb+FpzGnfeGIkYNUyaLx/9e0zpGHp6v2p2bMvObUY8EyraseE1M4pdSdy7Bxk drk2/1vsmSUype/gw8qJUaMh17jCJiAZmGkIge8RsuRJs+WJy4bkTwPUIlUOWMEMLf Nyxv9LZ/Zaq1kI+6vFlRV9c7q7XiWJWFVt3MBptI/LPv1d3x9yScwa3SsWg2HzjRab T5IhMmxNp2Uag== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j7y-Sx; Tue, 27 Apr 2021 12:13:51 +0200 From: Mauro Carvalho Chehab 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 v2 70/79] media: rkisp1: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:37 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_111407_804146_49E31D62 X-CRM114-Status: GOOD ( 10.41 ) 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:13:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226009 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 D2B88C433B4 for ; Tue, 27 Apr 2021 10:19:46 +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 69EB06100B for ; Tue, 27 Apr 2021 10:19:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 69EB06100B 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=lJXlXdKdydrn0d0nLZY66620F 7sY5XOVFou9ODp8pLMXDqfSaegCqpKru1VIdVaJGO8P6RCS0mMIyV6e9igdEXt8BMS5NmGRS0UMK2 YDpEJCWQvVxlHsHFiXKAQcOWiZ+Q8LuQBqBnqYvlKkljnuz4ab+4xgFyxRpV0Gd37SQWK4xM9FR/Q mzeiQDdIMFmkuZsBXXW0SgM0YBOKrX2dXErMvFYwyGe6RgAzolSyq3DN31ksfFriqEKcn+ogzvat0 N0ixhvjlp7jeCAZ6F06zQxNsbWCQeSoQS+V/nbRmth1ljJCkpGqXZrVOQhoGRD9OQ/qNDpAQcGjJw 7qsgSA5Xg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKn1-001KTm-JU; Tue, 27 Apr 2021 10:18:00 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjF-001JDE-BP for linux-arm-kernel@desiato.infradead.org; Tue, 27 Apr 2021 10:14:05 +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=3Cd9T4s6rww9HYqDeK0lw49kWH vh4QTVtvBVJ/uB0M7qF5RydtEcJFq5np7Y4cEqZxwxsB5rpLE92BxmtNEKbHWCtsCHe06+4dyheFf HgZbY/iy2yRri43ONc1PCXS05otEN88Hd+WxgwvPkBX6x8zxBPEu/iBNWPz6f7otSV49rZRw/b9ca /SZo30qVwW76bkCcs0uguHh8f1uG5v4lmRHe3/jAF+loU2bDviYCFvIglFRz5epnJDftwHZ8NI6u2 BktXJvf7qZLwugL57FDEfMcRYRzofgy9DshM0OBSrnA2grQf4m9HQrXp9G7DWppyykoF31iM5e3pm bqJITIlg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKj8-00GbpS-DO for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:14:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B99CA61950; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=GlCvanyZeZRx9KVkDMbg84X3Nl/epjQxFII8vak4mR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P7VHtJ1uz+zwh3J3M1NM5EyiiQiU7ulWuh6jsYSo4+uOq3SQPWkq6fTPen1pJxPic XZge+aium9DyPjVn3aej1TacFAGCKB/FO9CcYC07k++TYdVTQh7KU6eQQ4d+PhW93B 5gMrFDssm24BeJuEEqie/LZvrpP7n6EXOeLMYhA8Fx9fsL3BdtbjA2IIIFpQwTgbgh oKvL7XFQagk8hlDPOtpjI9DKVFvWT8oo/TTcrRJb+PF3xxhCEGiARki4QhTm6ZH3b3 5cMKb/weT7SG3Z6pUFWZdavFIDTTmn8GD5u3QsTVfWHV2bjnpwCt/5vhKstSwtWr1e 4Jx9w0iYp2OZQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj1-000j84-W0; Tue, 27 Apr 2021 12:13:52 +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 v2 72/79] media: s5p-mfc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:39 +0200 Message-Id: <1b06b8e70c547f8bba0c154488f9f8a8013a0ea4.1619518193.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_031358_512898_0367FA89 X-CRM114-Status: GOOD ( 11.10 ) 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:13:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226011 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 92188C433B4 for ; Tue, 27 Apr 2021 10:20:47 +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 3BE1160FF1 for ; Tue, 27 Apr 2021 10:20:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BE1160FF1 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=F8cR4h2iOI5EHl4xt+1GJBlRu A58Bocm67I0tm/yDr5KK8SdJNXBcUTFliNSTHlcrH0dqlbTuELWaIVYUK5JqRXfZe2XQbytzOczaB wSb8/GPMfX0supg2AmXlcIxKlM8g8rXSpjbM7bm86zZpC40Arei66touBOecPWqh0v4d8Azr+qIW8 lBl0F66jSGdwircxEjXCHAzalPkkDMEJgmF97H7J1MBj7QuFIF4PVKkPAH5aPBhiAb4NJAJid78yh U8WBrIKaZI1FdgHEU5a0hwXONRFr3/D9onmNrTFKWasGbsVCGff3QkyPlc73fpYXIf1z8gBErPd2a 8UscdgxJQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKnu-001Krd-61; Tue, 27 Apr 2021 10:18:54 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjF-001JBr-HZ for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:14:11 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCE406195E; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518433; bh=/R60wucnhMxzatTcaaq6aX+wA4KyHRrla+Ogrsx7GxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZ9IAMfTbC6VCIWCPQlVZ4eZKImP4UuqT9UAattBwUeM/l8qVA4Noq1J7332fl49c ug7YMVGmUJ0d1CgHbsv8SOYob4GcnKR1mdjUe128o5oRbp/PHT9sjwKcANpAzOt9GC 8TUDuldsBLF9F+f6rkbpa8VVrYGzLE9DM0AFV6pUGs/cV+trIcFZD1Q9tINtrZ29Ai RU4FmZTlQdW+xhZ7w6ktbcDzef+/f7qc3xjYo31aaPkzZc4UdCCpmGPVTlnbGdjlBk h0FBsIog30AT+u8t68xZs81J5kjlh94OMVu05Zc/tofpbeqZIjOiW5Rfw0XSpSrd3C TtUvtp88E1l9w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8A-3K; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab 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 v2 74/79] media: stm32: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:41 +0200 Message-Id: <138647d154e523f6e0ff04af1dd94e8bd0facff3.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_111408_476187_F5B24BA1 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:13:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12226017 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 DA64FC433B4 for ; Tue, 27 Apr 2021 10:22:33 +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 6F73B611ED for ; Tue, 27 Apr 2021 10:22:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F73B611ED 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=k6EmvsejIT3ry9CaBaCYO4SJb bNrI8zw8I7iHWSX4VWU9PGvGahTYug7WlsfxWa89psD7ssfvTnjUqp7X8WFkLZonhdMshdqbW1BbW dm1iskVz+GsXBLjhc08ezqCC7c1Mh2l8xVNVvG+A8VTVsSVSfP1Nj0D2BKRXRCc5VTqIvtYahfSh+ j95e3BVNKEQjzCzkoFtCMjmPJx85+trhKrKFAk0dvl7sm8byum39P23jYokp8phuUv85haS+9VXJD Hp5PLz8mbsuVzQUauhJ6oJzJ9XpHe9cmYA2toAiLFxPSwSdC6ybjR2P32kvS8WGkZbXNZ0PRZ4C1X Dctk2+iDA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbKos-001LCC-NJ; Tue, 27 Apr 2021 10:19:55 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lbKjF-001JBu-5r for linux-arm-kernel@lists.infradead.org; Tue, 27 Apr 2021 10:14:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id EF8AD613DB; Tue, 27 Apr 2021 10:13:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518434; bh=Q1WsziPcbnwAb2cpqQFZbO8zttZnZQq1oIpn6yJZI+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eOxoBc6fX8LQ3nxyOd0t2RIx/rdGgjYfc5pU2Uogwl6kdtZa9v7rIkXdJ8X2UMoUR 9xe3yaHftnVjn2wEnD7orANu+Te1STBrC6bv+8Cri6rd2+yG0ELK1JCNedgn8KmRl/ F6UNsw4VGQWvXFr75BgLHPB8fxn5YaGoLwOE1Ta0gsE6V9AqQoK0M9AUkI/u0DHXI5 2LS85OiasiI5qkpnIKKnPiEpWc0LR/AiQCSw9kdGTI1Ss5uPanq6LQx+G58VlLgL1U PNq8KwYSg7mrpWYTzWyazSwmh+bfQIV2VqDmKo1wXajK+FzJ1eH0fFxJnjhyaInjhj dPoD7fly50gVQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8D-5T; Tue, 27 Apr 2021 12:13:52 +0200 From: Mauro Carvalho Chehab 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 v2 75/79] media: sunxi: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:42 +0200 Message-Id: <8c9d978dfc49ea2de6a1b6cf5b3a9d647e6b1cbf.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210427_111408_779476_08F4C92B 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;