Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp621150pxy; Wed, 28 Apr 2021 10:37:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlCRmupugS31tpuvpu+W9w61OUgOCt2dap9AvZIcQYPPZVnIDp2jvAvNiCxrz7BkriWzGH X-Received: by 2002:a17:906:9146:: with SMTP id y6mr17188483ejw.107.1619631380712; Wed, 28 Apr 2021 10:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619631380; cv=none; d=google.com; s=arc-20160816; b=tShqSNSvYK7V0S8PPpNpnjrutNBmGd6Gby2YL+RwCrJ0SF1xWUM4BdUBoKr8X87CkO iueDWiLNXviZLkeRuUzWjpDgIqze/oVD3rOp+JXy4QHqmR3knvlDMMnnow7+JCdYBIas apc0o/ejKUnkyhjE5avEbASui1omXiJtVRY3584MiktisPO3AqK5xkKGvcqKH8NcBl0q VoH+jjPM/Ug/WOUT8BINHjATXJ39sN9sEphtWYbEpsAJUFSZcxG6s9n20C6cGv4egepH pMlrOSaISMmajMhebKN4lv1TIBl+WUfakcFNlenwtO2TUKF1JqU/JIF3lrmSx3MdVn/0 w+5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=v3przhwyyYTM4b66P+6xK4slSmt7q3Bzh8+CFfScq3s=; b=O67xHeLB5chUDaj4eFbFPjG8gmCXWjxR9JHGNqHJz0rHb/x4gdE9T531v3wz7jk6YL 6soeYKxCVdDtepwpwpMoI6bISRkNKv++sVFdOtEmxfuXujDzyke48aXV/CE5Z+5MUhOz PU6OrezQygd0LqEpjPo73lX2F4HPdC0pwtJRpnhE0jlAfmfNpmy16R9LqtZB0DFcheAX TnvfoBgv9qVfDoHBeVUsdVztu2lZKMX1jOB7p965TGnYfZUKJbN1whot4vooczBD4Zxl vQoe04OLk7l6vGvxO3QQ/F8b6BZJWlOLc8HksUimWLjDXg4zlGJogsToUwNUy4LvSXg7 CcKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=U1YdbjGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h9si333757edv.218.2021.04.28.10.35.55; Wed, 28 Apr 2021 10:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=U1YdbjGp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238846AbhD1O5G (ORCPT + 99 others); Wed, 28 Apr 2021 10:57:06 -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) 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== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1lblYR-001DsX-BC; Wed, 28 Apr 2021 16:52:43 +0200 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: 8bit Sender: Mauro Carvalho Chehab To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. 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/platform/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 = false; /* Power up and upload firmware if necessary */ - ret = pm_runtime_get_sync(dev->dev); + ret = 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) ret = clk_prepare_enable(dev->clk_per); if (ret) - goto err_pm_get; + goto err_clk_enable; ret = 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: -- 2.30.2