env: Move env_set_hex() to env.h
Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
diff --git a/api/api.c b/api/api.c
index 9f03f1a..8a41b7c 100644
--- a/api/api.c
+++ b/api/api.c
@@ -8,6 +8,7 @@
#include <config.h>
#include <command.h>
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <environment.h>
#include <linux/types.h>
diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
index a829ef7..bd4f336 100644
--- a/arch/arm/mach-tegra/cboot.c
+++ b/arch/arm/mach-tegra/cboot.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <environment.h>
#include <fdt_support.h>
#include <fdtdec.h>
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index 3180b24..14b61fc 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
+#include <env.h>
#include <spl.h>
#include <linux/libfdt.h>
#include <nand.h>
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index 89087d7..148fc90 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -10,6 +10,7 @@
*/
#include <version.h>
#include <common.h>
+#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
#include <lcd.h>
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 867eade..26af3f7 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index 7f8e0f9..5fc2c05 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <common.h>
+#include <env.h>
#include <asm/io.h>
#include <asm/bootm.h>
#include <mach/timer.h>
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index d6167aa..49e304f 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <fdtdec.h>
#include <virtio_types.h>
#include <virtio.h>
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index 42a6b54..fb36d83 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 617c892..104589b 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <config.h>
#include <dm.h>
+#include <env.h>
#include <environment.h>
#include <efi_loader.h>
#include <fdt_support.h>
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 98bc3cd..bb425cb 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -12,6 +12,7 @@
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <mmc.h>
#include <axp_pmic.h>
#include <generic-phy.h>
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index 321670d..ed7ba58 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -5,6 +5,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index c118a95..3d1fc95 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -8,6 +8,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <cbfs.h>
static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index 598028c..2188910 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <mapmem.h>
#include <linux/list.h>
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 10d8f32..25a6ed4 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <linux/ctype.h>
#include <linux/types.h>
#include <asm/global_data.h>
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index 64621f2..b47cd3d 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -72,6 +72,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
#include <linux/list.h>
diff --git a/cmd/load.c b/cmd/load.c
index dd1e8da..713fe56 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -10,6 +10,7 @@
#include <common.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <s_record.h>
#include <net.h>
#include <exports.h>
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index 6860b5f..e3b9cc7 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <asm/io.h>
diff --git a/cmd/nand.c b/cmd/nand.c
index 899d504..27efef2 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -23,6 +23,7 @@
#include <linux/mtd/mtd.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <watchdog.h>
#include <malloc.h>
#include <asm/byteorder.h>
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 2c0bca1..7f51b92 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 1a6cecd..0182f19 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
static ulong get_arg(char *s, int w)
diff --git a/cmd/spl.c b/cmd/spl.c
index 038f488..56051b8 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -7,6 +7,7 @@
#include <common.h>
#include <command.h>
#include <cmd_spl.h>
+#include <env.h>
#include <linux/libfdt.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c
index b75e093..2807331 100644
--- a/cmd/tpm-v1.c
+++ b/cmd/tpm-v1.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/unaligned.h>
#include <tpm-common.h>
diff --git a/cmd/trace.c b/cmd/trace.c
index 7d328f8..392b129 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -5,6 +5,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <mapmem.h>
#include <trace.h>
#include <asm/io.h>
diff --git a/cmd/ubi.c b/cmd/ubi.c
index c511a2f..ca5dc90 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -13,6 +13,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <exports.h>
#include <memalign.h>
#include <mtd.h>
diff --git a/cmd/unzip.c b/cmd/unzip.c
index 8474d9b..afd58e7 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
#include <gzip.h>
static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
diff --git a/cmd/ximg.c b/cmd/ximg.c
index 920a80e..a948100 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -13,6 +13,7 @@
*/
#include <common.h>
#include <command.h>
+#include <env.h>
#include <gzip.h>
#include <image.h>
#include <mapmem.h>
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 384ac4c..ed5402b 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -12,6 +12,7 @@
#include <part.h>
#include <config.h>
#include <command.h>
+#include <env.h>
#include <image.h>
#include <linux/ctype.h>
#include <asm/byteorder.h>
diff --git a/cmd/zip.c b/cmd/zip.c
index 9cd400a..8ef46e9 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <command.h>
+#include <env.h>
static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
diff --git a/common/autoboot.c b/common/autoboot.c
index 7a91736..b28bd68 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -9,6 +9,7 @@
#include <bootretry.h>
#include <cli.h>
#include <console.h>
+#include <env.h>
#include <fdtdec.h>
#include <hash.h>
#include <memalign.h>
diff --git a/common/bootm.c b/common/bootm.c
index 4629cdd..02295da 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -7,6 +7,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <bootstage.h>
+#include <env.h>
#include <errno.h>
#include <fdt_support.h>
#include <lmb.h>
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 855c471..6fb7d65 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <bootm.h>
+#include <env.h>
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <malloc.h>
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 200f991..4864344 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <env.h>
#include <fastboot.h>
#include <fastboot-internal.h>
#include <fb_mmc.h>
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index 0a43dfe..ce0f167 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -4,6 +4,7 @@
* Dave Liu <daveliu@freescale.com>
*/
#include <common.h>
+#include <env.h>
#include <malloc.h>
#include <asm/io.h>
#include <linux/errno.h>
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index fab7ce6..bcd1c5d 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -19,6 +19,7 @@
#include <errno.h>
#include <common.h>
#include <console.h>
+#include <env.h>
#include <malloc.h>
#include <linux/usb/ch9.h>
diff --git a/fs/fs.c b/fs/fs.c
index 48d8f1f..d8a4ced 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -6,6 +6,7 @@
#include <config.h>
#include <errno.h>
#include <common.h>
+#include <env.h>
#include <mapmem.h>
#include <part.h>
#include <ext4fs.h>
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 72e8a24..67a0e8c 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -12,6 +12,7 @@
*/
#include <common.h>
+#include <env.h>
#include <gzip.h>
#include <memalign.h>
#include "ubifs.h"
diff --git a/include/common.h b/include/common.h
index 26ec18d..100eac6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -209,27 +209,6 @@
*/
int env_set_ulong(const char *varname, ulong value);
-/**
- * env_set_hex() - set an environment variable to a hex value
- *
- * @varname: Variable to adjust
- * @value: Value to set for the variable (will be converted to a hex string)
- * @return 0 if OK, 1 on error
- */
-int env_set_hex(const char *varname, ulong value);
-
-/**
- * env_set_addr - Set an environment variable to an address in hex
- *
- * @varname: Environment variable to set
- * @addr: Value to set it to
- * @return 0 if ok, 1 on error
- */
-static inline int env_set_addr(const char *varname, const void *addr)
-{
- return env_set_hex(varname, (ulong)addr);
-}
-
void pci_init_board(void);
/* common/exports.c */
diff --git a/include/env.h b/include/env.h
index bf34ac3..5c780f3 100644
--- a/include/env.h
+++ b/include/env.h
@@ -10,6 +10,7 @@
#define __ENV_H
#include <stdbool.h>
+#include <linux/types.h>
/**
* env_get_id() - Gets a sequence number for the environment
@@ -63,6 +64,27 @@
int env_get_f(const char *name, char *buf, unsigned int len);
/**
+ * env_set_hex() - set an environment variable to a hex value
+ *
+ * @varname: Variable to adjust
+ * @value: Value to set for the variable (will be converted to a hex string)
+ * @return 0 if OK, 1 on error
+ */
+int env_set_hex(const char *varname, ulong value);
+
+/**
+ * env_set_addr - Set an environment variable to an address in hex
+ *
+ * @varname: Environment variable to set
+ * @addr: Value to set it to
+ * @return 0 if ok, 1 on error
+ */
+static inline int env_set_addr(const char *varname, const void *addr)
+{
+ return env_set_hex(varname, (ulong)addr);
+}
+
+/**
* env_complete() - return an auto-complete for environment variables
*
* @var: partial name to auto-complete
diff --git a/net/net.c b/net/net.c
index 58b0417..1a175c4 100644
--- a/net/net.c
+++ b/net/net.c
@@ -90,6 +90,7 @@
#include <common.h>
#include <command.h>
#include <console.h>
+#include <env.h>
#include <environment.h>
#include <errno.h>
#include <net.h>