From patchwork Fri Aug 11 13:03:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 134521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1117808vqi; Fri, 11 Aug 2023 07:03:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrkUQu2REh6hCEw3U3yESRh8I+EjNtTmPEm/0g72Ba/3fac4qAes0L6cHiMTc9EhayY2a9 X-Received: by 2002:a17:90a:fb4c:b0:268:5bca:3bdf with SMTP id iq12-20020a17090afb4c00b002685bca3bdfmr1415845pjb.40.1691762630847; Fri, 11 Aug 2023 07:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691762630; cv=none; d=google.com; s=arc-20160816; b=a9BlESnsG6Op4SfUb7yokNe5A1d+jqlzi0pEZfn3ByyVTTTuFrReR5bm3h/L/SEim9 8uK5Q6x3YvVfPeRO9+uaQGo9JxnX2LsUMgUkGKHvrmgNSMm2XKVSdbQQ8U8K8E7v8mHb ykWPLezSp/kVWbZPGYqSbbMSnvC0DgJGeSEym74n3b29gUEJrfikqRBJdfsu7cVTDSod 4agow7HeBPeIpniHyyJpSNhJO5O8q2IuRe9Pn8yAJCoqJx+I7z4EnvHO86SPy12nNRd/ Lx2DbuD44gOtLtNBuYADpgo4KKq31gL2o6hpBJ6TPnoD7JkcFKSTVTcDOih+YQcwED+P YAQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WHCtoGVhUI4wRIeUTNhVIg8lpspDqbfjosQEpIrTyV4=; fh=1illQt2rvZm/duIamif60BE+Ziytl52XIUdvA193/Ac=; b=Q7SBmh1+7MZBDDzux6Vj6gt1r3eeeS9RFAvA3ck9NwoG4K94T3fNm6m5Vv9/u0NRbf h9ujsjzKkdIEqangnVPj6FDN6q4pwUUR4KSa5jZgZsfFhbiLk1v1jN+EOAi4S5clzcBX FGLWvq8gqguqVm3cy2bISbvXwqxDRrz40rn34z/vsnW8TSQzUs4BstMuXaLXDulsC666 WVUGUikspMnfOTe3hUj2/F98LNZtrCTYtUUe4/sX7ipG53cS+ANcSf6LVp5TxPqZYw31 Ewon45Cf26BqtsQo8n/F8XBtc54i0RLcaspzO/luBtMZTWwTTLYHvrSRQu3pt3V3sGtk bXCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B+WXmtZp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a17090aa40c00b0026b2602b969si1133190pjp.43.2023.08.11.07.03.31; Fri, 11 Aug 2023 07:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B+WXmtZp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbjHKNFi (ORCPT + 99 others); Fri, 11 Aug 2023 09:05:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236627AbjHKNE7 (ORCPT ); Fri, 11 Aug 2023 09:04:59 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C12513A8C; Fri, 11 Aug 2023 06:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691759088; x=1723295088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=og6p3BQnbXUst3nN/+/nya1jNf4kelt5VwqtGADhToQ=; b=B+WXmtZpumRqzgcI6HZpcyMUgJRY3O6Hslh+o6FQ3i7HcFw1dHVeeDjL POe5KwrwTfi6EvC5KWQffTw0LB874PhtevxqF5ZGT6KN2kfGEJ7ojHLTh DU36Juvww4dj+Ma9x+emgoBIz3Q/1ZFTmJiW+2L6E6X747cmZrKgvvbV5 ysPvHkQMRSao3Pnwda3yWQtmNT3Phh3iKYkoGO7ArdUK9kAw+6gnzF1LT ZZXOJYKsLZnVRRzqqLdg9B810VbEefRRcuHUO6cv8qkwXK/y1Lv7gMU3n FwcgggfO3zagmG/rzMYmvcjqI/Ff2sEEqN+Izt1EBBTInvxq9kEbixfMW A==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="361811799" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361811799" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 06:04:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="709535218" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="709535218" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.51.13]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2023 06:04:38 -0700 From: Adrian Hunter To: Ulf Hansson , Andy Shevchenko , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Yangtao Li Cc: Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Kamal Dasu , Al Cooper , Michal Simek , Eugen Hristev , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Lars Povlsen , Steen Hegelund , Daniel Machon , UNGLinuxDriver@microchip.com, Patrice Chotard , Brian Norris , Ye Xingchen , Brad Larson , Christophe JAILLET , Sai Krishna Potthuri , Swati Agarwal , Andy Tang , Georgii Kruglov , Jiapeng Chong , Doug Brown , Li Zetao , Kunihiko Hayashi , Jassi Brar , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 04/16] mmc: sdhci-cadence: Use sdhci_pltfm_remove() Date: Fri, 11 Aug 2023 16:03:39 +0300 Message-Id: <20230811130351.7038-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230811130351.7038-1-adrian.hunter@intel.com> References: <20230811130351.7038-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773941692396310323 X-GMAIL-MSGID: 1773941692396310323 Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that devm_clk_get_enabled() can be used for pltfm_host->clk. This has the side effect that the order of operations on the error path and remove path is not the same as it was before, but should be safe nevertheless. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci-cadence.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 8cdc178ec1ba..be1505e8c536 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -487,14 +487,10 @@ static int sdhci_cdns_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; static const u16 version = SDHCI_SPEC_400 << SDHCI_SPEC_VER_SHIFT; - clk = devm_clk_get(dev, NULL); + clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(clk)) return PTR_ERR(clk); - ret = clk_prepare_enable(clk); - if (ret) - return ret; - data = of_device_get_match_data(dev); if (!data) data = &sdhci_cdns_drv_data; @@ -502,10 +498,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev) nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node); host = sdhci_pltfm_init(pdev, &data->pltfm_data, struct_size(priv, phy_params, nr_phy_params)); - if (IS_ERR(host)) { - ret = PTR_ERR(host); - goto disable_clk; - } + if (IS_ERR(host)) + return PTR_ERR(host); pltfm_host = sdhci_priv(host); pltfm_host->clk = clk; @@ -556,9 +550,6 @@ static int sdhci_cdns_probe(struct platform_device *pdev) return 0; free: sdhci_pltfm_free(pdev); -disable_clk: - clk_disable_unprepare(clk); - return ret; } @@ -617,7 +608,7 @@ static struct platform_driver sdhci_cdns_driver = { .of_match_table = sdhci_cdns_match, }, .probe = sdhci_cdns_probe, - .remove_new = sdhci_pltfm_unregister, + .remove_new = sdhci_pltfm_remove, }; module_platform_driver(sdhci_cdns_driver);