[PATCH] fixup! test: self: add basic regulator selftest

Ahmad Fatoum ahmad at a3f.at
Tue May 2 03:02:16 PDT 2023


  - fix order, so test doesn't fail.
  - print debug message before registration, so early failure
    is easier to follow
  - don't define DEBUG by default

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
 test/self/regulator.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/test/self/regulator.c b/test/self/regulator.c
index adb4d93c2114..1ccaae0ed332 100644
--- a/test/self/regulator.c
+++ b/test/self/regulator.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#define DEBUG 1
+
 #include <common.h>
 #include <bselftest.h>
 #include <driver.h>
@@ -60,12 +60,8 @@ static const struct regulator_ops test_regulator_ops_range = {
 };
 
 enum {
-	/*
-	 * This is intentionally ordered that way to test registering
-	 * an always-on regulator before its sibling that it depends on
-	 */
-	TEST_LDO1,
 	TEST_BUCK,
+	TEST_LDO1,
 	TEST_LDO2,
 	TEST_REGULATORS_NUM
 };
@@ -106,13 +102,12 @@ static int test_regulator_register(struct test_regulator *priv, int id,
 	cfg->rdev.desc = &cfg->desc;
 	cfg->rdev.dev = dev;
 
+	dev_dbg(dev, "registering %s\n", match->name);
+
 	ret = of_regulator_register(&cfg->rdev, match->of_node);
 	if (ret)
 		return dev_err_probe(dev, ret, "failed to register %s regulator\n",
 				     match->name);
-
-	dev_dbg(dev, "registered %s\n", match->name);
-
 	return 0;
 }
 
-- 
2.38.4




More information about the barebox mailing list