diff mbox series

[2/4] regulator: bd718x7: Only bind children when PMIC_CHILDREN is enabled

Message ID 20220817112403.68144-2-aford173@gmail.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [1/4] configs: imx8mn_beacon: Re-align memory to standard imx8mn settings | expand

Commit Message

Adam Ford Aug. 17, 2022, 11:24 a.m. UTC
If the bd718x7 is required, but PMIC_CHILDREN is disabled, this
driver throws a compile error.  Fix this by putting the function
to bind children into an if-statement checking for PMIC_CHILDREN.

Allowing PMIC_CHILDREN to be disabled in SPL saves some space and
still permits some read/write functions to access the PMIC in
early startup.

Signed-off-by: Adam Ford <aford173@gmail.com>

Comments

Simon Glass Aug. 17, 2022, 6:53 p.m. UTC | #1
On Wed, 17 Aug 2022 at 05:24, Adam Ford <aford173@gmail.com> wrote:
>
> If the bd718x7 is required, but PMIC_CHILDREN is disabled, this
> driver throws a compile error.  Fix this by putting the function
> to bind children into an if-statement checking for PMIC_CHILDREN.
>
> Allowing PMIC_CHILDREN to be disabled in SPL saves some space and
> still permits some read/write functions to access the PMIC in
> early startup.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c
index cb9238972f..fdbbd6f559 100644
--- a/drivers/power/pmic/bd71837.c
+++ b/drivers/power/pmic/bd71837.c
@@ -63,10 +63,11 @@  static int bd71837_bind(struct udevice *dev)
 
 	debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
 
-	children = pmic_bind_children(dev, regulators_node, pmic_children_info);
-	if (!children)
-		debug("%s: %s - no child found\n", __func__, dev->name);
-
+	if (CONFIG_IS_ENABLED(PMIC_CHILDREN)) {
+		children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+		if (!children)
+			debug("%s: %s - no child found\n", __func__, dev->name);
+	}
 	/* Always return success for this device */
 	return 0;
 }