From patchwork Tue Apr 30 12:04:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liming Sun X-Patchwork-Id: 1929462 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VTJmn6Nn6z1ydT for ; Tue, 30 Apr 2024 22:05:29 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1s1mEd-0007LO-4y; Tue, 30 Apr 2024 12:05:23 +0000 Received: from mail-bn8nam12on2056.outbound.protection.outlook.com ([40.107.237.56] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1s1mEY-0007Ji-1v for kernel-team@lists.ubuntu.com; Tue, 30 Apr 2024 12:05:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DJ2Qbbyr/MfAtXzcON8Uy6JPtFssIlfbHxJ1jlUCRkMSfiiEGeATMupC9rEcr7WYcikA1Md0nB1l35oxL/2N1swlRn6P3JSdFyGuCxLBXHhTWidXzexVXXFin1NX/8trC/iEy6VLJDD9V1ZAfftPNgiGN+eKRjI7CYcdeygK8WUjCZSMkjIXeS8Ad6DTws1HEJXxLF0oGX10rocLY9G2rqJT+YkcNE/7pR7SnQJkxQ9B3dwvoOy/JC31viZ2x1dCnUbeL1ra0KweF+BgYkhHpmr2PVl5GWOUGvVkgvgUoS7lWFskWd3gNMu/uM+TM6GDwdiaIBmCN7qn7Fx0PTRcbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Cm3/1qxdX9iBssjTFx64J+OAYdLCGzfdYf9MyuLZJLw=; b=AugWmhBeBHvQbqc/FbBA9KQ2ujATuUZf5snCYJgfgbbgN+HX5hmF/cnCAKaEXkpgZhquBRaUkz9ikJOBuY6z5uYtT6EdbvI//ZeWIc8h12J8Meiufybl1pY/lfNbKmfqv/2mpycnlipj2lqoKua96cGZeMEwHFNhhQl0hUU4ZzieRioB9YGBJs4sRyWb+Xx2iMvpG/tMKdmsxK1S6tL9Ve2uGynGCDBefy473kjQBjedF1Ie1LtQrwa42eNMDEqg6/umNrDTVPS2eSH0PjgmTJih8AGMtECThS+s9gI7cmz6PyPBbRijjvaoH/nTXJHzaGIe5UeqGtM8gPjG9zP88g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=lists.ubuntu.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) Received: from SN7PR04CA0180.namprd04.prod.outlook.com (2603:10b6:806:125::35) by BY5PR12MB4292.namprd12.prod.outlook.com (2603:10b6:a03:212::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Tue, 30 Apr 2024 12:05:14 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:806:125:cafe::fc) by SN7PR04CA0180.outlook.office365.com (2603:10b6:806:125::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.36 via Frontend Transport; Tue, 30 Apr 2024 12:05:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Tue, 30 Apr 2024 12:05:13 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 30 Apr 2024 05:04:56 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 30 Apr 2024 05:04:56 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 30 Apr 2024 05:04:56 -0700 From: Liming Sun To: Subject: [PATCH v1 1/1] [SRU][J:linux-bluefield] sdhci-of-dwcmshc: disable PM runtime in dwcmshc_remove() Date: Tue, 30 Apr 2024 08:04:54 -0400 Message-ID: <3161db6c068d48f3db1411375f1cfec87ce0dcd8.1714478067.git.limings@nvidia.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636C:EE_|BY5PR12MB4292:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c42c231-ba23-4d48-0234-08dc690dcafb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|82310400014|1800799015; X-Microsoft-Antispam-Message-Info: UDO1RStMIU7ZyxFdbq+JAkSaGd8fA3RrKrm9gb/kLnNv0LRYZ6XkkgYmnQVgiBUusMsf87/TZjcVtlOOxDhOCsqI+m8TD6C2tpIWZmPjK9rpQxqb8gB/JYDW0n0WbcURhuRN6sUgcmPSMRFUnGRI4hLUfiBbZteUog+UXCNkwY+FNovvU8HnOrdsDzWUj7bC67S8Ji0cEd8kSGKmETgWfa0QgNFO/KrC1QU+agU98JdVFYgbrZLFl2pOQFp3yfbnc0LUeggA1biyZ++NFals5ncpuW34/hAwxGU+Pf8B+p8DD3yBsTLXfR2dzLadQ7S3oPo6HGSpbykYeSPcGehmxlXZASSr1ImQRAkASrYQiFj3A3346npOWSc+Qgzb90j9Jy4qoaK1GSstRwSXgeF0nSMluhKmM4hk57NZEYmpMDX4009t8Vw08FB0WbiZfcJNw2kx8TxbvnD/B2srxHr6pgV4I938pIyo5gEmZ/wyVsGhSYea62A0ZYBlpFgVeOmHvnR7tzFiNLqwwXq7LGlAaJ6gbhlK3+ewN4lhB2QMYjva7yosGGxh9DbLgAUFNl20HO3U5miHtypxwdimETEHaLoeujwyJ8jBUaSyo2D7mk9uOxA/P5gT5uGKFhyqOObwFfpSUl4gJfW1LWft6MRIjZCJU7cCJsIBy5iWm4w/JJL2dgzSmLWfRoKLSv54a+n5GcOGB8j5CilxdUS3JWLauUI8L+Y9WokVQQ0xjdfgAZZuoVkALmDZ6Ukxrjg9Gu8rw0xDALOWLVAZd+WOWj3y3YKubAyN4NGASwJXKSacrpOISz3LKdbAzbctKf99Nn8Q2UdJ15Suy2o5KXg8EwAwIPxlf8+x3fns8Gv691NLlpejRdevPtK39iiMVIkTy87uIF0rwRjC5BOZ58oq3qzUE0hJtMCIssOBb7QqQrCDFmgsw0I5AkYFPraM83YJ4eMbAW9ROZiaLoWxmgBstF5ckxTaudN3br0uXhw5Vdpup78k58zgbNMzzkDUhZWBQ+uUElkmajGpI8pOVw6QdakRR2RZAqkTUvKxEXntR+rP7vYwMdCrmdatyFNfidwdHVoCYKeJmQ7LWJtBJCgR2yyAwzX0NWBINkLWfDAz3Zlsp9FixdJZ37UUotaBwbAem49n9moVm4TiD/OsD4d2gqGPVUWAdmgnQLd9y28mkY0jJRjxBnadkMUA8b3IIIKkTJEl7JGojiFHwAR0zKU+YKxRQEdZvkmQtpOnJ7Oa44zV/t2WZ8e7XcI5n8Ep7HaQAxLheH+upoXoNe/K1Z7BSG2+a85QHuKFw1d101oArTNk21z9dKUahM006MnaFq01DagTUnMQx45UMuE6P7Zo0oqRnFcgawntzxOzqsHINQOEMKvvUY25Tmcw+vdOiRePaPJN X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(36860700004)(82310400014)(1800799015); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2024 12:05:13.9456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c42c231-ba23-4d48-0234-08dc690dcafb X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.118.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4292 Received-SPF: softfail client-ip=40.107.237.56; envelope-from=limings@nvidia.com; helo=NAM12-BN8-obe.outbound.protection.outlook.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/2064184 This commit disables PM runtime in dwcmshc_remove() to avoid the error message below when reloading the sdhci-of-dwcmshc.ko sdhci-dwcmshc MLNXBF30:00: Unbalanced pm_runtime_enable! Fixes: 6512beaf58e9 ("mmc: sdhci-of-dwcmshc: Add runtime PM operations") Reviewed-by: David Thompson Signed-off-by: Liming Sun Acked-by: Adrian Hunter Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/b9155963ffb12d18375002bf9ac9a3f98b727fc8.1710854108.git.limings@nvidia.com Signed-off-by: Ulf Hansson (cherry picked from commit 03749309909935070253accab314288d332a204d) --- drivers/mmc/host/sdhci-of-dwcmshc.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c index 689a297c10ca..4d19d4ec01f8 100644 --- a/drivers/mmc/host/sdhci-of-dwcmshc.c +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c @@ -495,6 +495,17 @@ static int dwcmshc_probe(struct platform_device *pdev) return err; } +static void dwcmshc_disable_card_clk(struct sdhci_host *host) +{ + u16 ctrl; + + ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + if (ctrl & SDHCI_CLOCK_CARD_EN) { + ctrl &= ~SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); + } +} + static int dwcmshc_remove(struct platform_device *pdev) { struct sdhci_host *host = platform_get_drvdata(pdev); @@ -502,8 +513,14 @@ static int dwcmshc_remove(struct platform_device *pdev) struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); struct rk35xx_priv *rk_priv = priv->priv; + pm_runtime_get_sync(&pdev->dev); + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + sdhci_remove_host(host, 0); + dwcmshc_disable_card_clk(host); + clk_disable_unprepare(pltfm_host->clk); clk_disable_unprepare(priv->bus_clk); if (rk_priv) @@ -597,17 +614,6 @@ static void dwcmshc_enable_card_clk(struct sdhci_host *host) } } -static void dwcmshc_disable_card_clk(struct sdhci_host *host) -{ - u16 ctrl; - - ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); - if (ctrl & SDHCI_CLOCK_CARD_EN) { - ctrl &= ~SDHCI_CLOCK_CARD_EN; - sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); - } -} - static int dwcmshc_runtime_suspend(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev);