Skip to content

Commit

Permalink
env: Move env_set_hex() to env.h
Browse files Browse the repository at this point in the history
Move env_set_hex() over to the new header file along with env_set_addr()
which uses it.

Signed-off-by: Simon Glass <[email protected]>
Acked-by: Joe Hershberger <[email protected]>
  • Loading branch information
sjg20 authored and trini committed Aug 11, 2019
1 parent b9ca02c commit c7694dd
Show file tree
Hide file tree
Showing 39 changed files with 59 additions and 21 deletions.
1 change: 1 addition & 0 deletions api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-tegra/cboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <common.h>
#include <env.h>
#include <environment.h>
#include <fdt_support.h>
#include <fdtdec.h>
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-uniphier/board_late_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#include <common.h>
#include <env.h>
#include <spl.h>
#include <linux/libfdt.h>
#include <nand.h>
Expand Down
1 change: 1 addition & 0 deletions board/BuR/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
#include <version.h>
#include <common.h>
#include <env.h>
#include <fdtdec.h>
#include <i2c.h>
#include <lcd.h>
Expand Down
1 change: 1 addition & 0 deletions board/boundary/nitrogen6x/nitrogen6x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions board/broadcom/bcmstb/bcmstb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions board/emulation/qemu-riscv/qemu-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <common.h>
#include <dm.h>
#include <env.h>
#include <fdtdec.h>
#include <virtio_types.h>
#include <virtio.h>
Expand Down
1 change: 1 addition & 0 deletions board/freescale/qemu-ppce500/qemu-ppce500.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <common.h>
#include <command.h>
#include <env.h>
#include <pci.h>
#include <asm/processor.h>
#include <asm/mmu.h>
Expand Down
1 change: 1 addition & 0 deletions board/raspberrypi/rpi/rpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions board/sunxi/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <common.h>
#include <dm.h>
#include <env.h>
#include <mmc.h>
#include <axp_pmic.h>
#include <generic-phy.h>
Expand Down
1 change: 1 addition & 0 deletions board/xilinx/zynqmp/cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

#include <common.h>
#include <env.h>
#include <malloc.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/cbfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions cmd/cramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
#include <common.h>
#include <command.h>
#include <env.h>
#include <malloc.h>
#include <mapmem.h>
#include <linux/list.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions cmd/jffs2.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
*/
#include <common.h>
#include <command.h>
#include <env.h>
#include <malloc.h>
#include <jffs2/jffs2.h>
#include <linux/list.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions cmd/lzmadec.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <common.h>
#include <command.h>
#include <env.h>
#include <mapmem.h>
#include <asm/io.h>

Expand Down
1 change: 1 addition & 0 deletions cmd/nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions cmd/reiser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions cmd/setexpr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions cmd/spl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cmd/tpm-v1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <common.h>
#include <env.h>
#include <malloc.h>
#include <asm/unaligned.h>
#include <tpm-common.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <common.h>
#include <command.h>
#include <env.h>
#include <mapmem.h>
#include <trace.h>
#include <asm/io.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/ubi.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <common.h>
#include <command.h>
#include <env.h>
#include <exports.h>
#include <memalign.h>
#include <mtd.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/unzip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
Expand Down
1 change: 1 addition & 0 deletions cmd/ximg.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
#include <common.h>
#include <command.h>
#include <env.h>
#include <gzip.h>
#include <image.h>
#include <mapmem.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions cmd/zip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
{
Expand Down
1 change: 1 addition & 0 deletions common/autoboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions common/bootm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions common/bootm_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <common.h>
#include <bootm.h>
#include <env.h>
#include <fdt_support.h>
#include <linux/libfdt.h>
#include <malloc.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/fastboot/fb_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <common.h>
#include <env.h>
#include <fastboot.h>
#include <fastboot-internal.h>
#include <fb_mmc.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/net/fm/fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Dave Liu <[email protected]>
*/
#include <common.h>
#include <env.h>
#include <malloc.h>
#include <asm/io.h>
#include <linux/errno.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/gadget/f_sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <errno.h>
#include <common.h>
#include <console.h>
#include <env.h>
#include <malloc.h>

#include <linux/usb/ch9.h>
Expand Down
1 change: 1 addition & 0 deletions fs/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions fs/ubifs/ubifs.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include <common.h>
#include <env.h>
#include <gzip.h>
#include <memalign.h>
#include "ubifs.h"
Expand Down
21 changes: 0 additions & 21 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,27 +209,6 @@ int env_set(const char *varname, const char *value);
*/
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 */
Expand Down
22 changes: 22 additions & 0 deletions include/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#define __ENV_H

#include <stdbool.h>
#include <linux/types.h>

/**
* env_get_id() - Gets a sequence number for the environment
Expand Down Expand Up @@ -62,6 +63,27 @@ int env_match(unsigned char *name, int index);
*/
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
*
Expand Down
1 change: 1 addition & 0 deletions net/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c7694dd

Please sign in to comment.