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: 134504 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1102440vqi; Fri, 11 Aug 2023 06:39:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH0UL5svRd4I4YEsdDfmly/8+tLSlYBGkNuLeWTacFxoOF+muYQU6esrSd27iS9/VExUXY/ X-Received: by 2002:a17:902:ec87:b0:1bc:1e17:6d70 with SMTP id x7-20020a170902ec8700b001bc1e176d70mr2592167plg.24.1691761196778; Fri, 11 Aug 2023 06:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691761196; cv=none; d=google.com; s=arc-20160816; b=VxjG92oOtI4B6Golt6hRalZ/ea69J85vIeCNgp6AGHyrSM7x1TYotlxfOQX4vTQ2Mj v8Wkogome/UptsOObfepaCt+CwWzob+R6PjHrN5cgHCMERZOeczZ5hKB5xnpCHv2A/D2 4PPoq7rg6Ad985s4nfwlV6J09bzSqOeateSpCZJW67kUf4aFEe1bONSZsP1WBNb1jAMX 4tenTLbQdo0qNVL/OvpiHRsedvNeyYVdg2h7pUXm1mxYqKpqScwoBHFgWO7XmOQV/a0C SyNl6RAVGYO0ayQDyaQQOcPe/5StPoEiwb+zLsFPFzTei94VepSOi/I3idOZXyw6whWA V9tw== 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=KjUz0Mpz3bXvgNmlmvwHjd/szLt+02qtox2TN55IHqQ=; fh=1illQt2rvZm/duIamif60BE+Ziytl52XIUdvA193/Ac=; b=w0XnzW7psyYsE+ZLlPTjkC2M2tZF9IWTYTh8fuaIN/n9bkteCQqfKFDWKw7yK1vUKd 8BzgdGb77ZmZK+uDgw9td4e9JO0rS1FLqOJUU60VIz2JP4q5oWW40MF6QcjmJ9P/dwBG /hQth64uwu8NeU01gvrSKrhaY2sYYgODshnE55+vPPyeypIu6ovlqs30gNV2+2SOT00A 51+gac4ZxNdRCvBNn1PiCOwafsxur+jY0lqKUOWMeyUlr+IZ+jvhOqSmtI4BXhj9yHBU CsErB0UO1EeEye5xkWQfql3dBVOAXI7WYvlzJJtVtKurV2DLw6UOgQIhtSmpJMfCulGi UsMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FeY+hahd; 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 b5-20020a170902d50500b001b8a2774d60si3468012plg.486.2023.08.11.06.39.42; Fri, 11 Aug 2023 06:39:56 -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=FeY+hahd; 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 S231574AbjHKNHv (ORCPT + 99 others); Fri, 11 Aug 2023 09:07:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236335AbjHKNHZ (ORCPT ); Fri, 11 Aug 2023 09:07:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D43894202; Fri, 11 Aug 2023 06:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691759221; x=1723295221; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cELYaecOpOxwmlY9lj9HXHEoAv/KTQp9fFm7cY/4i5Y=; b=FeY+hahdjiL6EDuqj1XtV0InCN98yjkZjRTDdwXgYRwfHwQTzDXer+sy IgCZYr08U3RyIajKbKuo7zsW6nyrh1NrkV6YlpZY3rdkir6zFlzl9SHZ6 N6zfPzw3ZqepUCMCe4qZ64snArdXjsTjOhwL/tYran6OWrec2f0W5R/vw wyBx6eBxTaLJBzSdql5ki3GolPTrOKE2D3acnrfZrZP+SDM0q55bFG8ZO Imc07DSjSr5vx+vcvmpGd9Z1Ix753MZt7zJHnXFv2gaZOpjd3CLTBDPdX ytPQ4o5um4pBNch+41QNbDhlxWjvle2mmUrQzwYHZLf1LKssvL8jkmHQC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="361812743" X-IronPort-AV: E=Sophos;i="6.01,165,1684825200"; d="scan'208";a="361812743" 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 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 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-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: 1773940188753335206 X-GMAIL-MSGID: 1773940188753335206 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);