From patchwork Fri Aug 11 13:03:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 134549 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1160181vqi; Fri, 11 Aug 2023 08:06:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfiMnh3bk4dh/6GZNG7d+L9GG1KjKTZ7gELjhaGbFdq8G0up1BzGdOQqoS+fENUlLrW8gn X-Received: by 2002:a17:902:6b4b:b0:1b6:80f0:d969 with SMTP id g11-20020a1709026b4b00b001b680f0d969mr1835862plt.11.1691766383068; Fri, 11 Aug 2023 08:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691766383; cv=none; d=google.com; s=arc-20160816; b=NAL0OiZ4L3A+ghIW4EO/dWVi+kWjNoAlKAyXde47xUx/ixSYyeLJ3QD9UeBIZT1rjC IjkHWcMZKp71PHyHaAgiyl+7tEllnOGkrMm2ABOxiFAbWVJlse5Mi/0Qxo8u6dDl9sCh k/Kmysktmcb9fjUzyBa4Ffx6PabHrMIf6o/457c9G6f6sBWcaj12RNAGH4WcbTaZclUc liG3Goms8Fy4wHn+K+QTOWra/JgKxQp21bLPdPP5SV/LOxXYtK/tUsX3iwoi/IAH8ZZQ dd7XWuoIXaG1jyzUMqEjLH8wY9lp5YOcJf5UwX7uH7HylN1BPUJYhDUzytXkMtuKVJKb Fpqw== 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=KutRWmbYupaB46WSiRXPfVebMqevVbQdE0jIGHdEPN4=; fh=1illQt2rvZm/duIamif60BE+Ziytl52XIUdvA193/Ac=; b=oH6dpRKkqtKabx+vVekIvk/Qd4jD6x65OcYzo+hvqhujL8ny9XdukIsF3P9Dx1ZGuE q5I6RSy7whzRwjWIYsYLOlhQjuy+zkXnAiSYB21oZMRsc9EmOL0StKAHblBWHh1GZAyy TWc/WM/Ufksj6Z++iSYYySIwpSVjvgP9Hq+VQhy+tr2HUCr57oh4KJ2SlBUIWKUMO2uv h2O+H+nbnNxCEeH22vej2o02tMnqVQMcSC1EzfkUODT+b+jKLF/WySeDg/PJyK2HWSa5 PGNurxpAQNHplSdFgbFyOV5tnM7B29+1Ftcvxz2mtaZTF5uJ+wMf9oENAAPUtEeta0Ek LLpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ieuY2SYn; 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 q15-20020a170902dacf00b001b80b061e8asi3528043plx.341.2023.08.11.08.06.09; Fri, 11 Aug 2023 08:06:23 -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=ieuY2SYn; 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 S236292AbjHKNFO (ORCPT + 99 others); Fri, 11 Aug 2023 09:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236356AbjHKNEy (ORCPT ); Fri, 11 Aug 2023 09:04:54 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB9AC3584; Fri, 11 Aug 2023 06:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691759079; x=1723295079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=NJ+oDcj0/HsM4ftQsJN9ghcnz+v/hRDm+Rt5+H5fL6M=; b=ieuY2SYnhhUGwteyVFcuSQmpGIhpao+uxBtfENHxGnjRtu8eGx95KHNo MuDd62Eii3DGpXcpxSxtUBudTPlSVacwRMKEECLFg3KV4wWL9MVvuyGDg Lee/w3WVNc0Ip9RXYHcfAc+LWXPOm+QSXyXsc5pgeU38Un0i/31U3k7NJ SsvvENYAcGF4nziV4WYHu5Hzca9ub+ZF1DsVgHJlxFPE/nx3tgInTJY94 WqL8sQzhr89aqt6K4AjBVuCel4vHZZmyW9OcudDcBSC7YOuFGAl5h+u1b 1tuC6auRetHhHU3d1uybroFSEhlN4S3DnQJUSUm0vvBwZwVzaLaZUHkpv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="361811747" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361811747" 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:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="709535211" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="709535211" 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:29 -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 03/16] mmc: sdhci-brcmstb: Use sdhci_pltfm_remove() Date: Fri, 11 Aug 2023 16:03:38 +0300 Message-Id: <20230811130351.7038-4-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: 1773945626558309318 X-GMAIL-MSGID: 1773945626558309318 Use sdhci_pltfm_remove() instead of sdhci_pltfm_unregister() so that devm_clk_get_optional_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-brcmstb.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index a2b6d8f2eeb6..c23251bb95f3 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -264,23 +264,17 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Probe found match for %s\n", match->compatible); - clk = devm_clk_get_optional(&pdev->dev, NULL); + clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); if (IS_ERR(clk)) return dev_err_probe(&pdev->dev, PTR_ERR(clk), - "Failed to get clock from Device Tree\n"); - - res = clk_prepare_enable(clk); - if (res) - return res; + "Failed to get and enable clock from Device Tree\n"); memset(&brcmstb_pdata, 0, sizeof(brcmstb_pdata)); brcmstb_pdata.ops = match_priv->ops; host = sdhci_pltfm_init(pdev, &brcmstb_pdata, sizeof(struct sdhci_brcmstb_priv)); - if (IS_ERR(host)) { - res = PTR_ERR(host); - goto err_clk; - } + if (IS_ERR(host)) + return PTR_ERR(host); pltfm_host = sdhci_priv(host); priv = sdhci_pltfm_priv(pltfm_host); @@ -369,9 +363,7 @@ static int sdhci_brcmstb_probe(struct platform_device *pdev) err: sdhci_pltfm_free(pdev); -err_clk: clk_disable_unprepare(base_clk); - clk_disable_unprepare(clk); return res; } @@ -430,7 +422,7 @@ static struct platform_driver sdhci_brcmstb_driver = { .of_match_table = of_match_ptr(sdhci_brcm_of_match), }, .probe = sdhci_brcmstb_probe, - .remove_new = sdhci_pltfm_unregister, + .remove_new = sdhci_pltfm_remove, .shutdown = sdhci_brcmstb_shutdown, };