From patchwork Fri Aug 11 13:03:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 13350879 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 947B6C001DE for ; Fri, 11 Aug 2023 13:07:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zZKpTC7iy5b+6an9V7c/JhBJSsgMOKRfHfuYP6PlXLk=; b=1D0B5IwStfwGYh M7QoFbhZ+P8FIXa6CvhlBEqAVG4hzCLbq8mvbzcfseBwc8A5evHSTpI1aliPAidz0D8hAAZ/mvnsN 4N5bUZynIbuW+epm4wTgrt6DtB4k4IUXUqaXuZnRIG+QygwW5oG+u/9pwzw3EanckLDU4v+25NPat SNAz6+j3+HlNzq7BuHry0XDrms3T4qPndBgwItiVELwwfIBgFs3EPViaEwLHmEf6IMpYDcyuO+nZp RpXf6XNkN9goxs4rY8X4nRgwLhmWpqzpU6Dx111xHjQiKZc/VK88pV22FecD7cRiSkzR7UouEjxDi gdDvj+LrOLLU5ZhKVvWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qURqo-00Ag0m-16; Fri, 11 Aug 2023 13:06:46 +0000 Received: from mgamail.intel.com ([134.134.136.20]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qURqk-00AfyL-1j for linux-arm-kernel@lists.infradead.org; Fri, 11 Aug 2023 13:06:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691759202; x=1723295202; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cELYaecOpOxwmlY9lj9HXHEoAv/KTQp9fFm7cY/4i5Y=; b=FrlJTKUSlKhwHf+7QZ3EgQM3Pdm4jenLTc5VVA8IXd0L2IG2R+F31p87 QeeNyFotytAxNhxoURgccAjoMotnW99FaoImfm7YPL2fljv6I6BpASRKk UmzG1WHIhwbhpEiLpDKL6QYtJx+Kn/HC+Aej7zH9yq+O8KMMrpeU1cBxU inBQ1O8C7peAB1RiY3bexWyAEMnBRUqTBxktW2V0iVMNSQATdV5nHHOd3 2l0y8PUhRMYmlPmt/aM8E1lx3oPzhB7j2N1bwqJQ+MKj1z03QeYGBRWLI VMitbD9jF6f2GlY1A7CQGS1WOKXQJRlvHgqAMh2fnwBDkfTwBzxgJ4bjT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="361812751" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361812751" 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:06:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="709535330" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="709535330" 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:05:57 -0700 From: Adrian Hunter To: Ulf Hansson , Andy Shevchenko , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Yangtao Li Subject: [PATCH 13/16] mmc: sdhci-pxav2: Use sdhci_pltfm_remove() Date: Fri, 11 Aug 2023 16:03:48 +0300 Message-Id: <20230811130351.7038-14-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230811_060642_666547_D253CC77 X-CRM114-Status: GOOD ( 17.01 ) 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: , Cc: Alexandre Belloni , Kunihiko Hayashi , Al Cooper , Li Zetao , Brad Larson , Swati Agarwal , linux-kernel@vger.kernel.org, Sai Krishna Potthuri , Jiapeng Chong , Florian Fainelli , Steen Hegelund , Brian Norris , Broadcom internal kernel review list , linux-arm-kernel@lists.infradead.org, Ye Xingchen , Patrice Chotard , Kamal Dasu , Doug Brown , Daniel Machon , Ray Jui , Eugen Hristev , Jassi Brar , Christophe JAILLET , Georgii Kruglov , Michal Simek , Lars Povlsen , Andy Tang , Scott Branden , linux-mmc@vger.kernel.org, UNGLinuxDriver@microchip.com, Claudiu Beznea Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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-pxav2.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c index a0c8470e9214..b75cbea88b40 100644 --- a/drivers/mmc/host/sdhci-pxav2.c +++ b/drivers/mmc/host/sdhci-pxav2.c @@ -268,26 +268,21 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) pltfm_host = sdhci_priv(host); pxav2_host = sdhci_pltfm_priv(pltfm_host); - clk = devm_clk_get(dev, "io"); - if (IS_ERR(clk) && PTR_ERR(clk) != -EPROBE_DEFER) - clk = devm_clk_get(dev, NULL); + clk = devm_clk_get_optional_enabled(dev, "io"); + if (!clk) + clk = devm_clk_get_enabled(dev, NULL); if (IS_ERR(clk)) { ret = PTR_ERR(clk); dev_err_probe(dev, ret, "failed to get io clock\n"); goto free; } pltfm_host->clk = clk; - ret = clk_prepare_enable(clk); - if (ret) { - dev_err(dev, "failed to enable io clock\n"); - goto free; - } clk_core = devm_clk_get_optional_enabled(dev, "core"); if (IS_ERR(clk_core)) { ret = PTR_ERR(clk_core); dev_err_probe(dev, ret, "failed to enable core clock\n"); - goto disable_clk; + goto free; } host->quirks = SDHCI_QUIRK_BROKEN_ADMA @@ -339,12 +334,10 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) - goto disable_clk; + goto free; return 0; -disable_clk: - clk_disable_unprepare(clk); free: sdhci_pltfm_free(pdev); return ret; @@ -358,7 +351,7 @@ static struct platform_driver sdhci_pxav2_driver = { .pm = &sdhci_pltfm_pmops, }, .probe = sdhci_pxav2_probe, - .remove_new = sdhci_pltfm_unregister, + .remove_new = sdhci_pltfm_remove, }; module_platform_driver(sdhci_pxav2_driver);