From patchwork Wed Apr 28 14:51:28 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: 12228993 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,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 1493BC43460 for ; Wed, 28 Apr 2021 14:54:53 +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 BCD0A61442 for ; Wed, 28 Apr 2021 14:54:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BCD0A61442 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=l/HGr6lO5B2FKFzLF2fqrENHucm+PEF0E/HJeyco2Ug=; b=n5ohmYpeVNuJlU+BoiLineok0 L4qYjXkJ8Iyel6sctqwLWXyXGgvtrlEJ9hYYI1D6TmAaAWpFgol87Hni96j38bsxnDncyOlEin8Ty rqxEShXq/dziyeCIexk9wUE+WoWRqivmGAYsvDoNGYDCsv/cYN5/MhwfgU7mP5wMyr0hXZcISqsE3 iCkhdhZWHQRcn1XCFZecQswThwaloRemEwlxA+d52+myHpUIgb0m5lOiellHcNIyRQvL7QdbmzZNy tNhpJaw+GbGxkYUMj4XiqI/ShJ8DPhORUDGQ7PQLpr6tfTem1t5kvRez+Cn6CVKNwMmXnC4J2DEc8 kQpQiErpA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblYa-003fSF-P8; Wed, 28 Apr 2021 14:52:53 +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 1lblYW-003fPh-45 for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:48 +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=GFLJ7TiMNuV9C/OfLDGDoSuClJI/TkxKXHwVzD1nDVs=; b=mKo28q2HLhhNbijmZ2LgGVM06U hCsiIppemOQmk1wksz2ve0nHx7baCEsaxwTuix9+5Ex3rf93o71uzpi9L81byMV3oEKIasCsbs0YQ 8coAv/vt5fo0Q4Vniptzd4bwm7y+IZBYsSXhEeyRQ2wFBDrR9Pm3mvyadQ+N3Hv8thRqYuQVdW3EH g/9i8gHpS/uctdEsODADjGCdiO0pCMZGAr23klFjbQNyLXf9TMcno71jgzdGSA9F/DokE0ApWJlYk MN6UCRrCzQEqJlnUUSB5oX8QM35FNiZ3kbcAF71oY41woe85QHTp2MaeFW5+U2pVg2oju0vHQy11Q oszZEpOg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYT-00HVNg-A7 for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:46 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C8FBF6144B; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621563; bh=gtR1SkTiYJ9WApgVEIkptCtIXyrWDvbS/bAOqzd9AhE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gui+r5mJheRBaT22aO45UqdlZpSqT3zQNryWIJ3tgxQsIurCryHjrbsq/jbdeGMs0 023zuja4D3XR8G280J5skQNG/R3/UneayZ0i/1mdelWGommQEvO+7uNuPLCYV0PcZt bJ+OME3IvhFDTZlsy2/+Unz3JxPpyv1gixe0930RqL5dB4bA3lidAbyXDsC/o4+9Y5 NzqOEeyHarutwxhTJcGPCVObkCgs1lJUpSxJPIHPUYKMIBqnFsgnOmyBKAs/w5Ave4 OxHisHh8zhy1bGGNpC0edJXgfLrysSEh7D3j3Bzk4hfi7r2tzmoHEvuAU4vxhqR6c3 ycWEI0B0NRP+w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYP-001Dpv-OZ; Wed, 28 Apr 2021 16:52:41 +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 v4 07/79] media: exynos-gsc: don't resume at remove time Date: Wed, 28 Apr 2021 16:51:28 +0200 Message-Id: <210a2eee928d2ae7aee65e177f20cfb3f00e29ee.1619621413.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-20210428_075245_407896_44AC6FF4 X-CRM114-Status: GOOD ( 12.56 ) 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, change the logic in order to disable PM runtime earlier. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Sylwester Nawrocki Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/media/platform/exynos-gsc/gsc-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 9f41c2e7097a..8b943075c503 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1210,18 +1210,19 @@ 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); vb2_dma_contig_clear_max_seg_size(&pdev->dev); - 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); + if (!pm_runtime_status_suspended(dev)) + for (i = 0; i < gsc->num_clocks; i++) + clk_disable_unprepare(gsc->clock[i]); + + pm_runtime_set_suspended(dev); + dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0; } From patchwork Wed Apr 28 14:51: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: 12228995 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,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 ECA50C43461 for ; Wed, 28 Apr 2021 14:55:13 +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 4CF1361441 for ; Wed, 28 Apr 2021 14:55:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4CF1361441 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=rSpl9wUgRTpDIIUbyTdts0S4R D0d1yIUot52iB3LvMZ7nbDzO+VE3KVFdrWnaAGiU6BCGcw/eEaDDYyo+ob1pXHPKqDtY+6l0aO0uK UkMtj7vfosDbRv54SRHSGCYWp6ar9hlkRh2rGiGe+HkJ0iYkQgRGXip5Lm24Zsj7qgsG6nzrsef5V Uqn01woIph2sSlmffIps05sKsFajTzW1NkfOIesDZZQ6o/GjT5IvuBenw7nuuPNqruxAUD04p5iJl q9G84EYFQIMfM25ZPWAFLsCbn+EhlveQveMMkIymAfrcvk0xedz0M3EcAVsfWZUjbXfXGZ6nyLckX l9KncgSQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblYv-003fYe-Hb; Wed, 28 Apr 2021 14:53:13 +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 1lblYX-003fQb-Og for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:50 +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=DcpWuSEei2Ez0huLs2VLFm8kDI hSn7TzN89NffcTmbyO88kGYVHuoF3zQrrBE15AcVS0HZZkgfdsBoe3RHZro2Hwz5WC6/jkuzR3DB2 niQuzg+dxzEIfDu3Vz8gdIonfVtUr0RRdWeN22pwNg8pqd5qEj7LqD0TpeRIL83IgatHg5011+jvg iVDAQ4OJLA8J4nbkn/LET+avcKCnUDvVuM0AxPaQj4dAHuDknH9YH3nH+soM/wdxd7OEo68wccqh4 9HIDrfr1UE5V4ztv4+DJ7vd2Cdd73rTA4Ej0i1az+oshA4qYQ/oyPo+JdhC/t4JFfjBo6MAv14U6x qCYDGgBg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYT-00HVOl-Pz for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 001F861440; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=7cvQL/2CEUShgMHfIXo5pZaMj/4OUeemdQZifBElsOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmMpvECgadVQ/lFWxH3421LB/XeNcqsauk/qf9lufWVYHku2EEci0Kn1vPP5PsPpC ln79bRE+1PEHpZy1rv8FkHNJZkmkLeHMQSMLCS5x6ze/T/AoxkmQNG8Jq6Qvah2P9N dB7uMQVQvqVLJBREeC7RNPNpWM1aH161gq32I4JObh6y9WiAn7wypz9BJX4aih8qw7 K1p1LUMf/jXjFajdhivMHMVFYY4oJ75Iz03n0vwrCxJthTzNF481hHb51cmcHgkguQ 0P2Hwsf/cjBqRvXbDeqHUxQjNo1WTwXYls+zOkJJqe+CGMHKX1b4vufskiuI69uPMV Bq8xy7jHLM4yg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYP-001Dpy-PW; Wed, 28 Apr 2021 16:52:41 +0200 From: Mauro Carvalho Chehab To: Subject: [PATCH v4 08/79] media: atmel: properly get pm_runtime Date: Wed, 28 Apr 2021 16:51:29 +0200 Message-Id: <3150349be99187c4f9290ac35d6227bb6a83519b.1619621413.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-20210428_075245_959058_865E9039 X-CRM114-Status: GOOD ( 20.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: , 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 Wed Apr 28 14:51: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: 12228997 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,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 103B1C43460 for ; Wed, 28 Apr 2021 14:55: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 AB66C61435 for ; Wed, 28 Apr 2021 14:55:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB66C61435 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=Xvo1Q/IwtxWtcRZFuI/Tappjf c9WT6GO/WuMeuJjh/IWZ78DxRXX0lieZBxmC2S3WY/TyWZ5sN2YSO6akIdfHrxiLxyigAhXlM2c4q wNYfpTeWbJJCmZC+C18db0h1JgZ+/Uw1aeaMg4dgRo9Am6BPed8XDxpsJfYcUx8Mc3Ql+4Jkbp9XS 96K0XMqGDVG633t+YvfgRZDu+uUcc1qhrVWNR7fEsVHfZTO3eUZWAcUyJo3LGZZ0YegEqqDH3v782 ru4jWALNnYrN+AEwMwUhyVkYBI70E36TauhCQQBV3U6ynED+QUPHt9L5lgNTUSJjF7F6+L3i8Ix58 0CRq+YBPg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblZP-003ffh-Kb; Wed, 28 Apr 2021 14:53:43 +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 1lblYW-003fPl-RT; Wed, 28 Apr 2021 14:52:49 +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=lnsM/mYf76c+BrcV/37xQR/og1 6tdZ71S7BiUkkGlwKnrZF8ZeuIna3llM0HHhj61Rq5mrIzJDJVVZTn3d/66XwcG0vpxqr5pUBCMTZ tUhHLquGGscNFJc0iU//uNELUiC40eyL4V/NK185dhINpR8r0jqRdulNjw8yv2MxAkz+KtpnUSmPb Aft491w0R0XxwrjQdZg0IFcVzP/smHo9gdyL40SNZw68HCDCp7gMyl064WZtZsei5wbZxW8CbyX0P 1ssSdIDBUKh1Y/qQKSnzX/ZpbOggE1yXjXWMtmRLds9ND0GaRyeco5yF8ukKnyDN+MGOcPdKsofF4 cfAIDAWA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYT-00HVON-ID; Wed, 28 Apr 2021 14:52:47 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id D39F46144E; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=XfZSeMotNFyXbfT608pw1ECU5JJkssXPopFyWbltzaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gQMN97eC7BEDIz1pxwojfxcjha4oPcG+hRlJfly/9mEn3EVUjF6A17eUhRaUV4Av6 9llNqcINPObifS7R+KKJzcq9sElWMQUcLuEgUGm4dEcPAo7WPuTsJBo8FAKaKUj9Hk VsE0m0+uaGwgEcNcCKy4FE+EybZisDq15Xlqw+m72JjyXstPa88Kj6is8ypDBGKPdI X5k3QuLFiBcmGJ+6I0pWZTX0FzZ3AimINfu9/sQCxIkKFaooCIrQkh6kuh/y12/DqV q/M582iW3kDaTv+n6EwJSHs1PeakpZmbEzfwaSOI0e14HbJuwkIcKyqgVAiYfHvp5V b2Ttn7u9UJXRw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYP-001Dq4-RV; Wed, 28 Apr 2021 16:52:41 +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 v4 10/79] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:31 +0200 Message-Id: <39851c54046fa0d63f34549803df3388361828b7.1619621413.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-20210428_075245_685247_9BD4CAEC X-CRM114-Status: GOOD ( 12.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 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 Reviewed-by: Jonathan Cameron --- 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 Wed Apr 28 14:51: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: 12229003 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,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 6479EC433ED for ; Wed, 28 Apr 2021 14:56:39 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AC3B61090 for ; Wed, 28 Apr 2021 14:56:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AC3B61090 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=hK09XxiEgbfRV8P4Yp49yn8fu 9FDJSJZTjF/tuORnEf9D7SvF4rsABvv2i8ROByLdVg5XhLxOWWlRV1fdlTCJhgybnEQF1EGX/aHU1 qWlOcthQ1unB4cget1TElx5BdhO38DiFRC3kIPAsxrg780y+MThX6rrIeos5FJ94Roes8Oq7MNufm 32SDbp2rK/VNcfVLzq7TLa+Wqn05rycciMqgHcHl3dVtpEAtKyTbEac+fpA13biBdodwtc7+Nbksv SN1C+K9mVzqtHwfcRV9W6GDMltAD7+Mqphn+4HTpeXp4pXgPWg2h38bbbiCwXDsGOBsmWQXioxcm4 K4UNDl8WA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblao-003g4U-E1; Wed, 28 Apr 2021 14:55:10 +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 1lblYa-003fRs-3y; Wed, 28 Apr 2021 14:52:52 +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=Vj0XLxQ8MFbTRNFQdjXQsntnPt e35+WSLRm1GzYtSof/Apoc3JGP++anGjC9pWLbjKF6zZw9XK25Q5UPaKf5m6cImmksj++v00KF6nc enASnybDIGlgwN5UJNvvyDMXT46/AMcwAF6dZYGljyWP/JIRG5+rG69zb/AGzk2/r0avgxAKRaq+9 AEnK+zSQtZ/79D24/epUx2+v9RyMYO+0mKopVoj3ObZRGMiIJmsRj7eHzorlNykTdczh/Mf8ETii0 /hD7hGkF7Ef2Tjv21q8kKY8uFWoWb0QmirSm50LASYxXvsDe+XzRfq4zN//4C7EWloJ65lAsa/hPt vp1LUB2g==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYV-00HVQU-Dw; Wed, 28 Apr 2021 14:52:50 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22A4F61554; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=dO1gD2vCTyNaQMmr4CD5RrufRsq5HOpPc9z13n0Rohk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kCX5EGCo/+tl8FiqD+iNAbou4vWiupP08Ja8L3uTC65gi9JfE/CQToRBSiYRBXdk0 Yw2U+kLbsDYq/XQzgAkCxFm72cVF/5JmFhTv1h4X1tfjAV/hScgHc2YCPzGWFCeGfQ JIT+/ymvxUOJ2xHTBMTy1xo8ACpTLPdnt0UYsDie+L4PRYifDpexKYGHf+2BrTWP+j 3D47LMx6DT+8/l1DAYIjaWS8yV8QCKuXDo8vOibUBAyxBLTQ2oj6O/I64F6hSHNC5p ATCeTtSBNZo1zWs8rhdRgNsPwd7kiww9HFQS0W26E1NYNcGyjxuzjG2yeBylpJ3vC8 XL4KE9+6Np9Kg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqM-0u; Wed, 28 Apr 2021 16:52:42 +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 v4 16/79] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51: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-20210428_075247_584200_4DAED4C9 X-CRM114-Status: GOOD ( 10.54 ) 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 Wed Apr 28 14:51: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: 12229005 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,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 D21BEC433B4 for ; Wed, 28 Apr 2021 14:56:52 +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 8936C601FE for ; Wed, 28 Apr 2021 14:56:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8936C601FE 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=tMVg75tvIsclvG3h+faBFRNp/knYqw7C6TDz3eTT+us=; b=XMDjht/fimY6aelidemRycokY vsJJatUjGHdtkqELO+t/bY9zJa7n3/RcnrUe4pCDzwuQm49IYRH+uaz6uzI5Kikknm2EjThlE6/kG agfwL9KFPo9015ltsO0NO4XtP0bi+5/z/q7zIZi0H/TCmlsjm+GOB4KlVLhVGI08/Q/04+sd5Uqa9 qXVGlmiVHR7Vihr8yzt1wzmzR9NFFmNZwJtHS5rK28JphnkklwYBuSLU/Sbg5w/LT/wmNIB0J9NYl QJyxh+n54UCKAoCqZiPu5fC2iF3X1TnM3BGH6JO0vxOQnSqJV0yWZY/0EJfAteQTY2JUGpyDBDOdc Foqf7/+sQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblZz-003fnY-Fy; Wed, 28 Apr 2021 14:54: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 1lblYX-003fQi-VI for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:50 +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=1++ipKYspVVkHWV8NBkwkiZMnEbLSuRUdF0D66oNe2s=; b=aZsPCmc48Wbm8wjaczF99mVODx xHZUlhoIPXRHcM21ltzRJl+xw4RLeE1Dne4HKwVfwVvT1dTp0CohYSZRviAmLBCunNqL9ebZSCuzW QOHRW3YEduLxhCC0C/ITE2iqvc+mAY0s5qUalP0lsjCxAAUJ53bmZj240dvkkBI+kaF5gq32GwTFL tGMYa7q0h/rbnNU2uyW2m2ug/WMDGXH7al7ajP0BS+g13WdnrylHAh1T8I9ef/79q0klQNf/zm0Oa Egb60pBfO03XBmYqiK0hjzP2cvM2Os/GTTmrEgQl1y3C9gFxg2r7qdsSySgkt4z1RjWUalWtiDNSy QCInnt7Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYU-00HVP8-3A for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 104BD61482; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=kZnJ3c5lxpnyMUPcou0x/B7YpZdYmZe9W/fJf9NvZfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oSFD5gjj1UhSA5WJUYg4n0cCSF6kFkwx1Z8v9LX72qbiifLtfs4O1M80mPTmB3eiD 1Z3J6u++rlX0YrXAOv52opoAPVUF8J+4HEipvqGNBiUUP9+sRWU+o5F6usoKHSmFN3 cw7tzFyLyyXm0tbSNHbbrYXx6bp77puSsAxEskJJbQiaGlFvfthvfT2F2fZPAbuVuZ hR4kRBVabfZyU1ygSCPEgS/ehEcYcOWjh/j4SrJb/vQpr/uvfzRu+ku5zpoc3/2S4H MdaO1KxTiCxV9v3hblGbNnAwcEBnkLskuGC7XS5upffVde2RDJy9RoRGsbxw1N1uNw 70d/68RpzcNVQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqP-1s; Wed, 28 Apr 2021 16:52:42 +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 v4 17/79] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:38 +0200 Message-Id: <83a1f7979382d5d5c44964baae819589c94d80c2.1619621413.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-20210428_075246_188915_65C8A531 X-CRM114-Status: GOOD ( 11.21 ) 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 Acked-by: Andrzej Pietrasiewicz 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 Wed Apr 28 14:51:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12229001 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,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 36742C433ED for ; Wed, 28 Apr 2021 14:56:34 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D152B6103E for ; Wed, 28 Apr 2021 14:56:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D152B6103E 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=kmM176H9BEo2G+xDCQInYDrk6 mAIXBOOKI36ezBv6tRWtSAnOZjkzrltDBRMaQUrf4J0InPxhf0/tsEveUtgMJFZfGUgSq9nGAAcXk f0mwLrvGiVjaLCVQgy9RC6n9Xh09bU5SNFdvlnsc9JONsgWHf58FSgfh9OFBNl8xdFhGX4LaFgPp2 4CpO6bGbb047SkHcrVKGd5iLKpe0nDeGNy+gCyVjs5Sxh9Haxhst3KWn9TTcKjZHpW0qGa+PUMOpB RKOTxmN8woK7LnmB8qGLqYIg38yE0vVq1T9O7/OUFlB75WOhHSqEzr3+Ysn2IqFV134Q7y9trZBTo TqxCNAipg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblZg-003fiv-Sc; Wed, 28 Apr 2021 14:54:01 +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 1lblYX-003fQU-GU for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:50 +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=2B+DH/OwGRVZmgbvSq5r5osYrW WSIo6R6IEp8Lzrf9PwTI2EX/iLZxJAp6TISY43pk0upG1rPul4aKh1e2huom+Q3wZsy2/tpopcPhf OYH84bBcdt5RZ1GPABiHD8G7OZrtuYPvbnpYj/0FI28B8JVX9brrVolIRgWU18nF4hxfLk6o6HHlw 2loCLIfI2iBBo1ekqJnut5S5zax8lH7dxt10ygTSneAWoyxDbdXvnjoDvT8+BEa74FUGLkr+6HxF8 ntGng/jEuRokwnqe98Fp/ypR5askqz34wysuh7wHJuKJ917FOiMp243qztptewojg2PTuYVYRv85P EaKNw41Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYT-00HVP5-Vq for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:48 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 21675614A7; Wed, 28 Apr 2021 14:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=W1MZ5fUp2z9NMPUzLbsMjuPOyaCJXem6s4s1Qkfcwz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2TOTcw5C445poYixO6MB4771lIkivCDk6l1WcyEeoHLXx/19d6xJ7PwFCbd9A7zF nvUAN9xfF2FVM2yBWLaiNmalMlFsxj5A/UBsSSi6eDtBqBG1TUqiwtAMuwwuBPz4Wa T6MVM6CztEmBDxh1mW/Jz/Xs5VyReq83re7kSzaJaSFdmsHDnc89Y8hn9PjRx1ehzZ OFEAxVTSyd6mB4N7MKW6xKmWnVg/yWiU0CN6VtsO3ruHXAhRALU0U9raQ1OvIeylA6 0nG8cb9T4w9p+CmQzNnwUlsyp9YqwWAVvIbjdlCaN70KmHaX5tX8q8E6rdVLzQeGTA +JpqFWntku3vg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001DqV-3i; Wed, 28 Apr 2021 16:52:42 +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 v4 19/79] media: sunxi: fix pm_runtime_get_sync() usage count Date: Wed, 28 Apr 2021 16:51:40 +0200 Message-Id: <17cf60c9e5190ff83de40284bb858581bb0ec4a6.1619621413.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-20210428_075246_112828_7B746BCE X-CRM114-Status: GOOD ( 12.52 ) 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 Reviewed-by: Jonathan Cameron --- 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 Wed Apr 28 14:51: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: 12228999 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,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 E7451C43460 for ; Wed, 28 Apr 2021 14:56:22 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FF4261151 for ; Wed, 28 Apr 2021 14:56:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FF4261151 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=jO+ZxERTgD+yRuSHFeHfO+2oq 8haaOg/4UhOX8KWNcRks1Fl5qoT9ZXCny8apJ18RBVQ1O2wfb3RUpvEyxaed4qn6aJPFYRZvVHvrM quCpNFbpq8Zv8pgwhIqgT0mQjXDODX4oW+DXNRh/Ebem2P990Nk4Zqq0Jvg+ErrpkCP678NGniYv0 aag3xZ+XdjPEKl9UqMOb7HSWj8OiyR2GdQyRJgSMlY+9ZzttErdNaoLjjktEG4zvFIf97nF86ZjQV IRjWmVJjHTfPASN4sXtYI8Scw/yYT+ISTdVtHSNSJNTSWx9gS8+jpo8lasqzXCo+ivgecs8SCOCJ9 499qNc0Uw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblaU-003fxe-Ky; Wed, 28 Apr 2021 14:54: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 1lblYY-003fQx-Sp for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:51 +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=3UKwId7LB6lQlLToXdgAJ5nHx2 hL6x2W46FNMs0+96RDgWjNzzd0W1luzgq0zkV4drXRTHJHRbToGJKD2KMovE+h4MwBl5Xh4Tn6mTM thjbmdidCz5gP//t9rliQbwXD41Am1RtSoPNAVk8yCtZMbl27mvlSU9cf2ni/mhh2+NPYO966Pxmt ozcod6SAbMpg4Mldp2+/XWbSgTsKakMp/WfHcpSY9RVugpazK4Wz0FLz+Ejcc/FA+HrGyRHVL4jvb vIRHvFpHg/zhLheDZ992cj3xxdkUhIwsKa/yMI5WLj0CXgDF8zf/r8Pv4M+v7sDVpSeBqgwZ7VWk6 gPeq5Z3Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYV-00HVQT-A1 for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:49 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 392B06161F; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=WwdunTEPlspSuJNcgiz5VlTq6QqTmYyotSIBFOxVREY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LM7slmUmkpQ8NEr7pseKE9PHmPxOVynU2ApW1DWeGR2AXQUb1++LUp2H3WzNiHTDz ce0W+4lggWefwwa+/9O3r/DA+JHxky9RtPrLccCJGjJIUWZ2icKNKT0RdCOfWFWfMz SCYLxTJrfD66jicSvGaT8S1nzPumgBiZlCin2nk7Oordbjjt7324wuoQv/Y3Co7m1l AVbqDWyfL6NSSZYzvskKqpAAgn3mAz5PgD5vCzTAcGeL7nRQMr3J9mE2cNZ9xcndca A/Q5xGDjquXMxL0rMNLVnPXH5wNoz+9kjytX+j8rxosTST4B3OY0XqI5ZKpEtKISbq 3kvffXe1odmcw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001Dqe-6X; Wed, 28 Apr 2021 16:52:42 +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 v4 22/79] staging: media: imx7-mipi-csis: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:51:43 +0200 Message-Id: <914f9a1ac35dbb25cee9636b9f8533e743173ee7.1619621413.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-20210428_075247_454994_E0FE700C X-CRM114-Status: GOOD ( 11.04 ) 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 Wed Apr 28 14:51:45 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: 12229007 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,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 0481BC433ED for ; Wed, 28 Apr 2021 14:57:13 +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 A5EEC61027 for ; Wed, 28 Apr 2021 14:57:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5EEC61027 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=d7qf47V5T7WW+MaZUj0vTzN6V StXR1sep4ApHmRUiG5AtfQkCdKxN6IBH9yv8QaT38ljKVCPA/d0NtFe8y1t/GYNbJbS9yiYMiieQK f+AuA1EuIGPTdNZcHw4rqBfAhU9CXer15zB2ZZuPWZJbafRBtOMLC3Dh/l0baw/1G5vZe7vE3XGWK 6vCeSSRMPOmdS9QWx7R5UoDRCwR98S3vmHNjQ2gDcVgIiljYBiqyTegbW+UfstlqRHOs1xAaNpwxP f2rnXLxzvlGPsuiu5Sx80ZaLS01zlw1NLkHJeA9odDMhpJ4ZKe3UF4yV4N2oeq2rhRhHsztGyE2sj Cpa46cPfg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblbG-003gCd-MJ; Wed, 28 Apr 2021 14:55:39 +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 1lblYb-003fSs-Fi for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:52:57 +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=dpKGjvEnV6F7aYQFo4/YLoRFi6 vM6a//hjDkPmnk2s11Aa6J8KkkIPA7o47LVghqSrXyHtAc6Ov/xknKrPYhAd4KSiSLM90COyj8+xM xyXDgr20sesTAKPa2/gVF0QvAM/yGZIBHf7AoyCzwHHEINP9MMuyy7sxT25NONjEfpe6HWY1cSB1E BCEmvBz3BVT2K8AqJDGuVqbAoX3Wd/u5ge4Gm+Enx9K6e+a0dGTFVLn/S1d0JUr3BEjisjETbesGq QBhBo76o2wNu+dCfI69u9x+aIfmgRaq96BKdRo1rl5/JOy1kAOpn69ck7k2NDRvuzuXtWptjhG0uS TLOKiVxA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYW-00HVP6-Er for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A57F61626; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=P8ySBvxIssOsYGuosUcRi8p/mrvcDEnJfSep5KVO8S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qo6Km9p3rlLQFFeDPMopzRqAwQT0xRTT8oR0mOgVJ70ZBXubeI8rO6L3WbleZllBq wXLz5cCHeI3crP/D/uIBx/q2B1Tu8U0nvUu/OBOHq4lxgD4sQHjdiJXkioGljctxuQ FJ8e+2lj50N8k9Pl6yW8LJWqOZUJc6NBcFpfzR8Fr/2f7pG8mr13FZnUTXaZ+BOVCn eW47r7w9zmpXt0ZbfM3ccPIIoeErWpwJAhgWy64n30q6TFS4+kUW/2tpoHVyLU19zQ /Pn1679UhT4OPAqkaUY6nulfuLeB2xZZdNg9BXmt7FbnTA8wgqEqeOa9ozlcE9vaSW Brh6PVCqPlmHw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYQ-001Dqk-8Q; Wed, 28 Apr 2021 16:52:42 +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 v4 24/79] staging: media: cedrus_video: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:51:45 +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-20210428_075248_560002_26C6B0EF X-CRM114-Status: GOOD ( 12.23 ) 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 Acked-by: Jonathan Cameron --- 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 Wed Apr 28 14:52:18 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: 12229205 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,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 969BBC433ED for ; Wed, 28 Apr 2021 14:58: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 00DA161158 for ; Wed, 28 Apr 2021 14:58:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 00DA161158 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=aLebF0Eqmqg8VM6GWFfmfjem1 4WQhtUYaJ9zcZtE+9DzMhOThagZy0FNA8x0wH84V6RuQgWPRVBtyEy4Ns3vdhnE7aj//jRTk9FWit ZdoycfmI9Ig8QeJtpvOFc++cTrQpzVv6K9uNTTJ1VA+rmSW2d9rJOU2WrJjhAbX9lzYXeeJsjlzGh jjrwRdQkLhG69lkaXZoePLC710zYhA9/+2t1gRmgUJ3ngCTINoRy0kBEqCgG6eqWEbaQFqUbe1r0Q pWeu6jmpsymJ1HE3Uo+de6+bzypjcoaJ8IdaBWv44FAi+oxZiexfbkLdY+O8/j8Xdvd6l9g3GJIqZ GYm1mLoSQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblbc-003gKM-Ob; Wed, 28 Apr 2021 14:56:01 +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 1lblYh-003fSs-G6; Wed, 28 Apr 2021 14:52: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=k/JT4xNc8q+xgw65KVZhdHtvOyVt1/eDaJCw7AtYUJ4=; b=aErzh0D8/a8uNZ9+btmuvKtElt M1Pu2FmrMJoozUBHsTazYwIRAauDLsOgkODRbTPuUjYI9mZGui7csIYMy4b4aNvGugr3qlMITIHQ0 O6DfWfM+B1u5/ueE0GfTSOeuIsZx4i4LvTpqmdB2vXYQJNFUZsGFpa+jlZPGTIk0W3Bvdq/KpA6tg BYG51ele303Dp6MflY9bNiiZJMfD4ZW0yczVMd7Fl2aKJtIffmik0wUoEDcsCRdi/zqyuWnd+mf9R +nRhuF2gomWGZ1g9GKI6WZX1IbFk3NMQWAduoysaW4un576mbLB2zOjJ0wckzaWSI3CgWWsapFJqg vTsSZ5Pw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYZ-00HVSj-WB; Wed, 28 Apr 2021 14:52:55 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B45F961943; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621565; bh=uJQR0czm+DeAW2PWQeBvZ4Rvzd+S5i8+90myFebensI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gd0RWjwESYvChE/vXJCMbgMdur/zgpmsndv+U7m1KPFsydIARd9u/rGZfIxnlVWAK dEC37mB/No0AtlFC4lrWsscAwp8/zNCRUShMCT9rLYXvM5lw01qGK7jOhujoyJC/Vr /k66J5MVQ/fBrmTq2ao4mLnRs/Z/AJPnOvR3Z7rJnNTPIFRXy74874ksxc1UiQxncJ Ky6bALQZhCk2CSmQZYAazp9dOf8L+iqw9CvSwhw40Ft4DLVJ8oIV6stXFrGcoYqxw5 ilknZ4+VUlkH7MlSRyNF6zFpOWMQQZT2E1BxZ4PXQA9m/3aw5ghLONpdS8tV9EFPn1 Q5rn/6+Bh6vBQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001DsL-7K; Wed, 28 Apr 2021 16:52:43 +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 v4 57/79] media: rockchip/rga: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:18 +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-20210428_075252_094563_D3B8EE59 X-CRM114-Status: GOOD ( 12.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Ezequiel Garcia --- drivers/media/platform/rockchip/rga/rga-buf.c | 3 +-- drivers/media/platform/rockchip/rga/rga.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c index bf9a75b75083..81508ed5abf3 100644 --- a/drivers/media/platform/rockchip/rga/rga-buf.c +++ b/drivers/media/platform/rockchip/rga/rga-buf.c @@ -79,9 +79,8 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count) struct rockchip_rga *rga = ctx->rga; int ret; - ret = pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); if (ret < 0) { - pm_runtime_put_noidle(rga->dev); rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED); return ret; } diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 9d122429706e..bf3fd71ec3af 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -866,7 +866,9 @@ static int rga_probe(struct platform_device *pdev) goto unreg_video_dev; } - pm_runtime_get_sync(rga->dev); + ret = pm_runtime_resume_and_get(rga->dev); + if (ret < 0) + goto unreg_video_dev; rga->version.major = (rga_read(rga, RGA_VERSION_INFO) >> 24) & 0xFF; rga->version.minor = (rga_read(rga, RGA_VERSION_INFO) >> 20) & 0x0F; From patchwork Wed Apr 28 14:52:23 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: 12229207 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,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 A5EA8C43460 for ; Wed, 28 Apr 2021 14:58:49 +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 1202F61434 for ; Wed, 28 Apr 2021 14:58:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1202F61434 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=s2MVQ5KKdTx0znJMiIOeHhyaXYFTsgqB727yhbw7/W8=; b=JrJJmf6xznaf8uM0wlFcJNztN M+mZwYBO3WHrdJAizq6c437QWbYWdfFviaZiP6Dya7u+YNCVZSfX0fYBrlryJ7WnWDJgBOcVR+hO+ qbUg+0nFXzPRTzl0pcp7HIEOcv3uYTvwmGLKB7JCxKYMstatrTvX6JUTyPc3Bq25+VtEIn/5KiesQ PeJcuBHSKUxGD8FfhxBThCGq8v+IccujA6LrDAMWn6kcNLYhdVDEX6KAzsjpOQOEvD+xGfJPX5JRe o7ItrLIUm0g+MJ2iqKYXchVq/vfNR4TZy94e8DNRTBiptUcNcq8Ya6e/9xACzd+HtLTFtS3FLNV2l 7xdpuNMFg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblcq-003gp0-Lt; Wed, 28 Apr 2021 14:57:17 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYg-003fQj-Dt for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:53:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id A5A6961934; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=cBvt5Bl19MQ4Nnp+LXFcEpHzE9E0Y/ozfRu2ctMl4+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uC72eITAXNOUt0hveW+jXtTpSBtWwYUfAGjC21ATFknzkNGHTbKzMGNc/nOK0JUmQ Krt/78wF4JNCFv8bHN8aGufFfJtTtEfhg8L/bWS7lbKRzjv2bbQT38HfVkE7D6cpZ9 UrFEVvbNgSXz/nAIZwI5gKHGEGxw2vYvXOV76oL26UC+GVLrAA6rGGLkLPXWAK6f/h fUwSyh58h4j7TPKYHmY55UTrgrMOoVIfXY0NRrngWNKDNdAdMFikizNgDbGxrGdvGA ASuBSegd7HXaP5xf9zd1ErDZCaXIMyslhUSVnN6U79YjCsDPTqWkWRPEOnFXM/sOg9 rvFGRT3hNx43w== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dsa-C7; Wed, 28 Apr 2021 16:52:43 +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 v4 62/79] media: exynos4-is: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:23 +0200 Message-Id: <31eadd61972541bf1e27706f9ff7be66a21e23e6.1619621413.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-20210428_155259_273138_F72FEADF X-CRM114-Status: GOOD ( 16.93 ) 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/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 Wed Apr 28 14:52:24 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: 12229217 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,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 06A07C433B4 for ; Wed, 28 Apr 2021 15:01:45 +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 A643961412 for ; Wed, 28 Apr 2021 15:01:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A643961412 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=eOAsk55PYD7na7gTGNFFk+nOZeayaTrvQZaHxrnWyZY=; b=TQno/1waWZvH9wWQudHqOY6ky LlT/JYizqPwBnQJmlqrgFRVC7Ul1iqWDU9hS1S61N+Nm49OzDR9j7e5wJCCssfyMwqllqxM5FkmEM 1fBUIvNt+ijlrW7AFLCc9IW4XSgWKcjJx2U4NwJYibkLCT/feeNWDixs77si09QjQuMkNeqctcVVJ rU73IaERXNYoNpwtdEZEzlDs6y8YYSDUwQhm+Sdb0NdZD1mXoHCdT+DZrYkaXfCbnroXPjtISC8QD b2fdP5JB9pRuki/H26+/CIaD+bjkF3MYbt4fBNi7VPUGTMtDCwZxh0gzi+kdPVHx186SmzLY/p3N7 FnP5s7tyQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblfQ-003hmx-Ew; Wed, 28 Apr 2021 14:59:56 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYh-003fQr-3p for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:53:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9882D6192C; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621565; bh=Z5Yp+Q0q2yqOayRyZCcv1BilN9Ip1CW26ivzhLbxUjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N6119slbKp7xKpHK7jY2N8QjZug1qcVWXOfLByFNNeGoy3Vj3JMny2WxtD3OXQZoe rNwfv3MIW+m4EAbkrPp/7C2duKZV0SMWzp00ls4/aXYbJzf4ILmBzgnv3OSRMXptP1 ZMpgf5x9q6W1XIaYKYJiQq7Az7WcT2yJl1E9zIX/9sPSUgckGx7jXJzO75mqUfgubL 71QkdB7FU4/t66ILdDfb+Q0CQVdhLaghByNUq0tSSWG2IgezZsDbcs5OFUvoI9TPxk 5x0CA8cav47vhS4QFCvVvpj+dbNhxfyXYYGQcj8k0fBH85+IPu+HrzihfwHzzsmxWa ILJ4mlCf07p0A== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dsd-DE; Wed, 28 Apr 2021 16:52:43 +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 , 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 v4 63/79] media: exynos-gsc: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:24 +0200 Message-Id: <31bdadf2f59e86c6a315ec390b44c6c681af6647.1619621413.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-20210428_155259_520167_1A2D8E90 X-CRM114-Status: GOOD ( 11.16 ) 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/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 Wed Apr 28 14:52:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12229219 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,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 E4275C433ED for ; Wed, 28 Apr 2021 15:02: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 8E3D56141E for ; Wed, 28 Apr 2021 15:02:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E3D56141E 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=bQA53SSG4LM1eokOdsHr5qD5V uIUTg4IFh9nNvcue48kGsWjnUrEHC8sZ5sPLL2HE+T5zN7j5HpvnX5FWDl983lvlfqwSqo5N7woJb N7rym/29kO7wzw1iCAQt0hRmYzOznYQRI6119/drD9Qu1gpXVdZn3+S/EdJ0ixy6F5WuUm3u2Bsgq 12CMJWNP0Dth6FH5WSu3QCYLKfL+yIzEHgavK0AAjc7FrzFGk8dkcPfGRvs2NgSQCwsA2uXZ3gqmy 6RV3Zct2VVHok+lhFQRJGCaHv1todgpyZxwfPXambvD8HAf2IZYUG9K0LIOG3cL4k+dDlAy3fvsVw 6BIEQd95g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblfy-003i2M-SG; Wed, 28 Apr 2021 15:00:34 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYi-003fQY-91; Wed, 28 Apr 2021 14:53:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 570F46162F; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=tu2hhB6CHAZbCfvPd96Qq+9zsUaGe3IxV7AH+2XbuEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtK66w5w+MqC+buetVQpX4klt8E7eQKMomLy3QjlqjVd2YsbUKE43Nkp6+91l7scu 44dEYHkoaTal1LRKV0Tm71R1+ekTI67JvcAaf4zHu+7I51T9C63DNCPxe0TNatBeUY a5dk2vF6J/GjIoOIFes2CatpeDGzX1KUcUt8n9TSbxI3htOgl+Cu/KK00evDXM1qh1 4Eyu5wonFJU7ni9avZaYpwniDJY+RnXwPjznSqSBfg6IxFMxYxDTfGib4I9lEg96HP p5dmwBfkSVPEX8lJRGV2xydcMTe8eHwpK7VVQ6Iqyi/nO9iSSzK+ONQgLziinEFR1w Y9IMPZmVuivMg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dsg-EA; Wed, 28 Apr 2021 16:52:43 +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 v4 64/79] media: mtk-jpeg: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:25 +0200 Message-Id: <71dd5d55eba4fc353900354acffd6861be8a8abb.1619621413.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-20210428_155315_146099_A85941F0 X-CRM114-Status: GOOD ( 10.85 ) 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 Wed Apr 28 14:52: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: 12229213 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,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 B92D3C43460 for ; Wed, 28 Apr 2021 14:59: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 4D00C61158 for ; Wed, 28 Apr 2021 14:59:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D00C61158 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=pI04qqxYsb8Lop5Tr4wdjNNQq IjiKRE6p+n2mxiSJJoVyH4gafnop1upEpipxy91hWdvttS3exqJHWJ8PBTcIFLhlrC9SqmAXZNnvw sRnUaRT4xUnlKzsB7SWN/dL1LHk4fVEdaVDmoWkHuJH0E3Wwm+R9GvxZjsGM+1AR/1Vg/qVoSPWZ2 /M4t6z81Z4auDqb+c/Zo2N8AbKxeikQGCaIwBMmAQnHPjk2jppr5WmtedUTr2M43ZiTr0QFDypSw+ gqFrJvdJFXI5+fZD4644uHtigcXKLyIVaRsrTYw7DcDFzFJB0GYAL2og9InIlpf7o4GduXEo9MeUx /Lu1223Qg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbldn-003hAy-Iq; Wed, 28 Apr 2021 14:58:15 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYi-003fRo-91; Wed, 28 Apr 2021 14:53:10 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8EA6261446; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=rChg/pXG2Qjbehywcb/+z5hE6+LFH66GvNnoCtLFEBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uR/Jo/DpIUEje6LsKdX3PHv/mdjGFVxuHtrPXdPDc+v8dwpOtdxjmkNhhhzSopQsy VSkDo3DDGGZ2gtoDSbH92D4GKyCo3bTAt54F6gwW3uSpbPqD9Gz14OGnvKF8hiFgzi +MPre5UkHMPOVzTKyzgZXb85GXnCgL08yh6RNscnu9ytsbLzB2uBphS5ULdc+tW04Z yFJ4DRfB1ZpjpPDUXuWEzqBguPdtassPM+2xc5DFzDiLTWffXpvG7M1IzaLXvjFw2l Cy1w59xd4cNTLjg7y6LVbd7mTAojeXRxkjAXfQUPnEjSNxAP7tPDvkZIBibmK8RG53 ORqbbPx4cSctQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dsy-K9; Wed, 28 Apr 2021 16:52:43 +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 v4 70/79] media: rkisp1: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:31 +0200 Message-Id: <17d3cf0b3b137011353079109a4918592c4f57fd.1619621413.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-20210428_155301_788276_BB9375A9 X-CRM114-Status: GOOD ( 10.44 ) 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 Wed Apr 28 14:52: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: 12229209 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,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 3458CC433B4 for ; Wed, 28 Apr 2021 14:59:09 +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 D3B40613BD for ; Wed, 28 Apr 2021 14:59:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3B40613BD 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=acuHmYtyZ1sdt5c2ip3m84n4y OVBCiPuL0HqatJ0dAcfmgeXV14i+5FvcYEqSH0QPG0AMLcYGOulyHUHA/ekJOxde+Bi3QAMD6CtFx UXWjHmyM8vn2q+QXSbOtSYCEIwkIZz1M0sR/82umNufxGD/f9zXgQ8Uhn/0Xjgo2INo0Tv1KUz0wF 1KLMpSQHT1eLE+lCFhLReqkJU88iK5u0aNZTZfJSlqLP1S32fqpcJx8/5p67k66J/xTMwXi3TMmIH CgGr5EyZYUcIRFf4itp9m30PaWK8WFvdFFDqZAHMMKSNI0HD9qQkGayGiwlzFuNP6FglCJI9ha3XI VJK0kpYQA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lblcN-003gbm-78; Wed, 28 Apr 2021 14:56:48 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYh-003fQf-5d for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:53:03 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id AEBA56193F; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=GlCvanyZeZRx9KVkDMbg84X3Nl/epjQxFII8vak4mR4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqsiF7tmuXjRh4EesIfQ7o/FUBk/hDgKp/8R6TA1evTEhD2UtN9Ki0+9CINaUbzbB gJDj+qXQviwAyeLujMn+e0yJa/o1uSM1zjkZrYNiLhRwD/gSkApp9yOrbVFINwAgvN yMZ0Qq52+Di1i1cuAnzDLA+GDcm6qtiA9iGyLymx4veJiXcoGIfr3mQrlX0Wj+7PfS nih3KkcGeXBxrAJ12DJFMTwp0+5/vKrG0eZ5me3gvA88kDMJPDR6CagMt6uz4+fQqX TfRg63qV/4X3a0NqEeqkhtBYOMcjZ3X6NBg64v7W1bE8BFQ5DEAoETGCWppe/OKpwo lisG1MVxF96Yg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dt4-Nr; Wed, 28 Apr 2021 16:52:43 +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 v4 72/79] media: s5p-mfc: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:33 +0200 Message-Id: <030ac0a2930f8d2c9d3237de5dff71f3913c3b45.1619621413.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-20210428_155259_687901_8F36505C X-CRM114-Status: GOOD ( 10.97 ) 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 Wed Apr 28 14:52: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: 12229215 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,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 B6C78C43460 for ; Wed, 28 Apr 2021 15:00:19 +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 5E124613BD for ; Wed, 28 Apr 2021 15:00:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E124613BD 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=SkaofH2DsZIAJDE3YLUIofHhL Ky37LCCxFjgsLeYmljHN+O2UVoIkc+fA1HOQZjNS41ZSlcbOMwUkp1mkwjM7zedX9pT0OrZuSDPzu o4ba6Ju+cvFhVVLzaHMCn4nRg/yIoX/pBmjd851NS4qOIsQvT/wPHkE/MBsy1lLE/E37JY9L7zcvX mWmeBYnbB3D+sEDUayrUO2EjnV9V/UwoHCBrL+LH2wm52Uk5Y6PbHYWJrFC1KbbLqvgHPn5eaY6yK sU4EddtaBdFKGZvrVzBsnC6drSnW01ftqtGjeDkUWF60neT871U+LDkACXmS+NMT5Nj56velP3WY2 HhsaCqn3Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbleK-003hNm-0c; Wed, 28 Apr 2021 14:58:48 +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 1lblYt-003fSs-1O for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:53:11 +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=VMvfSgnn6oSyhENzNZN7g3TxreG2d2E/GvlVbPp4Nxs=; b=ESC1+nBFLhexwHkAOrVYw/mZdy SUDJ3m46Nd3jlt0PyDfHfAj6sj1kEuykK17u56qDPbwCdcNzRcoRiz0UxcTTnh3yuy+jGX5MLHgKf edc8WXtxHcKy2g8e6LNgkDD+BW+Zfu3UhWSoHeIHDYK/2QVmAt7GqgyPJ95SXmqqezTezKdOEgSTr PyfV6eE2H79PswxMN13W+W2OU57iMPVPq6rlDEwC8ehl7163Mml+oMlTT1+WliCZ1k7Mk42VDCpl1 /apATfhIHT/1S8/nJHvDNT9GSF9HjSIfC8h4n8LCqfqv2bM+G4Knp5BJUwaJ4L9A9sa/ZEesx4Lyk VZPb7zFw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYW-00HVSk-0w for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DF1B61613; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=/R60wucnhMxzatTcaaq6aX+wA4KyHRrla+Ogrsx7GxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9chViMs3E4W7TC7maIn7wiUQ4uOsIa58vIJZBldqJPCAjN4dA9W5L3AtC/OU1w0L jWb1/AbmXGmQkBJqs6e0NgoMgSyrSOXFzGVp4pPSq7hc79Nm55tTclGe3fAUGnVz5e x3NxLPuPGuGyQvb3SwPzRN/7WYpapNMHH0EzZzWrAyHfvrCMY639oNLPRTXWBiK37p Cvp82r/YZagqgx8ZIs1popTCucIkmm/FzXRdBNq3YkSzojrefzlP1NE2UOBS9g4Ycd fwqF6UO6yrZN8Ort/1+xObArJ+FjzZrPdeXISRO2SggVtVcpe/Vp+xJBG/J0TDIHSv mEN1PCZyD5LmA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001Dt7-RR; Wed, 28 Apr 2021 16:52:43 +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 v4 73/79] media: stm32: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:34 +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-20210428_075248_132110_38FF336F X-CRM114-Status: GOOD ( 12.07 ) 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 Wed Apr 28 14:52:35 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: 12229211 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,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 6CE70C433B4 for ; Wed, 28 Apr 2021 14:59:17 +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 14CBA613BD for ; Wed, 28 Apr 2021 14:59:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 14CBA613BD 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=GIbnAoTC9dZjfKGAqtGH62Ft0 3KHKViWfGgPOd0V+RZDjmHnW2kMAWLVdaTkROM3fylyt+jDycvNp05lE/shk8szRWN0HqnT9J6cE0 b7ZA1VAusKiLgSKOW7q9EMjycVSGn199cvUduFoGEZzjvqy7TeO6s7uWue/ezC1oJMnBpRx23rDQH PyHF/gAl4KacNHx2Y4u3tuoxeJkXBfqrNKZY98I+QLzqGpSreVAs97pQibvgzx/4lXuILRywr96sp r3alRzEl4XTHaF4H6f7E80r4W6gg2HP0l8ZIsPR5FhxVHOwap/i+/lgViSyfAJGpURIj2yfJGUQWn iXg1QsSxg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lbldI-003gzV-5a; Wed, 28 Apr 2021 14:57:45 +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 1lblYj-003fSs-HR for linux-arm-kernel@desiato.infradead.org; Wed, 28 Apr 2021 14:53: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=ibdjOd74zn5QWbuSye9o2gRXEdlT/fUXvhYWQjU18O8=; b=xl5UrzHm+NW6k4cLj8ubnUM0D6 Iqf6orQjr9uwTOibVLX8Vj6Zx2a9VUj0C6RMSoAbBvMoBkPJcL93xyneG3wAa521is4UqIbd2EJ6g 7TutvvyQrQjaPKgTx8p0lWgug/4inFUz9qq0S5ZRqyJGhWGsb57g0IG9LsotgJH2gHBf5BgJv8l1e hhibrG6QCZZb1TixlJyx6rRtNwGfz6ZN3yDshaWhthOQ5thE7A0Q2A9NZVRqRRLwuIITgKB5YRguN i8sCh8zf4k9X5gSXRbg8aZUgpvrIQVZN9gvph4VTb9GCgP/tbVfeu/6bxoDkzRHkshxF4u2Xm5LRk 74hMOXWA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lblYW-00HVTs-V2 for linux-arm-kernel@lists.infradead.org; Wed, 28 Apr 2021 14:52:52 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 465B761625; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=Q1WsziPcbnwAb2cpqQFZbO8zttZnZQq1oIpn6yJZI+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pbVmWUko8EIn3VxKIW0ult3Zuz5CkjUtFAymk8b8ZJwX9BlYJlWjjFZMiH5bdFbbI Tdx94aGYJYzZfhJetROKRuHyoZNGKfypX46KoZKJch/9rvmhaHlDS+oXzK1ZXLh+YD GFNlPECjgVSAjn1615zi+bceklNTXLGaxMUqkvjwjQgmrtL1VfhtTdiUPrCL8auadR N9e4U4ROmJ98tOcdf5B3b7eNd6zJD1BQS7AsJDP79Xf3/aCZ0SV7MR3xt58e+Z0f2h wRNbBnKszwhMAx/5aY7FmCAi5JuLSBOWWSZP4fx7rWFvkQ/0HfkbvUkXefThX9Xjrh tynlVDrvf2pCg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001DtA-U9; Wed, 28 Apr 2021 16:52:43 +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 v4 74/79] media: sunxi: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:35 +0200 Message-Id: <3138e98e18858b3133b9a6e04890c29c731903f3.1619621413.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-20210428_075249_058383_983FC252 X-CRM114-Status: GOOD ( 10.99 ) 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;