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: 12239555 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=-17.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 A0779C433B4 for ; Wed, 5 May 2021 09:46:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D9ED613EC for ; Wed, 5 May 2021 09:46:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D9ED613EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CMhBpKHzcFpHd5kcbffGdI0iMBSHt0DN5L0l1DUmQQo=; b=QGzDtbCDkJ8GKShpQsfLiAYMJ HLQFX6Xd256iT1WIjpWRrneBVAAuwWCqRM4PbgiPFpXZvuVKzrf6ddPrPt/mw2dkrG7u5sHfD7tKC Z/vEidsaoo32uqV5WH7K3rgdSXPYcWXBKmlhLQ/3AeCYHmc861wQ/DfaNmIwM/o+eHs4OgdsKMFU1 oM5DfVe4qZGFL78STB8x0ezFAJr2ri9NHzw4fOAGk5xZw/eumfrMwVX1uybu60l6+KWcsXCupaMjU UGiixmfZQ9p8ozEvNQYxkFce3KBUxZGAQLOL5BiJ/nxwkWk8MOhc/K1eicvcY1cYqlB+GTLHGJJAD +rNGAz+eA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leE36-000l5w-8c; Wed, 05 May 2021 09:42:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leE2w-000l3o-Kk for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 09:42:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=OI77eR4nGyZxIXpCKbXz8jMtKZLMEeKKY17oeWDLdic=; b=IM+YqYsvRDTZkGTQTbUL11nFjU w+TAmENx5ksk1Ua3ZlMIUFc1ImrDS3AJml0/pQRhgp21v7asp8OMN9w30afDqxGhAT4IDJA64dAhf NSmYd2a9YP23SM9cUXS02C/k4Q2myNkowGPBrrfZP60VWLw/Pyq5/pLo4SpjRx5QXbFModHf/EuL4 +03BS+f10Mpj4zqNVtxNVLgcGvXaiVkMbH61Ly1vym/i9R6HaQNf21YMvAzNcKi7njz/MMCGnyi70 UEuLDQeOL7F+NA+nSBHvRg4IHgF9WiOs6xO+qbZBLWa+reZVjfFL7eV6WFavjIjqfvocely+R7dqB WuP2EmYA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leE2u-004ccu-4I for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 09:42:21 +0000 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 To: 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_024220_222955_9E4A8428 X-CRM114-Status: GOOD ( 12.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 Reviewed-by: Jonathan Cameron --- 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; }