]> git.sur5r.net Git - u-boot/commitdiff
sandbox: tests: Exclude common test code (pmic_get) in test/dm/pmic.c
authorLukasz Majewski <lukma@denx.de>
Tue, 15 May 2018 14:26:42 +0000 (16:26 +0200)
committerStefano Babic <sbabic@denx.de>
Fri, 18 May 2018 06:27:26 +0000 (08:27 +0200)
The common code can be excluded to be reused by tests for other PMIC.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
test/dm/pmic.c

index b2061178fca4ac1e46a856ee315ff8132b964cc0..c24bd3b0a12cd19cd1a25e0c9b14c2f09a004a80 100644 (file)
@@ -21,9 +21,9 @@
 #include <test/ut.h>
 
 /* Test PMIC get method */
-static int dm_test_power_pmic_get(struct unit_test_state *uts)
+
+static inline int power_pmic_get(struct unit_test_state *uts, char *name)
 {
-       const char *name = "sandbox_pmic";
        struct udevice *dev;
 
        ut_assertok(pmic_get(name, &dev));
@@ -34,6 +34,14 @@ static int dm_test_power_pmic_get(struct unit_test_state *uts)
 
        return 0;
 }
+
+/* Test PMIC get method */
+static int dm_test_power_pmic_get(struct unit_test_state *uts)
+{
+       power_pmic_get(uts, "sandbox_pmic");
+
+       return 0;
+}
 DM_TEST(dm_test_power_pmic_get, DM_TESTF_SCAN_FDT);
 
 /* Test PMIC I/O */