From patchwork Tue Apr 27 10:25:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC854C43470 for ; Tue, 27 Apr 2021 10:27:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77A11613B0 for ; Tue, 27 Apr 2021 10:27:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235594AbhD0K2E (ORCPT ); Tue, 27 Apr 2021 06:28:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:48138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235435AbhD0K2C (ORCPT ); Tue, 27 Apr 2021 06:28:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 04262613C7; Tue, 27 Apr 2021 10:27:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=/e5UeIJiSAmhayjaD9UYfjSrnpizVQ2PnDpNxKl2/+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KkykQfPooUdW8MA0VwbO7dz14rqXn1dm5gOHEOLQDuawdcXjO5xbUgaP+Y8iOQLhV psz+0pguVumRSPLnBiZ67uXgvvVt310sGRRbHlWP+ctgzGkgDrQk1v1zwO6Q56cRGD eeRpgu6PJFTQSZsKbxzxDREwWzL4XF2fSXMzRTKr8qd5AftNMhHOVneQh2L6aag6jH cAckoUc83ZHnFUG61QCWJR788Urg6EEMDkc1AEARvq97cF1v2AL+zraQvR8juS9yH/ ukQIin8P3zAnAsRFJnGfJ9fbLIqfBmdvZFbTGsoRfQde7qGv/mayieWt99cRuaCY+L etRezsYsMlM+A== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvu-000nzG-Ro; Tue, 27 Apr 2021 12:27:10 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Hans Verkuil , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 01/79] media: venus: fix PM runtime logic at venus_sys_error_handler() Date: Tue, 27 Apr 2021 12:25:51 +0200 Message-Id: <6d463d21f0dd55c3d84db0458c7a5c4e0d7c5bc1.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The venus_sys_error_handler() assumes that pm_runtime was able to resume, as it does things like: while (pm_runtime_active(core->dev_dec) || pm_runtime_active(core->dev_enc)) msleep(10); Well, if, for whatever reason, this won't happen, the routine won't do what's expected. So, check for the returned error condition, warning if it returns an error. Fixes: af2c3834c8ca ("[media] media: venus: adding core part and helper functions") Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 54bac7ec14c5..c80c27c87ccc 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -84,7 +84,11 @@ static void venus_sys_error_handler(struct work_struct *work) container_of(work, struct venus_core, work.work); int ret = 0; - pm_runtime_get_sync(core->dev); + ret = pm_runtime_get_sync(core->dev); + if (WARN_ON(ret < 0)) { + pm_runtime_put_noidle(core->dev); + return; + } hfi_core_deinit(core, true); @@ -106,9 +110,13 @@ static void venus_sys_error_handler(struct work_struct *work) hfi_reinit(core); - pm_runtime_get_sync(core->dev); + ret = pm_runtime_get_sync(core->dev); + if (WARN_ON(ret < 0)) { + pm_runtime_put_noidle(core->dev); + return; + } - ret |= venus_boot(core); + ret = venus_boot(core); ret |= hfi_core_resume(core, true); enable_irq(core->irq); From patchwork Tue Apr 27 10:26:55 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: 428654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D41F2C43462 for ; Tue, 27 Apr 2021 10:28:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A4A87613B0 for ; Tue, 27 Apr 2021 10:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238248AbhD0K26 (ORCPT ); Tue, 27 Apr 2021 06:28:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:48270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237851AbhD0K22 (ORCPT ); Tue, 27 Apr 2021 06:28:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD4C161436; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519237; bh=wdynVwwhyvqKibF+xyVsNRL7Ix8YvvILE1Sgr+qtqMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ldzIh2yqsG2c3vamAmCi5eaUWrj0yShSgybGRILHpqFXuKxx7hwuYFC5Lasq8a4SZ ofKknVNKaWNfzxiHHrE1JJrJGxJaQ/onsmuK7t1ccVgt8Vf44KofqeFgMjzY8ByzNa KhKnKC0WQc5qVcIcYTkzhn6Z9pcdNeAzv1RFH0+p6CyB8CQbpKZjRaIUHT8xeNUzUR kSihDTnCJhDR6U5FPxlAMxpWAKwG/ro+yTknznfQ4von6k1AKatPD+lLvcmrXUy8pZ U4pmBiItP1s3+MV21dxpriatiKmd4ISADk3d1XJIK2pmQ5DR5QYjGaEFZrxXF7CGJR 07BiyWqL5U92Q== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2M-M1; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Robert Foss , Todor Tomov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 65/79] media: camss: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:55 +0200 Message-Id: <9eebf979608bdbd1780c226383bb084ff8041aa1.1619519080.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Reviewed-by: Robert Foss Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/camss/camss-csid.c | 6 ++---- drivers/media/platform/qcom/camss/camss-csiphy.c | 6 ++---- drivers/media/platform/qcom/camss/camss-ispif.c | 6 ++---- drivers/media/platform/qcom/camss/camss-vfe.c | 5 +++-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c index cc11fbfdae13..d2a7f2a64f26 100644 --- a/drivers/media/platform/qcom/camss/camss-csid.c +++ b/drivers/media/platform/qcom/camss/camss-csid.c @@ -156,11 +156,9 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) int ret; if (on) { - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) return ret; - } ret = regulator_enable(csid->vdda); if (ret < 0) { diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c index b3c3bf19e522..8e18b8e668cf 100644 --- a/drivers/media/platform/qcom/camss/camss-csiphy.c +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c @@ -197,11 +197,9 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on) if (on) { int ret; - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) return ret; - } ret = csiphy_set_clock_rates(csiphy); if (ret < 0) { diff --git a/drivers/media/platform/qcom/camss/camss-ispif.c b/drivers/media/platform/qcom/camss/camss-ispif.c index 37611c8861da..d9907742ba79 100644 --- a/drivers/media/platform/qcom/camss/camss-ispif.c +++ b/drivers/media/platform/qcom/camss/camss-ispif.c @@ -372,11 +372,9 @@ static int ispif_set_power(struct v4l2_subdev *sd, int on) goto exit; } - ret = pm_runtime_get_sync(dev); - if (ret < 0) { - pm_runtime_put_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret < 0) goto exit; - } ret = camss_enable_clocks(ispif->nclocks, ispif->clock, dev); if (ret < 0) { diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index 15695fd466c4..cf743e61f798 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -584,9 +584,9 @@ static int vfe_get(struct vfe_device *vfe) if (ret < 0) goto error_pm_domain; - ret = pm_runtime_get_sync(vfe->camss->dev); + ret = pm_runtime_resume_and_get(vfe->camss->dev); if (ret < 0) - goto error_pm_runtime_get; + goto error_domain_off; ret = vfe_set_clock_rates(vfe); if (ret < 0) @@ -620,6 +620,7 @@ static int vfe_get(struct vfe_device *vfe) error_pm_runtime_get: pm_runtime_put_sync(vfe->camss->dev); +error_domain_off: vfe->ops->pm_domain_off(vfe); error_pm_domain: From patchwork Tue Apr 27 10:26:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 427988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80A5BC43603 for ; Tue, 27 Apr 2021 10:28:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 526E6613B0 for ; Tue, 27 Apr 2021 10:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238237AbhD0K25 (ORCPT ); Tue, 27 Apr 2021 06:28:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:48260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235457AbhD0K22 (ORCPT ); Tue, 27 Apr 2021 06:28:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A448A61430; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=8E/41fS9i4G6Idc8E3ODBm45B0Q7is3E1XHHj0lw4IM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uzR0YITLqQMiwRM9ehaatpVhDOhoa6bkDISpYwYSs1GFAd87BAmkInT2oOpFwQi97 XUnS+klbWiDd9v4nupvdCm+n7fDw5PyR2TBpHy6/IQ6VwT+c8HuT2HcGUjhrjBbbcx 3gkkFdkXRalCXsc7Azrt8+XkZ0eOSLXhnB7NQFfBpQ1kdzcW+YCSnRygJmQG8AbsDb FMwxA5/0ygc/sSCODFONG93ZY+jyEM4w/A9ELdLkkgd3rRtoMsUCIOOr5iNhjerKpO wAKqhhmjol/CB+ZrtwavkV62rQZhXe90aakSLUREj965ISG/WPV55NyGaIJNymbmVf aooTxddpxozNA== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2P-OO; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 66/79] media: venus: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:56 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/core.c | 30 +++++++++---------- .../media/platform/qcom/venus/pm_helpers.c | 10 +++---- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index c80c27c87ccc..aa359f8e82c5 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -84,11 +84,9 @@ static void venus_sys_error_handler(struct work_struct *work) container_of(work, struct venus_core, work.work); int ret = 0; - ret = pm_runtime_get_sync(core->dev); - if (WARN_ON(ret < 0)) { - pm_runtime_put_noidle(core->dev); + ret = pm_runtime_resume_and_get(core->dev); + if (WARN_ON(ret < 0)) return; - } hfi_core_deinit(core, true); @@ -110,11 +108,9 @@ static void venus_sys_error_handler(struct work_struct *work) hfi_reinit(core); - ret = pm_runtime_get_sync(core->dev); - if (WARN_ON(ret < 0)) { - pm_runtime_put_noidle(core->dev); + ret = pm_runtime_resume_and_get(core->dev); + if (WARN_ON(ret < 0)) return; - } ret = venus_boot(core); ret |= hfi_core_resume(core, true); @@ -313,21 +309,21 @@ static int venus_probe(struct platform_device *pdev) pm_runtime_enable(dev); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) goto err_runtime_disable; ret = of_platform_populate(dev->of_node, NULL, NULL, dev); if (ret) - goto err_runtime_disable; + goto err_pm; ret = venus_firmware_init(core); if (ret) - goto err_runtime_disable; + goto err_pm; ret = venus_boot(core); if (ret) - goto err_runtime_disable; + goto err_pm; ret = hfi_core_resume(core, true); if (ret) @@ -359,8 +355,9 @@ static int venus_probe(struct platform_device *pdev) v4l2_device_unregister(&core->v4l2_dev); err_venus_shutdown: venus_shutdown(core); -err_runtime_disable: +err_pm: pm_runtime_put_noidle(dev); +err_runtime_disable: pm_runtime_set_suspended(dev); pm_runtime_disable(dev); hfi_destroy(core); @@ -379,7 +376,7 @@ static int venus_remove(struct platform_device *pdev) struct device *dev = core->dev; int ret; - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); WARN_ON(ret < 0); ret = hfi_core_deinit(core, true); @@ -390,7 +387,8 @@ static int venus_remove(struct platform_device *pdev) venus_firmware_deinit(core); - pm_runtime_put_sync(dev); + if (ret >= 0) + pm_runtime_put_sync(dev); pm_runtime_disable(dev); if (pm_ops->core_put) @@ -411,7 +409,7 @@ static void venus_core_shutdown(struct platform_device *pdev) { struct venus_core *core = platform_get_drvdata(pdev); - pm_runtime_get_sync(core->dev); + pm_runtime_resume_and_get(core->dev); venus_shutdown(core); venus_firmware_deinit(core); pm_runtime_put_sync(core->dev); diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c index c7e1ebec47ee..9e32ec866af7 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -486,7 +486,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) int ret; if (coreid_mask & VIDC_CORE_ID_1) { - ret = pm_runtime_get_sync(core->pmdomains[1]); + ret = pm_runtime_resume_and_get(core->pmdomains[1]); if (ret < 0) return ret; @@ -504,7 +504,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask) } if (coreid_mask & VIDC_CORE_ID_2) { - ret = pm_runtime_get_sync(core->pmdomains[2]); + ret = pm_runtime_resume_and_get(core->pmdomains[2]); if (ret < 0) return ret; @@ -990,11 +990,9 @@ static int core_power_v4(struct venus_core *core, int on) if (on == POWER_ON) { if (pmctrl) { - ret = pm_runtime_get_sync(pmctrl); - if (ret < 0) { - pm_runtime_put_noidle(pmctrl); + ret = pm_runtime_resume_and_get(pmctrl); + if (ret < 0) return ret; - } } ret = core_resets_reset(core); From patchwork Tue Apr 27 10:26:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 427989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74CBEC433B4 for ; Tue, 27 Apr 2021 10:27:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 501C4613C8 for ; Tue, 27 Apr 2021 10:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238093AbhD0K2j (ORCPT ); Tue, 27 Apr 2021 06:28:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:48172 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235372AbhD0K2P (ORCPT ); Tue, 27 Apr 2021 06:28:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A00306142D; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=73B6Lks3AupUDrJCPSyBZhCBhq2sPf760XjzihM5LGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fl9q1iE8eD01tbsHYEKRBJrPiuYXt3bYQA/8ySdxl389pDMPY+XfkkLCJNyMakTUH FVzL1mkUOipL3CgBo7DkEmqCzVlCvI4OB/2+6w1u9G3tvr21JGUMESS1Fy6mY6f1Rn GXHb16PBtHIUhiAuhasXCta12WJhvDME4nv0tz2yieLoiQn8sjhz8QVlIdBlmMfmFu JV3l23Ef3l7DEYI2CcWn5JjMGnWoIJ5/FvYOP2M78BPSZDtnCbGDGI4l1RvCVQO9LY vk22S0ah1EQCxe48r+LzsM8s+sKlaCAHWDTDuATsys9Pd54R7BlEhkeHUP92vESLXP 2MB+psIGAqjtw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2S-TO; Tue, 27 Apr 2021 12:27:14 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 67/79] media: venus: vdec: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:57 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/vdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index ddb7cd39424e..347e533ea673 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -568,7 +568,7 @@ static int vdec_pm_get(struct venus_inst *inst) int ret; mutex_lock(&core->pm_lock); - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); mutex_unlock(&core->pm_lock); return ret < 0 ? ret : 0; @@ -601,7 +601,7 @@ static int vdec_pm_get_put(struct venus_inst *inst) mutex_lock(&core->pm_lock); if (pm_runtime_suspended(dev)) { - ret = pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); if (ret < 0) goto error; From patchwork Tue Apr 27 10:26:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 428655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B551CC43460 for ; Tue, 27 Apr 2021 10:28:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8DE93613C6 for ; Tue, 27 Apr 2021 10:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238105AbhD0K2n (ORCPT ); Tue, 27 Apr 2021 06:28:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:48288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237270AbhD0K2T (ORCPT ); Tue, 27 Apr 2021 06:28:19 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A2676142A; Tue, 27 Apr 2021 10:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619519236; bh=phIvrsjCST0hqKSIzsjBL4/Aigr4NLUZL7GWQhPHYlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pAB0gi60sdZ9uYUw3agDuR9ReaHY+Z7UzbIXDbL2xV9MXGbg6lcJzDK7yQbtRT8tz AETzY51R4DOm2qb5wHrqf8qTnDen3mBfPHoGPhdQSe7VfRtwOZpDi9H1n3MdKyHC0F lbqsFUmuFWmR5oDnRXXCyRQswjJp08X4HB/p/cnMZwSSqHCofsfd6+OnP1zNAf2zhR g3xZtqfOXc61u2q6KL47/h0POI8SR/CgbvDoC+SRiCwg9MPBPlB8fDmYK5ZWA3LdJi h8hiYOLRPEZ97SaBJdy2UfeaqJfbE6vdPxBuVvwvsIQ6v4qN+EOQghS2gNQ+Iy5UjV dkmQC2Utz3bMw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKvy-000o2V-WA; Tue, 27 Apr 2021 12:27:15 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Andy Gross , Bjorn Andersson , Mauro Carvalho Chehab , Stanimir Varbanov , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v3 68/79] media: venus: venc: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:26:58 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") added pm_runtime_resume_and_get() in order to automatically handle dev->power.usage_count decrement on errors. Use the new API, in order to cleanup the error check logic. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/qcom/venus/venc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 4a7291f934b6..8dd49d4f124c 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1205,9 +1205,9 @@ static int venc_open(struct file *file) venus_helper_init_instance(inst); - ret = pm_runtime_get_sync(core->dev_enc); + ret = pm_runtime_resume_and_get(core->dev_enc); if (ret < 0) - goto err_put_sync; + goto err_free; ret = venc_ctrl_init(inst); if (ret) @@ -1252,6 +1252,7 @@ static int venc_open(struct file *file) venc_ctrl_deinit(inst); err_put_sync: pm_runtime_put_sync(core->dev_enc); +err_free: kfree(inst); return ret; }