From nobody Sat May 10 06:06:17 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1619518759; cv=none; d=zohomail.com; s=zohoarc; b=HM/70B6zh+JSpVpyzZiLJzsenzT09MP2EQ+2SLzTk++138gOjf6AEHf3x/Mcrj4M+3zeWDEotoBTeSXw9GD6gck7EcMFgscFSfq3A9o41EcU0x8DvEGlAXL7FdpDo8RFf9ha3GZxhrQvhK3C53JIVnRf00LFQp62nYWyZIFZDz8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619518759; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Sender:Subject:To; bh=12KRzueB6SAQP7as6alJYowk/8pupz0I32OophPzn48=; b=eKOJS5m31oFHrNiMza+CC1KFHGDY66pPZSh+vXFk9hoNTirw1afHKbEma2mGtSA+fx+d2BY1FqgejQjJajboriGE5GCNBtE+dLAEvEz27plxbromozs78sKV5TRQyr+oKkC5ROdvAChVhROHHEYfjGqTGGCfMxQ9A+nD10xxveg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1619518759418285.12988944153847; Tue, 27 Apr 2021 03:19:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238070AbhD0KUA (ORCPT ); Tue, 27 Apr 2021 06:20:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:34882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235902AbhD0KPN (ORCPT ); Tue, 27 Apr 2021 06:15:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0F7DB613D0; Tue, 27 Apr 2021 10:13:54 +0000 (UTC) Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lbKj2-000j8G-7K; Tue, 27 Apr 2021 12:13:52 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619518434; bh=DzFwWWrx/K8GcHK3QK7SiLSCre5vWmnzlplRbKVIaVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q8TJHIsbaNWApzLqgfcugc0VY3GqjYdzUZ4USSsroHuzRu8QIiZR2qbWwi2bla1dM 7aZKjfDEBqVGrwlIg9WXPkKBxuU5a0ytzhq50QZr/7ztuXN+GTgJiaGZJrzLHMOTw1 bynBEbJKAPhQ4qt0Wd1UBeglqlZgaGLXjGbgIlKhnRUNol/zEUy5pHUjdh2OVmwAaL 2hTxjqym27NlHZsLLcHc9acUkcpFQ4sAZqdpxswbsgsvLfW2K9xUkBOPjoOSKBkfBp PHSx0JAD1qkKc+zQfwug04LfdI1tRRy+iEP1C07LfEigoVOwx+fBX/MFcQgn6MAuKk Og2ntl/CXDtzg== From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Benoit Parrot , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 76/79] media: ti-vpe: use pm_runtime_resume_and_get() Date: Tue, 27 Apr 2021 12:13:43 +0200 Message-Id: <20ed950fd07ce95883a1ab00095c70810c7b800d.1619518193.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal wi= th 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/ti-vpe/cal-video.c | 4 +++- drivers/media/platform/ti-vpe/cal.c | 8 +++++--- drivers/media/platform/ti-vpe/vpe.c | 4 +--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/ti-vpe/cal-video.c b/drivers/media/plat= form/ti-vpe/cal-video.c index 7b7436a355ee..15fb5360cf13 100644 --- a/drivers/media/platform/ti-vpe/cal-video.c +++ b/drivers/media/platform/ti-vpe/cal-video.c @@ -700,7 +700,9 @@ static int cal_start_streaming(struct vb2_queue *vq, un= signed int count) =20 addr =3D vb2_dma_contig_plane_dma_addr(&buf->vb.vb2_buf, 0); =20 - pm_runtime_get_sync(ctx->cal->dev); + ret =3D pm_runtime_resume_and_get(ctx->cal->dev); + if (ret < 0) + goto error_pipeline; =20 cal_ctx_set_dma_addr(ctx, addr); cal_ctx_start(ctx); diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/t= i-vpe/cal.c index 2e2bef91b2b0..76fe7a8b33f6 100644 --- a/drivers/media/platform/ti-vpe/cal.c +++ b/drivers/media/platform/ti-vpe/cal.c @@ -1024,7 +1024,7 @@ static int cal_probe(struct platform_device *pdev) =20 /* Read the revision and hardware info to verify hardware access. */ pm_runtime_enable(&pdev->dev); - ret =3D pm_runtime_get_sync(&pdev->dev); + ret =3D pm_runtime_resume_and_get(&pdev->dev); if (ret) goto error_pm_runtime; =20 @@ -1098,10 +1098,11 @@ static int cal_remove(struct platform_device *pdev) { struct cal_dev *cal =3D platform_get_drvdata(pdev); unsigned int i; + int ret; =20 cal_dbg(1, cal, "Removing %s\n", CAL_MODULE_NAME); =20 - pm_runtime_get_sync(&pdev->dev); + ret =3D pm_runtime_resume_and_get(&pdev->dev); =20 cal_media_unregister(cal); =20 @@ -1115,7 +1116,8 @@ static int cal_remove(struct platform_device *pdev) for (i =3D 0; i < cal->data->num_csi2_phy; i++) cal_camerarx_destroy(cal->phy[i]); =20 - pm_runtime_put_sync(&pdev->dev); + if (ret >=3D 0) + pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); =20 return 0; diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/t= i-vpe/vpe.c index 10251b787674..07cb2c140295 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -2471,10 +2471,8 @@ static int vpe_runtime_get(struct platform_device *p= dev) =20 dev_dbg(&pdev->dev, "vpe_runtime_get\n"); =20 - r =3D pm_runtime_get_sync(&pdev->dev); + r =3D pm_runtime_resume_and_get(&pdev->dev); WARN_ON(r < 0); - if (r) - pm_runtime_put_noidle(&pdev->dev); return r < 0 ? r : 0; } =20 --=20 2.30.2