From patchwork Sat Apr 24 06:44:11 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: 12222491 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.0 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 8ACB3C433B4 for ; Sat, 24 Apr 2021 07:02:46 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 157DF6148E for ; Sat, 24 Apr 2021 07:02:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 157DF6148E 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=O+DxdwxblsE7MPMdpVOQhDDQdUJ4x7MvQRasH5mPcyk=; b=XvY7fAqxnSMcaaNKhi5O591/8 ff/7BK5YrMa0sDdF92stBsfds7MGiBKnlb6Mf5R0iKcC1/F/mT2ba3NyQ6ESLAdgh38Att7Xc8UPs 7u62/Q/44el7rwIKYJrVUXBbDsRW8z2J//6WyoZ44Nsxs5Ui5VAQIwLI5dyHLeY/u5gikItbhkI8x PVVqcwqrWfEfEZQJ8LojIXuFBVU0CW1C/kBUkMPaFtXbomqiaLtWEHx012tMsm39QSF4fZN843B9V zpYm7QOjIYiVgrRKyW+oIQJiXQFhvCTGKihoVh9f5puqiu1sqCXccwDZ8EB7DU4kfp5ahrAJ587tW Zf0sJLFUQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCHU-003Cq7-Um; Sat, 24 Apr 2021 07:00: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 1laC5G-003B18-LQ for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:48:09 +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=7z9WvEVc0NhMpWhfTjMaiRNYpJyS7rkyUQyflEOELNM=; b=K+p5zDpHriihIGD41w7qpb/xdt c8BaSQvJrwt9Iypsj59/laBMd8WdkOEibmjAyUu9MuTtvVwOU8u8ypJ3Wsduk2bvQK46bKV3VWLg5 8hhHeJ7grfWBcomE/it+h4qCQjyYEupryYEi9hs90NsbL0SzbhuJ/REAn6zCiKx8z/zV6wCIMYswV CDtrEqODMULImFgn2qHAbCHGWJtZ0FVPd5CrtnJSzNBNCseFCeVZsWym/wAANbSZw8RPD/cHWNeWA CNoLvl8pC2WYLT6gNpBbJlshlKuON8YQUofhmpoVvrIuhS6aZGxvW5YWSbEBFGxZwGO6EHhLmvHW+ 8OUD+EBg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNI-VD for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 18F7261574; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=Y6FQgC9NsgxSbgFLPZRVR5o2rajl0boXLbSbZWHNz3E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LfnO816+/JhLoNHrA0xNpWPG1HfJiqF/yCnK01z4uCQsX1d3UCUufgPePJG4QI/ZW cp51NpdBKYIGPOCUnEs6qS8RrTXHpnyjPoQ2rLTeP1qKdRvJPBgF8Q1ulDmPaio4uS KJLv6e/+j18Ogmc+1UKUSjIcuTU2wlKQ2VPAAdcOF9jWaQWe+t5OruU+SgAC/OUPnE TqvLXEpbR/++Elzb4EDfWWqIbFWJpktyfQmmxRHwPDOEnKEGgstp7E0V9BdQVMur2Q FZ36Ns1RxZBaRRQeIWh1W2hyCD3HGzGjj3gAQ4ov8lgGYimhoCo6v1hutqXsssANMi MwoFkEW4NypRg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2k-004Jdl-Ss; Sat, 24 Apr 2021 08:45:30 +0200 From: Mauro Carvalho Chehab To: Subject: [PATCH 01/78] media: atmel: properly get pm_runtime Date: Sat, 24 Apr 2021 08:44:11 +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-20210423_234538_186627_11C03E07 X-CRM114-Status: GOOD ( 18.65 ) 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 Reported-by: kernel test robot --- drivers/media/platform/atmel/atmel-isc-base.c | 26 ++++++++++++++----- drivers/media/platform/atmel/atmel-isi.c | 19 +++++++++++--- 2 files changed, 34 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..db1be719192a 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: @@ -1831,7 +1841,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 Sat Apr 24 06:44:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12222463 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.0 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 BD4C0C433B4 for ; Sat, 24 Apr 2021 06:56:16 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8AB866146D for ; Sat, 24 Apr 2021 06:56:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8AB866146D 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=JnwGEbtbG8X31z4SsvHvteoJFiRtGWnReycyvE4mmq4=; b=FCaDOPl/gULbqc0jfsZDrOk/T K9t7CkS1WzjnU/sKUJi3UJr0vBmYAVDG9TyGZ4H4rEb6rqSp7ru35phpuLs+wbVsE/tOBBKg2Il9+ EAw2dQpya/Phnnjkkjd3WV9sYAE+7Mtk2crNe3nMpViGddSi/KcOFJqga03DdtEEuiZwSUTVikT9T qSPz60M8zm1FrBXv5k1odYW9/iDwK1gw4QsFbHLh0x1gMlHiAx75U5yClJ8pQAj7oIk74WqCC3tJ8 aIMYH2gg0WOcHLUVTwX5qB4367PDEK2sRb1doco2PFFDP3Oeof6kn1FsGGhVSul8XK22LLbC7mIQf WiE29xoKw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCAx-003Bbj-Me; Sat, 24 Apr 2021 06:53:59 +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 1laC2t-003B18-0k; Sat, 24 Apr 2021 06:46:01 +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=eLSt2iiQbupfLxLfJtIvPinKnLo+XDl1lIMtY6POuXA=; b=B3UFI5rqujbkFR0+eM7HbimNxp V0Bw3CHgeDAuCUCF594SO29aH+DdsWHaEDaE2OGUZ9//w6w0HXI6kuzSW9N3mwLjVweXQ6E804CeA kv0yHCz3bjet2uiPkP0H3Zya/FJLZeozzcdLhDEUIhDgj+70YhuWqVxaax0GzOtn3je55c4NN2HcA YABBA3LR53/bAMedco2hvRUJ/uC/b2h4wPzmtZvQAgoBZ7awc4aXnyE4JMCNVUMqtfQ6R3eatQAxX L7H2ww2bmPa6YmDYMnE9PP9C1/ecjTjRDV69ODbN9sE1KQzu957NYRn6DqgKZzDQZQc5IhS/ASYO8 9loA/tVg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2o-00EsJb-Rv; Sat, 24 Apr 2021 06:45:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0C890614A7; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=YlEqY5pc+hA5phvy8MwyUatVyMBo1evkBwuBpSmvG/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eudcKq0s7hz/90ZTY5o/W+EkxN7U+wRN7i/h28mYwqD6m8UJjzKMHrwLoLyidK/y9 ElMN37xIFXzAyaZgJzXebfbCwOIR/ZZo/2kc1k6jPF595U1f/ez0HXFxdYpwbkx73w SAVk37xTTYwFPFnKdMCcv0LNoDbw/StTPY6M2LAaFJ27A/vIW1uGf9EUPTT1bJdt8W 2ghHUDAnaamVx0OfxmNwHveQfG6dxEMG/kvcrG10rn3sRTMNWBzUolw5wRc1VBVDx9 eg+xDUyXdnbHR9wNhNZKRf0X5bsc13efOxO+Z9XfufX1WCipFpDii/isD684/T2cYq pWkfE466X70Ug== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2k-004Jdp-Us; Sat, 24 Apr 2021 08:45:30 +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 03/78] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:13 +0200 Message-Id: <8b84cb38beeac55b21c8cbc9dc16e1319c5dc960.1619191723.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-20210423_234535_044267_041E4FB0 X-CRM114-Status: GOOD ( 12.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. While here, fix the return contition of mtk_mdp_m2m_start_streaming(), as it doesn't make any sense to return 0 if the PM runtime failed to resume. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c index ace4528cdc5e..f14779e7596e 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c @@ -391,12 +391,12 @@ static int mtk_mdp_m2m_start_streaming(struct vb2_queue *q, unsigned int count) struct mtk_mdp_ctx *ctx = q->drv_priv; int ret; - ret = pm_runtime_get_sync(&ctx->mdp_dev->pdev->dev); + ret = pm_runtime_resume_and_get(&ctx->mdp_dev->pdev->dev); if (ret < 0) - mtk_mdp_dbg(1, "[%d] pm_runtime_get_sync failed:%d", + mtk_mdp_dbg(1, "[%d] pm_runtime_resume_and_get failed:%d", ctx->id, ret); - return 0; + return ret; } static void *mtk_mdp_m2m_buf_remove(struct mtk_mdp_ctx *ctx, From patchwork Sat Apr 24 06:44:15 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: 12222459 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.0 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 562DDC433B4 for ; Sat, 24 Apr 2021 06:55:26 +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 20269613B6 for ; Sat, 24 Apr 2021 06:55:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20269613B6 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=k4BIyBopcy7ZYUz5Fy9cJhj8NE2wthdpCuCIjR9zVXY=; b=AiCvoqG0cJtBkoxilv3nMcC80 0aduwmBywqduxCeUSjPL0Te+OtYseNsvpR2fhmnj0z/QEwgGkpZ/TQGlljCSy6+Kz0KJqU+wMCXbO AsuyJaM51sudBZPtnk0a7EpBTmCcMTp6IcYsruLBzpWzvYNST0FwK6g4XcZ15yLTY2OTHj/IqUoX0 5pky/8BRechX8Jc6RUQ7sbSe+GqOuGyNkwgNd4m0S18TOi6GbmB1teBqR9gm19iyFUyDyAfb9pNLT ZehVEiC37VIfo72DFeptwHgFbVpOqa2xsZ5hpB3Zgg+CHRTUW277jwFFtbnb/f9i/SF0bckj+rTZC 7QJ4wzjuQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laC8s-003BUU-PJ; Sat, 24 Apr 2021 06:51:56 +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 1laC2t-003B1A-1m; Sat, 24 Apr 2021 06:46:01 +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=QTB+SlgGD8bAOHDk9/V0cZk64a1afXfWKAnUOFzpif4=; b=bN1flAGiCEaLK2qJNjt9Gy8MDA JHMh5RQq/k6IMKylsCdRhbEYYe+r7ldtGmBUTushLqQzP09UO7RARucfcCuco6YsfLfufUtjO7LHv hXDRY45JeZrYmIFYDSxHQukOTgbw+uOgUeyqY12dIhEJa5VCGUisE7o9LjxNFX1+mRP9LJoHgro6T B7NG7Ba5LdMWKVc/PuHIN772LYAw6ccc4HD0XIdSa0i+MsbC8Su4HnAk6sC+5Jpe9FUSkM8bDB2H1 MuxWtlq2GPTOWTi0tXO2UaSfqlnNEoK8TlhOY59EJdHUmPNBPvmaCN+6I9S6nwdWbRp7cVnYyKf0X jMrpcjAA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2o-00EsJi-S1; Sat, 24 Apr 2021 06:45:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D7556157E; Sat, 24 Apr 2021 06:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=fa2a2FGqdZmNJgSzuDaYm63kRJBm/KAm+F+LdF2Flv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hubJqfWD8OECliazbjEYhWPBZOSRrw05HyOZAlE6dGK9YwaAISlP3vdGFO+D9LYoH zHAzqZtCofN9Q/MAeCwUFi1cvXh6x4W2VBk7cB6XdrOO/VVUBduLOaz0aLVY5BVemL uW7jkF7ltd3OisRsbpZKSWvuvJACwSufWPnTE747HmUGbwiD65nk8E0oJZcR+Cb2Ko WrrN84duaUFNGa3KZ71CsI/PcFmRZAgWyxBOr+oX+mkvO8OzJDvozO0Wlr3lqM7CoI JhOQAuYCBbOt13KbWte44AI+/9cTrlRGD35RF6rzX9/oSW2YX6Hewk6ox13HMGrpYj Gj7fw4Slkr/dg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jdx-0b; Sat, 24 Apr 2021 08:45:31 +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 05/78] media: mdk-mdp: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:15 +0200 Message-Id: <6ff9d0c049f94f38fd0b172fe3a6dbb36ba2b87e.1619191723.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-20210423_234535_013296_F6CC2F68 X-CRM114-Status: GOOD ( 11.08 ) 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, check if the PM runtime was caught during chipset probing time. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/rockchip/rga/rga.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 Sat Apr 24 06:44: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: 12222461 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.0 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 68E4FC433B4 for ; Sat, 24 Apr 2021 06:55:37 +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 36AD66148E for ; Sat, 24 Apr 2021 06:55:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36AD66148E 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=D2jPggeaHk7Q6UDYSZ3Vs4PLcNUvkwFvY7f0AGzPgg8=; b=ERy6t7cpzm0wNxl16AfC+YSMr f01Dwwe+IxV+Bqzfrx0IWs0/ghxysncjkfAeLUzsxPz/8OGqdSrspZ1x6CSynjg+VOqB3fp2UbqcR 0VIz5sQ7s6Y/lg6e8UNidJT+SMY9EOBexKcQ3lLQnMbgNsOHZVGVa6DOrCWhD2yhGWI/qWbKS+9e6 Z06s8xFRiHH9dmXBNSM6SLJCO0ArdwCaruT74WiR56kQ5QiK6+AFb9M5vxMo2/7tLRbfsVutl8m80 RWx+Tg1Kj9hf3sB4Ukz6r2/nh+IqnW8+hYynAkUwf+Zookeu4kKm3Qs3OL7yLnDfiLB4GTO5ydjU1 nxOz3YOjQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCA2-003BXS-35; Sat, 24 Apr 2021 06:53:06 +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 1laC2t-003B19-0j for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:46:01 +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=Lli/WI1PPfjtNqq1j0LnavbGLzvQibYHe8n3AKvRnfs=; b=Iwj5r3UW5EH9qbV5ufV9N0Fbb7 GG7+fIZhg0f4Sa3F+EwS+Ozcnf8Dfj0i2e+WRpGHybDARYceJr7uZd2D/E6+ctyWTQPiJRwf4wj7v 8JNEX832xE2cvNO/hzrwGdJ5uB5IAolsAnTXUbQTjVDam0aK7sqsDgwwi60XxMa5yT54i6vBBLPms jDOIs9YWQMcby70Zq+DZXUqkz2smDoWR2v+ZD8a029VR4MTmvbIpFh3dN7J9n79euY5ltd4cYal6i JDoAT0nbSRWKRD6JwY1ebmZTBe6UOaX5S58IO45AR+cHk4NrdG8DHasqJSf17ovXhfkjavqM43CBq mnu0zbfg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2o-00EsJj-Rt for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DEEE6157F; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=Rq+16yz5e8SlR4lBpfokaa5W2Lfu4S58C8WlJJgkO5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kYIdg4OV1jct1026KcMw/JQaQTKIREfQPahmBEkCnjksQjgwD6leEnmpbV2TsIuEl HwAG2v6KdNW/kvf/B3qmCc1Z46D+UiGos6lRhv98+/mMgBA9N/qTzgnC05HVkFYfgx 4MPKd+XjXEcUNWS7JpOru09dc9t+4PtlPl1JADDDbuNxS1IN6XsyCka7bbL659GGWE XDxuaKQtHV+hjyvkrQc76icj1ij2zHyEtyc4flcA6qfh8WceXwI8wm/3dCMG/86GL1 9Hc+4lLvXQDFR9WWp8mO+m4cf8NVw5IjTGmmXt8nBjonoY2MjqG61s6Tifu747Sihz 9my6arjIfH0SA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004JeO-93; Sat, 24 Apr 2021 08:45:31 +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 14/78] staging: media: imx7-mipi-csis: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:44:24 +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-20210423_234535_048130_E85E63FB X-CRM114-Status: GOOD ( 10.47 ) 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: Rui Miguel Silva --- 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 Sat Apr 24 06:44:26 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: 12222465 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.0 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 15221C433ED for ; Sat, 24 Apr 2021 06:56:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C19B2613B6 for ; Sat, 24 Apr 2021 06:56:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C19B2613B6 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=ZvHL5EF8DClK2RxSB6ud0n5+P rtS6epRmxVz9wPt+YZnYX5J9YQ2AAIZUQvG3i37+FcWIqc0E1EJjJa0923TGyJRsTRsRdFfDxus9p 6p/k04eNIkAM3YUiq+VfTT0QOjrgLfqDa/SKFEjvKjGzKxG5gl0gCckWFPbMcrWRfmc3bRot6JwpF bfR/w+DXyB3mxrf9Eg4EodcLKU4MYSLAuXa9DAg2OOQgPkkj7bNlMkaGxRcq9q7Qj15viZsZe7I/p QhaAaErNfuR3eJcMtBXo33L0wBY+uDY9Npc5htKlaQKj81rFtH7kMFkp3T+hdC3nttjsr6twCaXkc +OxnGWdUA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCBG-003Be5-5H; Sat, 24 Apr 2021 06:54:18 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2w-003B2P-T3 for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:46:25 +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=U4KRqQBEXto5Miu29LofOb5V0c sjQqGLKcwKJomLVlTSdSH/e0zSQMy+Sb35njvpoH8Ys/uOOdlkv6TmwdDh5KvsmDCim2mP2fqKL6f P1dUwytPtNtfwZii6MZoOy6ZPnHCUhu8IoGr1cRqGNfTVH3wqW0Eu5tylHezELBqrh0KojwuQAZWy DKoV4Cv99e3GuD8yPAclmrJr/hloWT/5N/1ayxlmHyya42EQLuzBmTGLF0Iha/+MA3kXWcY5prGw5 xgnLL778MDtTMwKX+ss9vKte1WeztKNFtFjZgHaiKpW1JcNjjKyLe/5F0G8/xNUMrvq9ENZ8iHq19 AmSoePxQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNE-U2 for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:40 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 235B661582; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=P8ySBvxIssOsYGuosUcRi8p/mrvcDEnJfSep5KVO8S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKO9//nAW4HuRE83veUq4t2sAUiO1ZD6GT+WtlCJbxh2Pwmt4Emh2dCEsdBFxi3lX 9Lq9YL7J3aiCAjPuUPqWUDIDMeLTI4VtsTZc3DRGu1CmGqlm4xfODLYLEHgi3Vlog3 0Nh3yuO5UD7MUqDYXHEmpWSOY+QHCbwQMj67QUR2uCIhuLAYpSpvZyWukopDhnyPcd D6d+acRK+Nyazme5Y8Fc0oSAqKz8Bob/prMSZImAZJx3aoAc4/5T0nciIK/hReYzOa zA/kFa8s5PPxu5HZ945P5f8JFPYIni3mFsLBOxzwjB2p/KQCDtUNECNEeTSVISwnie M/9oehEWrRVwA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004JeU-Aw; Sat, 24 Apr 2021 08:45:31 +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 16/78] staging: media: cedrus_video: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:44:26 +0200 Message-Id: <58a0e35f0da9e7c25dea9088a439a77c6a448626.1619191723.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-20210423_234538_097343_F6BAB070 X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/sunxi/cedrus/cedrus_video.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c index b62eb8e84057..9ddd789d0b1f 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c @@ -490,11 +490,9 @@ static int cedrus_start_streaming(struct vb2_queue *vq, unsigned int count) } if (V4L2_TYPE_IS_OUTPUT(vq->type)) { - ret = pm_runtime_get_sync(dev->dev); - if (ret < 0) { - pm_runtime_put_noidle(dev->dev); + ret = pm_runtime_resume_and_get(dev->dev); + if (ret < 0) goto err_cleanup; - } if (dev->dec_ops[ctx->current_codec]->start) { ret = dev->dec_ops[ctx->current_codec]->start(ctx); From patchwork Sat Apr 24 06:44:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12222493 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.0 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 2095DC433ED for ; Sat, 24 Apr 2021 07:07:11 +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 D912761490 for ; Sat, 24 Apr 2021 07:07:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D912761490 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=yZ2AfNtVhPJjCmvMS26Y/TMHIhMX9GrP/virY7HIUvg=; b=ZFL8IXMHTGK+ag1+vPitOKOus /yJVKGIRJAWdOcWT7o/8maKle4LzkmiMXcolEVckLOM2olBzddpq5kRPZPjtMZunp0yyKeaiu2SUG 24GUQOjFd2z8exWpRuI97+QFUVFqE37cyNmMpVVVpRou63FseEJ05AzyNChH/8dBacljnV2c5Wy4+ tn85k/EhVxodh/bw3Wf9zNA9rI0b4z2dz4eEtiJQeGHZ53558C1RDJF9oR1bucp7aJbzQtBV5g+M+ kqaDDq+SxPMP8XU4Wy+yh8R6RcmizzhnjwwUHW/xrFnOkl8OW2d5xbJWasvQWrDPyIxh7ck/SAUHr LKjarmaJQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCHq-003Cwp-23; Sat, 24 Apr 2021 07:01:07 +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 1laC5G-003B1A-Lz; Sat, 24 Apr 2021 06:48:09 +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=q4Px9mXkiV8qcuZkZIuP53Q5ILd9wZRzriOgLa15afg=; b=wfMM5QIzcILFDJ7Go/II4N0u1X 1R/Xs0A5Xv3mmS339QR0D7a4RrDLBzSnYVGlOFqwugZKd+idcWtL4Nec531tP0A1b7QBL+MQv3qQQ hzRBbe9hAFgaWCND0K8jlW0lbfLZCLJLHwgfH9B/9WC014nTw9P/u3g1az9wyyMHGDgo3fZSjAzRd REYGWFSLvZp45Ik8pjMNbMrn5adCIxZ1cgMY0lNp2ORL/pkQQRNGam/l9ROCFKxy7xQFENBAi467B QBGMCmaNjVtte8Mbknj3ICygrN8DdSdv6jUliZrfUMczTyFI7sTlqxcRxTAAupaQcDYqqkCspoezw 7PZfLVhg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNF-UF; Sat, 24 Apr 2021 06:45:40 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 454076161E; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=+UVQLbAwUBo3UU1F0075Iv595HgVTLhRfgrIPgnhUE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BivJEy9zCCeSFE2A1Si3diboItZlT++oy90qX+KxcKQkZTg1bAseNAvYOofN81hYl dR1InB4kajF5CZg2+ge2iwnBbI2deReU3cl0X065Pd+l5cDGTRIy+m1Kt0OjDQsRlb hXCiHU2wyFG4zuzal3MP1r5EiHkoxySYiURx085NdoEqlLSxkdsZviXtd0tRl8RfRh JK40nz4xHsnina8h8VZKSnxg6yx+Sc9zOKdsSAhHUyVGAAY2pNcElmFqARLieEhmFn oZmw5DbtWSzvUGl72pCFsD06N4MncZ0TC7kAJTFj1B+Ioij9xx2JVAV4/7ymx0etuU xHnQ+bIKIx8tA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jeg-Eu; Sat, 24 Apr 2021 08:45:31 +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 20/78] media: mtk-vcodec: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:30 +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-20210423_234538_093704_66106774 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. 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 Sat Apr 24 06:44: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: 12222497 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.0 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 D46AEC433ED for ; Sat, 24 Apr 2021 07:07:26 +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 9B05D6146D for ; Sat, 24 Apr 2021 07:07:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B05D6146D 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=TJujEY5idVpI7JIYiv3U81SYdvzGHazOyT3rHPLbm5o=; b=D8QmKIzuy5csX/1gJCUH6V8xR IuhW1kSbns7Xu6uKcSfsmJjfCQDwTazlrHQRLRfOeDMjO3DOctQP/xWgoAhBe+NZBKJtqWzEpmapg V7v2SLuhzWysixBCs4hVIjlzpMD1br/UUYOxPJYhL0kdj1lLars9ombADlNqUTOaSv5fw2G0g5rVn fx6ykoqZzxgoctWXsixk12IoFWgP5CTQxKC1jsQ4P7N/2rD0YqOZBJHXet8fEDF6X9pIkp341L24W fgRzibG7rZYpLNeZ2m3NWgCBEdNz1ey1/CweLUZkBsWJ3bZYx1N54+8z92Piqa7AcbSsIkDzgcrAL EjtJBnzhg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCIc-003DAk-Ta; Sat, 24 Apr 2021 07:01:55 +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 1laC5G-003B19-LP for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:48:09 +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=mKZtD7iO8l3mDyMGW/FhxvGp8k0Sp9C0Y/ioUgmVGo4=; b=ATICISDMLyAQnhS0cedH43WV1z Bgg1DrjnlwGKRKFDFjnAc8Bp4cZxZm0QFid7nvD9kPgDVynw3l55PFLapAbpL78Rfh/DWjDZO+3iQ KO7FUkiLWX9HkbQS7RfwRQcywx0c1s4renJrvCzk+nOPAbnEmfST7HtBZJ98pVPA4xNxuZR5ZvWdg dRt75zRTY4e1nTon3i//jjXj+Bp7AkChfbZQ/yowV7/wx0RsiHCzoVRYtxDc9oZ+9G0ecL3QWOXOb qqofvRARMy72KCpPVe21s8UiAV743tf4a9uSDH6mUeLoILaAppzO5UMIpfef3q8KgU340BnRCxC0s 2MFvk1yA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2s-00EsNL-2M for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4908861621; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=HPXSSHVNkadxpReM7bF5CuY3s1w7BYlO9tOtwx586ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uU/J4RVwTdifXUXHaWtAFQnuBjrZsl2Tze9MFfsxMVFh8KugwkvcLGaJqH9CeN7lQ DYbqKgfIqc8fPzWqecO47Zudi2mkwPaGLSUXxAgHNenVZT5/olSkrTeoqvG4TLYHx9 HBarVv+6R/lacN5IT+7O9rCGBVw/fv/jcSjXIs4Pc4rrU/9FkW7Z3mem7I3uD5JFBO DW5v6Z8HerHHlWbXREGMuPIbVIyWu4ThStFcAxHe5ULgz0QqdEp8Y82S5+Po2DAA04 9OYqIDtHwaK2RydimZaH9LVfvkbUXcx5d4AqQER52UtnQnMEAGiiKXvLyV67XpIo35 cpeGyfHPBaLeA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jej-Fu; Sat, 24 Apr 2021 08:45:31 +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 21/78] media: s5p-jpeg: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:31 +0200 Message-Id: <01560ba01a8e6ecb0e2e525e9b47a544c04f735c.1619191723.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-20210423_234538_217193_586204DC 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 Reviewed-by: Sylwester Nawrocki --- 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 Sat Apr 24 06:44: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: 12222501 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.0 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 BE46CC433B4 for ; Sat, 24 Apr 2021 07:07:56 +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 81A906146D for ; Sat, 24 Apr 2021 07:07:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81A906146D 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=2f2OwNyEHyJeLTKqvK1J4IjCZDm+XVTQk0fH/DoGcvA=; b=qR2FmrXdBO7g3aUH1z1CIIu9X np+MatKM8iaDPM/K/Gfh1YQs8ZhbbM8RBiGWxsXh/6EaJGISMOgFFTA4PsShjjlLw2y7lU8hYLnLQ Bod5RExU3MmRtlOuZlqVFSkj+8slCbUmjadlZpUhROqGs7xY3vkEjWgHeK2FNeuUKld9sw8aoiXsC Vm0MuaiqOoS3npThcjgA7gnguIW5vTN/ohgIkYNw/3cufcnXkhMkQWRTciy7HqhlGhqjplP5Pm70V PkRx5aBWfHOxv/wRM2GtN9sO+0KDfh8neSsKW9F0uc5jyXzext99pwJSRvcDWIKvkL1GgLDpWOUwP 59ICcR69Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCIy-003DIc-Fc; Sat, 24 Apr 2021 07:02:16 +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 1laC5G-003B17-LN for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:48:09 +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=Wr8cem0Apl/gSqrcJ45uPbdH0/0UFTj9u4p6Unjg8y0=; b=gkuDVvsFuwrklf61Ct9zw+cOxI gkeILOiIuLRZ3oNPL5HNkjLEgSoeDhsE5ebIhUFZ8MqjpvGDseytXlRVYBo5c9nJxtCNMvGI27Lp0 3qbcpVA7gIJRrRcEtRgD8dfyYeMtN1K3aBKhSExmcZwVvebzS/7JZzLcbEGTPFKcAIyPLtcFT+FGE EJXjm7Y17ORHNGQTEjwIFBoH5uVXVlg7wT2S4e6GozuFtEbmSI67RzRWjlOQ4RdfEe/lEntclJ/Ms 4883eK4p7bE7ySVGudw01UfyaohybazJ7vtOLkN41vFRPMqzbPyzk3AH06w+DwzkM0v1EkL29Cest m0WDRtqg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNH-Ve for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57D6261626; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=qoORv18jmoZdLwiy2XtjoLyEheeVP14AOEUNQBQWQJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ieDxBAbfFaxqZDSr+y9csJifDJsicJVEQJ0wjfRFLrBtUEf5xhPDf9t3dMZ+NzXzF J3jyIVhgdw5MLa//cBQu53DmuRneAdy2MrtXu8J3K0WnGtgv64BnxrKP/a8xJBEbH/ sjuXjAqOtuSFABLUYt1CiN+OUI9DQCTIGihSXsVlA2wwnybntBsDprsMv+XRAnl8mu STkF76aBxV2Bgturo3rIVJLeNT02rVnv8WP0fOkSrd94lZfiXAE+mbyS/sAiYL8OeA qNE21qdWvcfAUNU43NSoT7NIRFlTRz6HbYH5KchIj3O/NrfV87aqbvxXq09vnMh5E8 HeKxOL8gjn+cg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2l-004Jep-Hm; Sat, 24 Apr 2021 08:45:31 +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 23/78] media: sun8i_rotate: fix pm_runtime_get_sync() usage count Date: Sat, 24 Apr 2021 08:44:33 +0200 Message-Id: <4be9eda76abe0279438375abb0204bcf96aeb618.1619191723.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-20210423_234538_117612_F9D85955 X-CRM114-Status: GOOD ( 11.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 The pm_runtime_get_sync() internally increments the dev->power.usage_count without decrementing it, even on errors. replace it by the new pm_runtime_resume_and_get(), introduced by: commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") in order to properly decrement the usage counter and avoid memory leaks. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 3f81dd17755c..fbcca59a0517 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -494,7 +494,7 @@ static int rotate_start_streaming(struct vb2_queue *vq, unsigned int count) struct device *dev = ctx->dev->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) { dev_err(dev, "Failed to enable module\n"); From patchwork Sat Apr 24 06:45:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12222481 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.0 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 2FEA9C433ED for ; Sat, 24 Apr 2021 07:00:35 +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 B2CB26146D for ; Sat, 24 Apr 2021 07:00:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2CB26146D 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=eDwzSAiReeETjMGxSw7Mmhg9eRIcm1W205XMCjlmjpg=; b=BUqQa8GsfJm7pG7nlqjYiThPi X1Qx447shi9iz9jH8yIFx5vyPwhGrvfjIG70lF/h8bC4pQoB6G0KQP67GpK4+WTb3QBX9xXeZvkM5 wKP50uPO1wNf6XQlFpi8KeeB3xVpGlYy5X3qyARTrbPnn9iEggfEyqwnTKa/YkD/A4+EeHrVPT/Zu M1h2HYE3VgN+L9U6vIQFXbwM28C96eJ8IKTcc4Dw338S4qDnvMj9w5ljd51eCuV07/eEs7iFCkp5A WDf6YkTuuSqdzeZXMkEg1vx3cNgMeUgtd7CUGgDS1+wAKvCGBnwj0c8n9TQ85cgGhCIBWdvZmm9wc FpXUFyKCw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCDG-003C53-U1; Sat, 24 Apr 2021 06:56:23 +0000 Received: from bombadil.infradead.org ([198.137.202.133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC4V-003B2P-J1 for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:47:56 +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=06+kctwjWq9K5sHtY5mlFBNTDgO1WF9+GRsnr1oDSG0=; b=emgDRobPTWocKkTW3S9kzW5XM3 KFdWgmQc+cd+irN7yQC+Mej+ZVNB6I3I47lxuxphIG8eMOt/t++MUR63N1NdlbQeVD5rgtHh/FfDT 9P3qJFcju4EsQJHD9ggQo9qDRg5Rrp2/K3k8dUJITC9kBTUB2fgbj/heMQ+V82BqBTxtyCNILm05X KfzaAbix2n5/cE91Dor75lpw5A8M5GSJS624hN7Y2NWXulTP7nj4YI8GVxuInFnYCfO4wnvF3F+Fi ezcLfwOmMtkD3tgjFdikvqX3ILCTdjZeVBeiUMVZgsJJiBqeqc/Apb92ctpi7QsyeMPzJFU3jF7uo JRr4Ac3A==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNK-VF for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 576E661625; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=29dlXhk6dfH+e+FLSh4QvzO2Qlv5HDysHp3akNDzvhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZ1lJmlV0lfb+3SDV2UTpmqQfyU5LTjhoRqwNsbEBA7AdIM1Gyob1SF+7GxmJhpeM ydJ6WcwDhwlGascRxGQJ8KKnkt4ARlpzYwOrHfCUNtEXJRGlAucjxOk9wbCH9c8IWr cUe1/Fgw+gE0+MwJrVxSWalhH7gam4x5o9CDsmXLiw6yMcMhK7Nrete+lsK/+GF7io fFwEHSfzHy3PLKJlO9AUto6pmgIgRa0470RiQjHeCvlFHbAe+1SCvgpzOpPj3HY3m2 554i6Bsa79mo/Tcd1qlc670t35mW30ewMTGx45YYgdciBxwyoa6BI2foONKhi3VJyN dHrT9iK1n1nzQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004JgT-He; Sat, 24 Apr 2021 08:45:32 +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 57/78] media: exynos4-is: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:07 +0200 Message-Id: <091915bb1cbec13b566d129f85ae229fcb92e2e4.1619191723.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-20210423_234538_200842_0E173CB9 X-CRM114-Status: GOOD ( 15.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos4-is/fimc-capture.c | 6 ++---- drivers/media/platform/exynos4-is/fimc-is.c | 3 ++- 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 | 5 ++--- 8 files changed, 17 insertions(+), 22 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..bca35866cc74 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -828,7 +828,7 @@ 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; @@ -862,6 +862,7 @@ static int fimc_is_probe(struct platform_device *pdev) fimc_is_unregister_subdevs(is); err_pm: pm_runtime_put_noidle(dev); +err_suspend: if (!pm_runtime_enabled(dev)) fimc_is_runtime_suspend(dev); err_irq: 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..a0218237d66b 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,9 +509,8 @@ 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); + ret = pm_runtime_resume_and_get(&state->pdev->dev); if (ret && ret != 1) { - pm_runtime_put_noidle(&state->pdev->dev); return ret; } } From patchwork Sat Apr 24 06:45:08 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: 12222495 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.0 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 AD51CC433ED for ; Sat, 24 Apr 2021 07:07:21 +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 2E64F6146D for ; Sat, 24 Apr 2021 07:07:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E64F6146D 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=qAuIrsqrSD/WmXh3CXvDecDcNz4ngFKCsL4r5NdqFmk=; b=rAiB3QFAm7GdT+aEakr9JuKSw E6GS5iCqLCsvZ5XntXQhuH9Ed5ENqNodLr3m66j9ixonTZcSsw1h2hPYbVYypWh4T4E8sGVfyDAbp /O+uwjgynffma7CT1xRU/rCou0E3TUOwZ5/8Vf0EZ5LMbS7nwSYs09hMjrT2mNQTvRAjUFr1nnUOG /NQt+CdewAmqL2+i1SHbWXx3CZQlUH3Di3ROkXWI9n0bvZ/0uJsjxqZfhoyEODCVyHtLk8ax7/R1X s1XVovgJ8BvC0L7MUgOK1yi7GofaNv4xMGCGR6fcDzkxL6Mi1rjoZi0BBv63Ug5TM8j7EHZhunKh9 M8Njg1vdg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCI8-003D2R-Uc; Sat, 24 Apr 2021 07:01:25 +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 1laC5G-003B16-Lc for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:48:09 +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=WEoKSli4CVZz+4bD9y2dk4c7P3DpoTs6YwkxOMxzuPM=; b=C9CSNEyURQWtfNqICuX5ucK2dU 5Nxk2WViv3r1/JI3tQCaKQSfL41v/D8SXLmhaT7bI9FVj5EwrUTF1foH2yN3FMM4XXh2Xjht//o/x X5wlyYBWxCdxE8yZO5joPgULnDWnqcX4U4aNCCyPmTbZa4pGXKnWTVyLAC7aWNNWVmzUoMeD72znz 8+B0SEG9KWZe2N8MXCl3JMRJHecPmKM1hrlr+sPyZ1i65IGGNTI+c2WfSexHLqm/UyKMrcJ62XHcI hYt7HiFvACz3iaM+R/qYpr323oOFWL2RAVh51ZVWZXHe6vsbyPRFk3/r/ThHZdMDPGmZ9oD4rHFxK isY6SI4g==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2r-00EsNP-WA for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:42 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 617BF61629; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=RRNI/XcWNU/RuS+rdQ4ZLEgZbvA4GIVDsHd+QWsqIF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=or0k9a+J3ADO8YB/0DbxauzYDJZNi/nOzh9IW/q3WdpTEYIt55ZpVzqtWOWdKflrR ZRO/qkj4HHU6ijkhCPWH/g2HsF8iLnxsQAkljinBGBzMqcy2I9WU7RywaZn7csL6gP Dw/ZcPCL8yLN1YmrsYY49RLwdMbQf8hAxAFfoZfqFg4zVDYPxP2PRzagCORNEynRjh 9E5HDkNjHaWZ1nx6O1+7A3pCoKZvlt2m6XAPgS9qyk0bh0XtYOkr0ahCuWyrUZeKJ1 ebUae87vtPECEN2fnmUNQZBEGcvCBG236hOzpMPPxanaF3UTzPyxdyk57ThMNr4K5v hMhEHmW0ZRyPA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004JgW-Il; Sat, 24 Apr 2021 08:45:32 +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 58/78] media: exynos-gsc: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:08 +0200 Message-Id: <9c7d683907b9f9cf4a99f57f978671ec7f5a1dbc.1619191723.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-20210423_234538_176264_033F3420 X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-core.c | 3 +-- drivers/media/platform/exynos-gsc/gsc-m2m.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 9f41c2e7097a..9d5841194f6b 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1210,7 +1210,7 @@ static int gsc_remove(struct platform_device *pdev) struct gsc_dev *gsc = platform_get_drvdata(pdev); int i; - pm_runtime_get_sync(&pdev->dev); + pm_runtime_resume_and_get(&pdev->dev); gsc_unregister_m2m_device(gsc); v4l2_device_unregister(&gsc->v4l2_dev); @@ -1219,7 +1219,6 @@ static int gsc_remove(struct platform_device *pdev) for (i = 0; i < gsc->num_clocks; i++) clk_disable_unprepare(gsc->clock[i]); - pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); 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 Sat Apr 24 06:45:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12222473 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.0 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 5425AC433B4 for ; Sat, 24 Apr 2021 06:59:42 +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 0D849613B1 for ; Sat, 24 Apr 2021 06:59:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D849613B1 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=HUHpirNZ0iiNzVH0O8NxEvcrH deBQsCyFNU063diJ1bj0vBZe35OjjXe0YFtFXY+Am8i+ZP8t+v2mb2Sy4/oFPQCe9DtzkkGEyZggC +YbpXdQbsVugZ/7J4L89TEBV0ed80zeDP60gG7Nw7SlJwOdyQST4gpVGoGHLUkmngemKnT3VstWdz WP9mvMmbRexSYmC70UntBGh6BapKlmHBnl5AlX9R6qweoG4apDVKsjrxLvzq+7GVOwBuYa1AJR395 nBvrJpzqtRDacguy/EU08PksC4OglDwVxFhH4Q/eR7E5KaRiHKNuEwQkOFGRi9LKKNuYmZJamlF6P mJVm0Y/sA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCBx-003Bpp-Lx; Sat, 24 Apr 2021 06:55: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 1laC48-003B17-7r; Sat, 24 Apr 2021 06:47:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=6tWS5AWeHgEG14BxYeaqs+XN0hv2Iox9SZeAydDvL1Y=; b=WMvKg0LO6o1MF9KZHv06Vp4l0E Lh/6qtNn8gMVU9oKS/cQyJksjesQly7Ga2Qa0Ku+HG+yi6PR12SDk2TsGjn4s3/jkcH2aDvTjfxYJ +Omakaj5KR+2rsRyhgg11P4O0nPxcW2JKVwagneFu4P1pQah3FD5AzKXyoCshoLGz1CXUes649bKu doZGKVx5aOjFTqXqA0FTZAIbJSIWz87/jdo4AYmmp5xussQI37gPGyXg68LYACS9vfDbujOS35zWM hx8uuvl7qZOz2nMl3SIs5r3LAg1meKr7oSj0EbUOqVJwPQ6ngoReNQKK7zq12cqUVDJXzRhx1xD03 jEVDOA3w==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2s-00EsNO-2N; Sat, 24 Apr 2021 06:45:43 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 66AF06162B; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=tu2hhB6CHAZbCfvPd96Qq+9zsUaGe3IxV7AH+2XbuEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+/V7LjGP5QNR/LozRTLlxP6rqFTNzKUtnPpZ5fF116wkN8e41wvxB7Hjiz1sl0ZW dfZAhn04YTu88YMwAshkldtBxB1ykXatkdrIXgvYS1fTUrvp+4jTChS5Y9mATQNCQl ENjr1t2N9jA/CNC1CkJSk/CL2JuLilyLEQyBYrQWw5uFEyqL48YmnvPjPAZnh2Nti4 3fAZy/pEZ52FteSb5/ZZvFk1BtcRyhNGFb2ZhTPeMW6XeT/uPLHmYVHkHihuo6vsBd Kxgdq0evCxU1whI5y+qBHnSyq1it1BVnD9oAxhDmTp7LY4KszmC9cMkjoP9MaRtfLj C8m6rzO6fDdmg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004JgZ-Jj; Sat, 24 Apr 2021 08:45:32 +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 59/78] media: mtk-jpeg: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:09 +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-20210423_234538_287115_3EDF384F X-CRM114-Status: GOOD ( 10.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/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 Sat Apr 24 06:45:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 12222483 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.0 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 65490C43460 for ; Sat, 24 Apr 2021 07:01:56 +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 2B0FE61406 for ; Sat, 24 Apr 2021 07:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B0FE61406 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=6gjxS94/H/FYQh1Rfjzi8G9HzD4Ohbr0SScDIiyNam4=; b=E60iNLBrTCP28i4zQKfAU0sUL QRxnRTpO30x+85wKt++NJhHmyc6qIxEb92VpeToO44h1QookcoTnOxqagIAn+uwKXK1F5BFsNoTqE SpUhaeX7nSi6dvJRXK3n0lvc0S0AJkINClHIq1XxRFLaN4NsouWW//KdRDy3dc/mnSMG0TcPnup9h vDXB8sl47d6ybhV4YHPQh5KKLS7LyVZ4se4r8tqLuL9HBlQSonwcX01NQOElAU9F8Ll5mW++Im3r6 e4APomHmrDxqw1c8SJN44MI80bWQxPLsePZE/MfJeunYWhTLbe3rLKpDPaor5y0JsQx8/l41rrn/A 2pANcR6xQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCGs-003Ce5-77; Sat, 24 Apr 2021 07:00:09 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC3a-003B3u-Lv; Sat, 24 Apr 2021 06:46:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=31lQ9Q0q3z8nrhZvnV4h0miuLmDMFUTT13BiN8z3rQ4=; b=bm0vAlXJ6yuCNr9Oh9bu+dHzu6 wqg9bbFowNwRcF4HZcEpiFFdIHVpjpr7YIMDlMGu8JYLe7FyoEGEeOFEmwDd45A43ytvGlBz4DOni ebgNjDTHvNkvShJH3rX39SgHwXFUtmUEcamU8ryWq5ROJEN+OX//wd6Gi8OLXu1xtyTXe17C8Cp/3 rDHHAVHCIJ4Pl4m4MqaDHxg2wczn1wRd8AVSoEOnYnYhqu2HgV9ObaoxYqwTzB4OonJwPuzNl77xA tmcCbeMVnKyUKB3QeWp2RRp8kyML9KC1tJNCGMYKrj9Dxrne1yKAjuyrWd/+txhdvcBaHBu66madP dE2Vf9Ig==; Received: from mail.kernel.org ([198.145.29.99]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC38-002ong-Mb; Sat, 24 Apr 2021 06:46:14 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id DAA3661947; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246734; bh=Luw8i8Wcr7RDhUVQIyKtJIy/TBYgdc1v0nBhRGIz5pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JJ/17EXdIaQo4vBdqcn8JHsGJHsoMw5jkwHxTd8RLhlkeCZAVlDKL4jNlzaLs6zMk cj0bG8LnkmhW8S5GC1ZZuqLIUmdSxJX9He/1gjHyQRPUVhn+Kra6G0EBaKWOhGhzle Yt+PQvyv8jUgLE+29ufR1Oj0O1C5zJP31ty8iLLdn3Y6Og3qVG6+uusqBuZ0G71rCq qUlN1tmG/hoaAGBgaAkvRuXVEUvwk2fhX/enlHxkU/Imxl2NrlxGmrEWhx3NkiN+j+ d17kifflA8o2KmO0/Ki7VtRHwTKYRVvCc5pdLFCJ9MuB99GYHxTWWmCX+fCd8UzFVk l60IDpBEO1rEg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004Jh6-U4; Sat, 24 Apr 2021 08:45:32 +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 70/78] media: rga-buf: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:20 +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-20210424_074600_335254_FD5E5092 X-CRM114-Status: GOOD ( 11.09 ) 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 +-- 1 file changed, 1 insertion(+), 2 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; } From patchwork Sat Apr 24 06:45:21 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: 12222475 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.0 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 6F88EC433B4 for ; Sat, 24 Apr 2021 06:59: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 2D4366054E for ; Sat, 24 Apr 2021 06:59:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D4366054E 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=Rq9vb+YTr1nHaUOLwWBeRqm0P lLGO5fVTrVMSst6VMmdVmhlUnBHk9TgiJ9cDWEM8B67ds3WoQm7O8Y4SVCwqxNfOCVlsX+vBxzyi1 vEokKbhccZey/N3S25MHpPWdbhRAy7wBe2JXZ6nSqOf9Xb/STPxV7X1e6dOT2PRojTDT16lXc1dWA QpB2qlNJQIRxo8BhLXedFY1xKYPaVYwZd2PR9md0oLTQvSTLKehf2XGyO6ISEyyH/qtHNGycb4VNv C4RFetjgeKdFiRLbdLtuQuG/8t754NmGv63e/JeRjb5mgwKDq2OrZhPfViyVRI9/K3NJY3sqLAZh3 KqoRSbOSg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCBf-003Bkv-Ms; Sat, 24 Apr 2021 06:54:47 +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 1laC48-003B19-7g; Sat, 24 Apr 2021 06:47:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=wNlWAJheWo8r305lpFRr+Xmq5CAdeEepltQZlmQJw8g=; b=NHUs6lrqUv4IsmBfjML1Hu5xuG Vqrt9qzsAGuAj19HxRB5Rlr3YhW4Yj/7w+wwJA43qok3yovwygr8tgi5UJZZqOmDNC/AV/qLHxhnT 1PzV79IrWcaPDZ11JNTKEVi1PK1nY1sl7LWgQlFM8FxOxlxxHp1q92L+JRcfOhwi84OzHavq7XKhK f5Qt4YbPL48009g4FEc+Will6gJOOejSmbLirT/r6uAchYti50tbgQjHSoTXNy5hF08/HCJ2ITTxH A0zvKodOMjzzglsmFfUrkX21BrvOS3S7o9L0+IYbQY8hVaO+F4DH5v6iuulbM0ALCOITCvr4RMtxQ rEA4c1lg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2u-00EsNF-Vn; Sat, 24 Apr 2021 06:45:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id D21C561940; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246734; bh=rChg/pXG2Qjbehywcb/+z5hE6+LFH66GvNnoCtLFEBo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYfBpCc0b7yu+PCNCaJYwzPgNpbFVSNy8eLEqsU/6U4xeQGj/iXnAMxEllUBEx/uN QRTXIpDwnwhOAPo0qTpRtaBJiNocQiF+AOLWYkm/3X4SYG0+5GN7VTt8ZnsRLp+JXL uYcpJEoH6bjiWN32auW9bGEup7RtOGFCU4LuIeMgz4NClFaWsy4nVOhi2kJT6ZcgfR FxPb9QJPe2qg6loO9J8bpK+zhjYABQ6chMCKkN3uYNsjrHnq4YSMRaaehTPsXasWvG igmEm3edSnpkHHt4mQ45U+PS1cy8frNQ2vGTRkuW76pxe2icUGVgZsGIJoX7F4tE2Y nog9MF1ncFQJg== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2m-004Jh9-WB; Sat, 24 Apr 2021 08:45:33 +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 71/78] media: rkisp1-capture: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:21 +0200 Message-Id: <563a000045b459596c013269311a738d2dddaa37.1619191723.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-20210423_234541_068347_C27C4811 X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. 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 Sat Apr 24 06:45: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: 12222485 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.0 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 F0424C433ED for ; Sat, 24 Apr 2021 07:02: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 96B65611F1 for ; Sat, 24 Apr 2021 07:02:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96B65611F1 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=f/TlledRCra3lSd7nRkdNIsZ9CgZvXjNqhSwkaUdOQU=; b=NWC/MIW/HMtXzWqvIb6LrjjNO xv90R6i/761imc6eqTW68UztTqRwcjjf4WlDRE43U4YtdB6Tf35OU4Qaxp5ypMLrZzLgUeRpICg8C gtWPr8FOKsuR+cGppFx5eHI944yBX5iLeiJG/XK+eUTZx8o2qAPOc5Y9B6EFKh18FsDySJMiTVD/y uTPIeTrH0qXUt4ze0rTQCJbhos4G7pph7xVOkjbspOKh8Hgi1oiTynrx1xPtD/K+6n7E5QIA4ThTu ldfR/jbYXJoMhCSwncwdAiJOJqptVomJT4cNAVxOUbrl72lV1xBqIYFUoxtejtFFW5B+J50pwirF6 EasFAIcPQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCHE-003Cjm-Vh; Sat, 24 Apr 2021 07:00:29 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2x-003B15-50 for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:46:35 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 871896188B; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246733; bh=9Su9Ws433aXy+PjnC7QMSvzB91NG3iiE93sDFxFiYlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k3IwNuO9JMoEyQ9FvrtBgiP3PNkgHehAJeBvv27jnD2LTgixVhcN+yY2yxx6QfOqp qFI+9N8r4ClXilr1ekgllBCV7Ga7L+l32djm6Ne3GhYR+AARlfGoZ9wujGcoDWmUqd 8J1Z8OZwEaGArfslRwcP+N9IYEXV/DpVvT4Us3DT1wJZ9RV7A8KMhBgxii/UqiQ5MB 1yCI6sCUU215zXHaOAyzLxSadhioyxqx+1HorBHbkbm2M6+U3bX9gsiKQDrJiJgq/3 7dDajXZuKvOvsJAntylVrSWWAMMe065/9lLgI/ZyqlgaiRL9O0PPZ6PvyhBfRBG+47 VkH6CxVQEKT5g== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2n-004JhK-5G; Sat, 24 Apr 2021 08:45:33 +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 Subject: [PATCH 73/78] media: s5p-mfc: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:23 +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-20210424_074627_319288_5144FB17 X-CRM114-Status: GOOD ( 10.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Sylwester Nawrocki --- drivers/media/platform/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 Sat Apr 24 06:45: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: 12222479 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.0 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 0C224C433ED for ; Sat, 24 Apr 2021 07:00:07 +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 C444160234 for ; Sat, 24 Apr 2021 07:00:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C444160234 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=oWi1IsyS2niB3eQLQa27EYX8K 59XNYLB4YFyksKQCAH5LGRg9BbaaWHerdO9dA8GhekNNEvNXrekFtM0hhu1ZwZJQHufIKmSZh8niy +10HG65XgS6EkZeDjl1SmW0a3hqauFXHt7EXs7W9OiV1/w0XW564lc8119uIswRV7MKtuiam5kGLY 1AIUudOmvFpVrcx4cvNai7P1/96gpQ211prAgcg++4K4gyvc6oNyBMtYV0IMZTpoS31NQSULKxDGk Mozk+euxGiuAO1dgydo14UGv4PQMtiO1lhwlJQkxtH/EU8i9dQf91/R+V+iVSPe5/+S1LYhrOCBwG 0wytsJQ+g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCCN-003By1-B9; Sat, 24 Apr 2021 06:55:27 +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 1laC48-003B18-7T for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:47:41 +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=EDguwAes3VFVdnTEasfBcZSeHV MlmwnZ0ei3HbP9sTc2puFD50hjQDQ1pmw3/knmHYDHbPGXHW1WMIUfsNnm69LF5B1obCYlOs6I8p7 2vRmdKhaJ5PN0tKwyjrWCCalahKgaSzcTrXXpEU5pTqZLzhmy6x41ZombbWxf/SAe2X7NlsC4kWo+ iD77TtBMdrV+qMIDQW/ihogG0+hxSJTQ/agMAPB+0ySduhNMDknjPvZb8L7HSJYfuD/Sp1x//yw+S hqL+NtE6hXgKRnoKd3bMhg4YxKR54E0g8fAHXlqE1DguTD1roeh0Xt/nUmTBK1ylFjyCUJCrSBq8g +rSSvEVA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2u-00EsNE-Rf for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B293161930; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246734; bh=/R60wucnhMxzatTcaaq6aX+wA4KyHRrla+Ogrsx7GxU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGxOGCEDw7emVbfmqcy/LRzHXKZ0GH+CzQmXW5EnGtQthu9QU/SBU5ZgEqwxxWiBc FbCDMuoeky+RsOMkSAeO5JNJFDIqX81lKc4pvE1ROLNClyVSWFPaSn1sPswhnJo/ag dRRcBRodIRaIzFlJjN9Rta+T110d7QJ4//BaNnsxhEh+GzPPwY5dh/xUT3JxIRhAeA G8HwF4R+D5ia7F8B5r5ohnPG08I0H0qf5A4GsgP8aULQa36mrqx37fz1YSPKkqzbBr BadhMMj2VCywfwH8/PJOshLrP6jIQx7oi8AkuDlYoEK3S532SoeYCV/+6KY0215mke qmGNFXbzCkUcw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2n-004Jhk-BC; Sat, 24 Apr 2021 08:45:33 +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 75/78] media: stm32: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:25 +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-20210423_234540_969153_F2F081E6 X-CRM114-Status: GOOD ( 10.90 ) 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 Sat Apr 24 06:45:26 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: 12222477 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.0 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 C674EC433B4 for ; Sat, 24 Apr 2021 07:00:02 +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 8DB3861483 for ; Sat, 24 Apr 2021 07:00:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8DB3861483 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=ZjAMllR9I2hdMiJnAIuqQTfYN5cYA4VFjK4hsKy0ZGQ=; b=Cz4aOiyHxexpqmV4MCEx052y0 lcUYcDYUxynz+KK8BH8AHZaGRGGYKIYLSBAbmQcd7jyhew77kXHvrcMtEx6TL0OpykGOgXozcLaYy wJnS9AgQWHjp0XYL1N+CZLXnP+RzUkwdZhdCFXAZPydZYVJZmZQzkwzUMROARaBv65qyoHZ83V3fT qG0h/YU/OB8o3zBtNE7C/2rqZh4F2pc/D8n1u/SjeVFmGBc0pVXQcH69qyeWYYK8CklvRaTV54I51 sY5pLdG/kV3vyrq3HWx3FTTDnBiJknjQGXs4azyhheNS8m+MM204SeJfuG5H3pg+uiiD58uqZDPj6 EgCXWzAOg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1laCCC-003BuB-Om; Sat, 24 Apr 2021 06:55:16 +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 1laC48-003B1A-7p for linux-arm-kernel@desiato.infradead.org; Sat, 24 Apr 2021 06:47:41 +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=moe1/9thFZyZMmcEGO7VQ1OgwUo3HaCb7+A5D0hpp+M=; b=BdbV6DPQwprrJHsNs3Gm0LwY3C 7swAXuxOnNuTLir9Qo7FVRzEI+QxFYm8infNoC7lvaNru6Ye72TiT+qhtAxpIJ/k8o+aCJjZWDquk gAJ/Kb/bfL+e7uPCJ7xL00D5QBugSIl5NGN/PwtwFxflgZRan45kuCvob6oKn/KWX8t7NYKbNtr4p V8NpvxdIqooGs3Hm1DYcg5q9hfoKSQv5b7Y48AjkeOil86JNzVIQdx7YX+XpqwujpwrCU2CocCa30 7vkChtVj6t5NoFr5fhVB+5UvGapU2vqx6CXrXgtTbrvzlNpH2yMuHxj2AOcWRLrd+XGsmZ35IMpFt dPUYXFfw==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1laC2u-00EsM4-Ri for linux-arm-kernel@lists.infradead.org; Sat, 24 Apr 2021 06:45:45 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id C56B56193A; Sat, 24 Apr 2021 06:45:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619246734; bh=IASdiN+9/AmiaDBWxGxldIhDXuTHq+MikfucyZPKlwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QGVXq0zEfEkZQuXyLnQNSlYiPuhq9yLF2nh/YSKCwzW17oE6HLAGe321i0gSkurNY +32Ae6lvlNPsCyMDg9bkXmFigFu+mytnPNfTpraZiKpB2fFpzGkpOTNvnp9CNGNdL4 cZyyU/Z+WWKgxmmFXOoafLtxOf6PqkqatrgYcmb1oh+axYc5AGW5WHV3NTCWobgiWY B/Xnx8gEkLknLgmmWJXtrhTkKWcLPVGvtUGxMvccVUVGRsheHeum4a8hyoTxYfRtMK htz7EuxlQWiIVLN2f8QU0V8jFkDjpum5M36HqMLz3JcdjSMO5/0YiwK+W13DsuImFG uBLtwOY2pqeVQ== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1laC2n-004Ji2-EV; Sat, 24 Apr 2021 08:45:33 +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 76/78] media: sun4i_v4l2: use pm_runtime_resume_and_get() Date: Sat, 24 Apr 2021 08:45:26 +0200 Message-Id: <19ff6114784154d1ce289b01bd22230a37b77a98.1619191723.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-20210423_234540_963525_55563CC2 X-CRM114-Status: GOOD ( 10.06 ) 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 Reported-by: kernel test robot --- drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 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..ed6ec41b9c2d 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) @@ -225,8 +225,7 @@ static int sun4i_csi_open(struct file *file) err_pipeline_pm_put: v4l2_pipeline_pm_put(&csi->vdev.entity); -err_pm_put: - pm_runtime_put(csi->dev); +err_unlock: mutex_unlock(&csi->lock); return ret;