From nobody Sat May 10 05:48:31 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=1619621800; cv=none; d=zohomail.com; s=zohoarc; b=mlNmtiBCNxrYVAUrtGmkdTdt6NwP7C0z/mxbwZPjmRvzrVNLbY3OtTPg1xc5b4UEyndjAmGm1bx5jh46xLx81FqqOYJD/4ZAlRYQ0yU5wPkIRTufTvevpwdqYpw12E7/T1x0PUYBYhids58OuLbL00ILDYR2H0UXPPRrlbglysE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619621800; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Sender:Subject:To; bh=v3przhwyyYTM4b66P+6xK4slSmt7q3Bzh8+CFfScq3s=; b=PaNedu72ChoSmwJZrCbJkkDdGfO5qmlgw9NclsDtJqdPiMngNQbn1b8QiWVutbbSU3a/eH+Rp+tXJhUo/NEDUbqJEBZnmh3cxBTFaQ37dUZeJkaVUYMSjAsIiJZ758+Dgk17zYF+eiZI2dXIiO6lq46NuUwKub0gFT3C2QJUGjY= 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 1619621800673503.2082682657374; Wed, 28 Apr 2021 07:56:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbhD1O5X (ORCPT ); Wed, 28 Apr 2021 10:57:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:36992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240382AbhD1Oxr (ORCPT ); Wed, 28 Apr 2021 10:53:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A9E0461939; Wed, 28 Apr 2021 14:52:44 +0000 (UTC) Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001DsX-BC; Wed, 28 Apr 2021 16:52:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619621564; bh=VccqcJ215VR7UKWGbWUF3AZ/5qIK/dKNloYRA4F/kE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U1YdbjGpnSCY689ALodX4Fn5kq2d5nBFmU4K5TNhFRPKPOXkk/7a5SUW0UZf94ws9 4qejsSGUcxZ20rUT27zhgkJl859UctqEURfehDkHS22GzCJD9pV7XWTPh3yiPae6NZ 5tNYsydzXW2Ry/9SA9Ro9r5Ae/NI0t/J36+f2Cn+9cYym6LTAB6fsvpz2ZbAa7lKen YYgVlmBcC3p9LbfMLlexJWhIaielSz88G0E6U4l8U6Rt4oXKc5rR+2YdDY5BU838L2 5rZMymGMRgCdJ6sECoaYRErCJ/fU7lOaGOSM7uIK3dUI271kDSTWBt7aLhVME9baEP vj1g4do2cnI3g== From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Mauro Carvalho Chehab , Philipp Zabel , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v4 61/79] media: coda: use pm_runtime_resume_and_get() Date: Wed, 28 Apr 2021 16:52:22 +0200 Message-Id: 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. While here, as noted by Phillip, the labels at the coda_open() function are currently named after what operation failed, instead of what they do in response. So, change the name of the error label that it is called when clk_enable fails, in order to be consistent. Reviewed-by: Philipp Zabel Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/coda/coda-common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/plat= form/coda/coda-common.c index bd666c858fa1..2017de85713e 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c @@ -2660,7 +2660,7 @@ static int coda_open(struct file *file) ctx->use_vdoa =3D false; =20 /* Power up and upload firmware if necessary */ - ret =3D pm_runtime_get_sync(dev->dev); + ret =3D pm_runtime_resume_and_get(dev->dev); if (ret < 0) { v4l2_err(&dev->v4l2_dev, "failed to power up: %d\n", ret); goto err_pm_get; @@ -2668,7 +2668,7 @@ static int coda_open(struct file *file) =20 ret =3D clk_prepare_enable(dev->clk_per); if (ret) - goto err_pm_get; + goto err_clk_enable; =20 ret =3D clk_prepare_enable(dev->clk_ahb); if (ret) @@ -2707,8 +2707,9 @@ static int coda_open(struct file *file) clk_disable_unprepare(dev->clk_ahb); err_clk_ahb: clk_disable_unprepare(dev->clk_per); +err_clk_enable: + pm_runtime_put_sync(dev->dev); err_pm_get: - pm_runtime_put_sync(dev->dev); v4l2_fh_del(&ctx->fh); v4l2_fh_exit(&ctx->fh); err_coda_name_init: --=20 2.30.2