From patchwork Wed May 5 09:41: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: 431948 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, 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 A75F6C433B4 for ; Wed, 5 May 2021 09:42:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67F7F6141F for ; Wed, 5 May 2021 09:42:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232388AbhEEJnQ (ORCPT ); Wed, 5 May 2021 05:43:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:48246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232109AbhEEJnQ (ORCPT ); Wed, 5 May 2021 05:43:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D7FEB613D6; Wed, 5 May 2021 09:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620207738; bh=mnwOoPbSt3peAjkyotn8X7kUrTzZPsSiyyacWXI13wM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bgfruVEEULYmgG8/EtzRxyrlkAlbXqpxHyLYWRYORK3lTHHwyE7wPJ96drcdorIc1 D4GndNvQT0xO0M8kqfe9fdMGZ13MftfEJ7aNDQXUnKYnhAxqwIEdivyt2LzNIvHgyG kHJIUUIyHL9ZZYkaxLrCB/jUI08u1rsRDK6zvm+J6e+8CUZoomYLuKMeHIxlOx4oa3 hj57c8Kq3+kCxjge4PuopSuXt+QDkKzP81q4VppzM+6p+GxklFiqhfK0P8dhMUHExH Ob4zfKSovQbjxrWNOnQ9cG8JpzDBcP0SS/LqlwzybnI4AsnfAwCYVx0qI5iYi3PNX7 cjyOBBv8BA+iw== Received: by mail.kernel.org with local (Exim 4.94) (envelope-from ) id 1leE2q-00AHw9-Sx; Wed, 05 May 2021 11:42:16 +0200 From: Mauro Carvalho Chehab Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Ezequiel Garcia , Hans Verkuil , Krzysztof Kozlowski , Mauro Carvalho Chehab , Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 07/25] media: exynos-gsc: don't resume at remove time Date: Wed, 5 May 2021 11:41: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-samsung-soc@vger.kernel.org Calling pm_runtime_get_sync() at driver's removal time is not needed, as this will resume PM runtime. Also, the PM runtime code at pm_runtime_disable() already calls it, if it detects the need. So, change the logic in order to disable PM runtime earlier. Reviewed-by: Sylwester Nawrocki Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/exynos-gsc/gsc-core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index 9f41c2e7097a..f49f3322f835 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1210,18 +1210,19 @@ static int gsc_remove(struct platform_device *pdev) struct gsc_dev *gsc = platform_get_drvdata(pdev); int i; - pm_runtime_get_sync(&pdev->dev); - gsc_unregister_m2m_device(gsc); v4l2_device_unregister(&gsc->v4l2_dev); vb2_dma_contig_clear_max_seg_size(&pdev->dev); - for (i = 0; i < gsc->num_clocks; i++) - clk_disable_unprepare(gsc->clock[i]); - pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); + if (!pm_runtime_status_suspended(&pdev->dev)) + for (i = 0; i < gsc->num_clocks; i++) + clk_disable_unprepare(gsc->clock[i]); + + pm_runtime_set_suspended(&pdev->dev); + dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0; }