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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CF6C2C0015E for ; Wed, 19 Jul 2023 21:21:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF11286793; Wed, 19 Jul 2023 23:21:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kwiboo.se header.i=@kwiboo.se header.b="ONV6baZM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2ABF784701; Wed, 19 Jul 2023 23:21:04 +0200 (CEST) Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2CA8A86783 for ; Wed, 19 Jul 2023 23:21:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bounces+31435339-7456-u-boot=lists.denx.de@em2124.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type:cc:content-type:from:subject:to; s=s1; bh=9iQLlF4jD6EVWLX9nMnwgz+VCqIgl7vBzDZZFAbFoSA=; b=ONV6baZMaIkVig1NXn5sg7Rzqk+IqvRC5thQSvkKgm3/aN9sQcjXJnMfepVQu4MzjOsi +OL5RBlgTttnaLNGu84KlkaV+bhl/j4zO7g5wmJZbSArCc2h2nRcVELGyueiqI1uuMQpEV LoKsVvFXwFrCMhUuYRwxaSE6TdsbT/kqdAOIg36m/w4fB0vuaqghdiRjbW3uzlKRqnKUun B4YrH0MzItRooiubliRcUcYorkaOCdtWAeSJMUOzGtSUguPOxlHyGSM21vnwyJU6z1IOM1 R6LRmS1iYf0RAZG7ltlnnknSTs0pQfxJY+JkxZgvWORt/walLEqnI9pz1KvHBk9A== Received: by filterdrecv-8684c58db7-5vsrj with SMTP id filterdrecv-8684c58db7-5vsrj-1-64B853BA-2A 2023-07-19 21:20:59.128138835 +0000 UTC m=+6039765.947065672 Received: from bionic.localdomain (unknown) by geopod-ismtpd-1 (SG) with ESMTP id 0kLL1soMTgejBj7cjRuc2g Wed, 19 Jul 2023 21:20:58.824 +0000 (UTC) From: Jonas Karlman Subject: [PATCH 4/5] mmc: Use regulator_set_enable_if_allowed Date: Wed, 19 Jul 2023 21:20:59 +0000 (UTC) Message-ID: <20230719212049.709358-5-jonas@kwiboo.se> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719212049.709358-1-jonas@kwiboo.se> References: <20230719212049.709358-1-jonas@kwiboo.se> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxA?= =?us-ascii?Q?fZekEeQsTe+RrMu3cja6a0hxvNZZjedCzlytmau?= =?us-ascii?Q?VL9qKLfReF+h4qWrdx+ZqbC0PJis=2FzxpxHABmG6?= =?us-ascii?Q?Iz+5zPeeBKDIsYadyX0r=2Fvh7omO2+gCfmh9GDm5?= =?us-ascii?Q?l2zQ6qo=2FaeVf49FDf4Lmgda6oujUmIeZcgUA7B9?= =?us-ascii?Q?EUQuBe0hO8na=2FSNu=2FZEp7sGAg3Hu0B88u9KP1o?= To: Simon Glass , Marek Vasut , Peng Fan , Jaehoon Chung , Patrice Chotard Cc: Eugen Hristev , Svyatoslav Ryhel , u-boot@lists.denx.de, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators. Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled. Signed-off-by: Jonas Karlman --- drivers/mmc/mmc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 31cfda288587..089a0442568c 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2775,9 +2775,10 @@ static int mmc_power_on(struct mmc *mmc) { #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, true); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + true); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { printf("Error enabling VMMC supply : %d\n", ret); return ret; } @@ -2791,9 +2792,10 @@ static int mmc_power_off(struct mmc *mmc) mmc_set_clock(mmc, 0, MMC_CLK_DISABLE); #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR) if (mmc->vmmc_supply) { - int ret = regulator_set_enable(mmc->vmmc_supply, false); + int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply, + false); - if (ret && ret != -EACCES) { + if (ret && ret != -ENOSYS) { pr_debug("Error disabling VMMC supply : %d\n", ret); return ret; } -- 2.41.0