mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/10] commands: regulator: move implementation to regulator core
@ 2019-11-06  7:11 Ahmad Fatoum
  2019-11-06  7:11 ` [PATCH 02/10] commands: regulator: add support for enabling/disabling regulators Ahmad Fatoum
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Ahmad Fatoum @ 2019-11-06  7:11 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, mgr

In preparation for teaching the regulator command how to enable and
disable regulators, move the regulator command implementation to the
regulator core, so the internal interfaces for iterating through the
list of available regulators can be more easily used.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 commands/Makefile        |  1 -
 commands/regulator.c     | 34 ----------------------------------
 drivers/regulator/core.c | 21 +++++++++++++++++----
 3 files changed, 17 insertions(+), 39 deletions(-)
 delete mode 100644 commands/regulator.c

diff --git a/commands/Makefile b/commands/Makefile
index 2f0980185c2b..ffe4ec05832b 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -106,7 +106,6 @@ obj-$(CONFIG_CMD_DRVINFO)	+= drvinfo.o
 obj-$(CONFIG_CMD_READF)		+= readf.o
 obj-$(CONFIG_CMD_MENUTREE)	+= menutree.o
 obj-$(CONFIG_CMD_2048)		+= 2048.o
-obj-$(CONFIG_CMD_REGULATOR)	+= regulator.o
 obj-$(CONFIG_CMD_LSPCI)		+= lspci.o
 obj-$(CONFIG_CMD_IMD)		+= imd.o
 obj-$(CONFIG_CMD_HWCLOCK)	+= hwclock.o
diff --git a/commands/regulator.c b/commands/regulator.c
deleted file mode 100644
index e0b704f88a24..000000000000
--- a/commands/regulator.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * regulator command
- *
- * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-#include <common.h>
-#include <command.h>
-#include <regulator.h>
-
-static int do_regulator(int argc, char *argv[])
-{
-	regulators_print();
-
-	return 0;
-}
-
-BAREBOX_CMD_START(regulator)
-	.cmd		= do_regulator,
-	BAREBOX_CMD_DESC("list regulators")
-	BAREBOX_CMD_GROUP(CMD_GRP_INFO)
-BAREBOX_CMD_END
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4ca035ae9476..591e44c15407 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -383,14 +383,27 @@ static void regulator_print_one(struct regulator_internal *ri)
 	}
 }
 
-/*
- * regulators_print - print informations about all regulators
- */
-void regulators_print(void)
+#ifdef CONFIG_CMD_REGULATOR
+
+#include <common.h>
+#include <command.h>
+#include <regulator.h>
+
+static int do_regulator(int argc, char *argv[])
 {
 	struct regulator_internal *ri;
 
 	printf("%-20s %6s %10s %10s\n", "name", "enable", "min_uv", "max_uv");
 	list_for_each_entry(ri, &regulator_list, list)
 		regulator_print_one(ri);
+
+	return 0;
 }
+
+BAREBOX_CMD_START(regulator)
+	.cmd		= do_regulator,
+	BAREBOX_CMD_DESC("list regulators")
+	BAREBOX_CMD_GROUP(CMD_GRP_INFO)
+BAREBOX_CMD_END
+
+#endif
-- 
2.24.0.rc1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-11-06 10:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  7:11 [PATCH 01/10] commands: regulator: move implementation to regulator core Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 02/10] commands: regulator: add support for enabling/disabling regulators Ahmad Fatoum
2019-11-06  9:44   ` Sascha Hauer
2019-11-06  7:11 ` [PATCH 03/10] regulator: copy upstream struct regulator_desc documentation Ahmad Fatoum
2019-11-06 10:24   ` Sascha Hauer
2019-11-06  7:11 ` [PATCH 04/10] regulator: port Linux of_regulator_match Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 05/10] regulator: import linear voltage range helpers Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 06/10] mfd: stpmic1: use dev_get_regmap instead of priv member Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 07/10] regulator: add driver for stpmic1-regulators Ahmad Fatoum
2019-11-06  7:29   ` [PATCH 11/10] fixup! " Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 08/10] ARM: dts: stm32mp157a-dk1: remove unnecessary sram node Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 09/10] ARM: stm32mp: enable STPMIC1 MFD and cell drivers Ahmad Fatoum
2019-11-06  7:11 ` [PATCH 10/10] Revert "ARM: dts: stm32mp157a-dk1: overwrite regulator for sdmmc node" Ahmad Fatoum
2019-11-06  9:39 ` [PATCH 01/10] commands: regulator: move implementation to regulator core Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox