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 3CEDDC43458 for ; Fri, 10 Jul 2026 13:16:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4083B84A8D; Fri, 10 Jul 2026 15:16:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine 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; secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="xQYq60sz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA35584A90; Fri, 10 Jul 2026 15:16:09 +0200 (CEST) Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 57E1684A63 for ; Fri, 10 Jul 2026 15:16:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=kwiboo.se Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=SRS0=d8f4=FF=kwiboo.se=jonas@fe-bounces.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1783689365; bh=/L7ec48rdHLMHn+uaRTGmGIgPRheWzjU3esc6GpIl+k=; b=xQYq60sz4m3s40r1TwiO9wdW21fYvmragnrv1jiGTbOpHMVwvhYbQJ7xv32dljV7eUkfqWe+y jCvhCyiAnhxQuyQKKKtbL7GH6HDta1/aRGkbW2d72Uud3YNubGbvPsWxaAbLmlwgTcTX/j4tYel Nur8RgUmFxvVp6Vab512jjyrc9JlX+zv7V+i/FPaCjU7Oy9uYXBgJt3KfOJMJmTJn0w8QF75ceq 6o5zouOCi3kkji+mOfkpGNfYaNLuqDBxRl6e4kOzuZV7GaBZfEbq1vz4ICF1airOcHkmeOn3ZgE yzMxMfOc2vHpC1VElM7JxSjUrrYL0IPT2g4DVkZty1Qw== X-Forward-Email-ID: 6a50f09064bed9dbaa1c2b2d X-Forward-Email-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 149.28.215.223 X-Forward-Email-Version: 2.10.2 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Report-Abuse-To: abuse@forwardemail.net From: Jonas Karlman To: Jaehoon Chung , Peng Fan , Tom Rini , Casey Connolly Cc: Jonas Karlman , u-boot@lists.denx.de Subject: [PATCH v2] power: regulator: Fix regulator_enable/disable() macros Date: Fri, 10 Jul 2026 13:15:53 +0000 Message-ID: <20260710131554.3686622-1-jonas@kwiboo.se> X-Mailer: git-send-email 2.54.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The commit 076265b75e61 ("compat: regulator: add enable/disable macros") added regulator_enable/disable() macros to provide a closer analogue to the Linux API. These new macros wrap regulator_set_enable() that may return detailed error codes and should typically not directly be called by drivers. Change the macros to wrap regulator_set_enable_if_allowed() that masks error codes consumers typically do not expect to closer match the behavior of the Linux API. Also move the macros outside the #if #else blocks to make the macros available when !CONFIG_IS_ENABLED(DM_REGULATOR). Fixes: 076265b75e61 ("compat: regulator: add enable/disable macros") Signed-off-by: Jonas Karlman --- Changes in v2: - Move macros outside the #if #else blocks --- include/power/regulator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/power/regulator.h b/include/power/regulator.h index b8023721a165..8d4d1450b905 100644 --- a/include/power/regulator.h +++ b/include/power/regulator.h @@ -371,9 +371,6 @@ int regulator_get_enable(struct udevice *dev); */ int regulator_set_enable(struct udevice *dev, bool enable); -#define regulator_enable(dev) regulator_set_enable(dev, true) -#define regulator_disable(dev) regulator_set_enable(dev, false) - /** * regulator_set_enable_if_allowed: set regulator enable state if allowed by * regulator @@ -651,4 +648,7 @@ static inline int device_get_supply_regulator(struct udevice *dev, const char *s } #endif +#define regulator_enable(dev) regulator_set_enable_if_allowed(dev, true) +#define regulator_disable(dev) regulator_set_enable_if_allowed(dev, false) + #endif /* _INCLUDE_REGULATOR_H_ */ -- 2.54.0