From patchwork Thu May 6 15:25: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: 432344 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 1DAC6C433ED for ; Thu, 6 May 2021 15:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCA4361932 for ; Thu, 6 May 2021 15:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235600AbhEFP2E (ORCPT ); Thu, 6 May 2021 11:28:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:40902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235456AbhEFP1n (ORCPT ); Thu, 6 May 2021 11:27:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AF60561948; Thu, 6 May 2021 15:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620314783; bh=FLSzvr6zLm66TJO9Ug0iF1ElODOaUmJVWjZme1bPQlE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LdRFCjh8bCOtEM2j3min+9VewLxm4k0Q5j88UwApnqYWTnVdSaxwWFyksEoXGXLbJ LoCCeH5sC7JhiD/q+TeWKEQdUGg8qmski/FejpctdKxzEWYQ8cVroQJbBhilixh5+k dPnzpSd+0DRQQS/AH29BkZLw8lA32PJHADI33qaEkK8qepjrhJWU1JYzeXHgI5Yc1w KAMgZhcMvKX6C7YtuMukTPuv32ZCakpW4mO8/DW5z/X0kCNC21q2wOJX40Pid1HbX4 gnS0i2x1IMJJh7dNFPy6XbpGEYyPiI1xhnUwRa9WDO0A2oryAz8LtEm4KL9hKeA7I5 aPRNALMxUZmSw== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1left8-000SCJ-A4; Thu, 06 May 2021 17:26:06 +0200 From: Mauro Carvalho Chehab 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 v5 20/25] media: stm32: use pm_runtime_resume_and_get() Date: Thu, 6 May 2021 17:25:58 +0200 Message-Id: <27d9d61e55a133f811550578b4c9738b806ce491.1620314616.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-media@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/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 d9b4ad0abf0c..b33c6e7ae0a1 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_unlocked; } 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_unlocked: spin_lock_irq(&dcmi->irqlock); /* * Return all buffers to vb2 in QUEUED state.