[U-Boot] [PATCH v5 13/19] drivers: converted with new env interfaces

AKASHI Takahiro takahiro.akashi at linaro.org
Thu Sep 5 08:21:27 UTC 2019


env_xxx(...) -> env_xxx(ctx_uboot, ...)

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 drivers/bootcount/bootcount_env.c   | 12 +++++++-----
 drivers/ddr/fsl/fsl_ddr_gen4.c      |  2 +-
 drivers/ddr/fsl/interactive.c       |  5 +++--
 drivers/ddr/fsl/options.c           |  4 ++--
 drivers/dfu/dfu.c                   |  6 +++---
 drivers/fastboot/fb_command.c       |  4 ++--
 drivers/fastboot/fb_common.c        |  2 +-
 drivers/fastboot/fb_getvar.c        |  8 ++++----
 drivers/fastboot/fb_mmc.c           |  2 +-
 drivers/input/i8042.c               |  2 +-
 drivers/input/input.c               |  2 +-
 drivers/misc/fs_loader.c            |  8 ++++----
 drivers/mtd/cfi_flash.c             |  2 +-
 drivers/mtd/mtd_uboot.c             | 11 ++++++-----
 drivers/net/fec_mxc.c               |  2 +-
 drivers/net/fm/b4860.c              |  3 ++-
 drivers/net/fm/fdt.c                |  2 +-
 drivers/net/fm/fm.c                 |  4 ++--
 drivers/net/fsl-mc/mc.c             |  7 ++++---
 drivers/net/netconsole.c            | 14 +++++++-------
 drivers/net/phy/micrel_ksz90x1.c    |  4 ++--
 drivers/net/sandbox-raw.c           |  4 ++--
 drivers/pci/pci.c                   |  4 ++--
 drivers/pci/pci_common.c            |  2 +-
 drivers/reset/reset-socfpga.c       |  2 +-
 drivers/rtc/m41t60.c                |  2 +-
 drivers/scsi/scsi.c                 |  2 +-
 drivers/serial/usbtty.c             |  4 ++--
 drivers/usb/gadget/designware_udc.c |  2 +-
 drivers/usb/gadget/ether.c          | 13 +++++++------
 drivers/usb/gadget/f_dfu.c          |  2 +-
 drivers/usb/gadget/f_fastboot.c     |  2 +-
 drivers/usb/gadget/f_rockusb.c      |  2 +-
 drivers/usb/gadget/f_sdp.c          |  2 +-
 drivers/usb/host/ehci-fsl.c         |  2 +-
 drivers/video/ati_radeon_fb.c       |  2 +-
 drivers/video/cfb_console.c         |  2 +-
 drivers/video/mb862xx.c             |  2 +-
 drivers/video/mx3fb.c               |  2 +-
 drivers/video/mxsfb.c               |  2 +-
 drivers/video/videomodes.c          |  4 ++--
 41 files changed, 86 insertions(+), 79 deletions(-)

diff --git a/drivers/bootcount/bootcount_env.c b/drivers/bootcount/bootcount_env.c
index b75c9002b2c0..3f4ba6d8586c 100644
--- a/drivers/bootcount/bootcount_env.c
+++ b/drivers/bootcount/bootcount_env.c
@@ -9,21 +9,23 @@
 
 void bootcount_store(ulong a)
 {
-	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
+	int upgrade_available = env_get_ulong(ctx_uboot, "upgrade_available",
+					      10, 0);
 
 	if (upgrade_available) {
-		env_set_ulong("bootcount", a);
-		env_save();
+		env_set_ulong(ctx_uboot, "bootcount", a);
+		env_save(ctx_uboot);
 	}
 }
 
 ulong bootcount_load(void)
 {
-	int upgrade_available = env_get_ulong("upgrade_available", 10, 0);
+	int upgrade_available = env_get_ulong(ctx_uboot, "upgrade_available",
+					      10, 0);
 	ulong val = 0;
 
 	if (upgrade_available)
-		val = env_get_ulong("bootcount", 10, 0);
+		val = env_get_ulong(ctx_uboot, "bootcount", 10, 0);
 
 	return val;
 }
diff --git a/drivers/ddr/fsl/fsl_ddr_gen4.c b/drivers/ddr/fsl/fsl_ddr_gen4.c
index 17a4a8282b73..3e373607eb16 100644
--- a/drivers/ddr/fsl/fsl_ddr_gen4.c
+++ b/drivers/ddr/fsl/fsl_ddr_gen4.c
@@ -509,7 +509,7 @@ step2:
 #define BIST_CR_STAT	0x00000001
 	/* Perform build-in test on memory. Three-way interleaving is not yet
 	 * supported by this code. */
-	if (env_get_f("ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
+	if (env_get_f(ctx_uboot, "ddr_bist", buffer, CONFIG_SYS_CBSIZE) >= 0) {
 		puts("Running BIST test. This will take a while...");
 		cs0_config = ddr_in32(&ddr->cs0_config);
 		cs0_bnds = ddr_in32(&ddr->cs0_bnds);
diff --git a/drivers/ddr/fsl/interactive.c b/drivers/ddr/fsl/interactive.c
index 8e171e67fec2..2c5829cd394b 100644
--- a/drivers/ddr/fsl/interactive.c
+++ b/drivers/ddr/fsl/interactive.c
@@ -1876,7 +1876,8 @@ int fsl_ddr_interactive_env_var_exists(void)
 {
 	char buffer[CONFIG_SYS_CBSIZE];
 
-	if (env_get_f("ddr_interactive", buffer, CONFIG_SYS_CBSIZE) >= 0)
+	if (env_get_f(ctx_uboot, "ddr_interactive", buffer,
+		      CONFIG_SYS_CBSIZE) >= 0)
 		return 1;
 
 	return 0;
@@ -1906,7 +1907,7 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
 	};
 
 	if (var_is_set) {
-		if (env_get_f("ddr_interactive", buffer2,
+		if (env_get_f(ctx_uboot, "ddr_interactive", buffer2,
 			      CONFIG_SYS_CBSIZE) > 0)
 			p = buffer2;
 		else
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index b9179315f252..51d27096e8f6 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -760,7 +760,7 @@ unsigned int populate_memctl_options(const common_timing_params_t *common_dimm,
 	 * Extract hwconfig from environment since we have not properly setup
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buf, sizeof(buf)) < 0)
 		buf[0] = '\0';
 
 #if defined(CONFIG_SYS_FSL_DDR3) || \
@@ -1407,7 +1407,7 @@ int fsl_use_spd(void)
 	 * Extract hwconfig from environment since we have not properly setup
 	 * the environment but need it for ddr config params
 	 */
-	if (env_get_f("hwconfig", buf, sizeof(buf)) < 0)
+	if (env_get_f(ctx_uboot, "hwconfig", buf, sizeof(buf)) < 0)
 		buf[0] = '\0';
 
 	/* if hwconfig is not enabled, or "sdram" is not defined, use spd */
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index d2b67b18cf02..9171c1932014 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -62,7 +62,7 @@ int dfu_init_env_entities(char *interface, char *devstr)
 #ifdef CONFIG_SET_DFU_ALT_INFO
 	set_dfu_alt_info(interface, devstr);
 #endif
-	str_env = env_get("dfu_alt_info");
+	str_env = env_get(ctx_uboot, "dfu_alt_info");
 	if (!str_env) {
 		pr_err("\"dfu_alt_info\" env variable not defined!\n");
 		return -EINVAL;
@@ -103,7 +103,7 @@ unsigned char *dfu_get_buf(struct dfu_entity *dfu)
 	if (dfu_buf != NULL)
 		return dfu_buf;
 
-	s = env_get("dfu_bufsiz");
+	s = env_get(ctx_uboot, "dfu_bufsiz");
 	if (s)
 		dfu_buf_size = (unsigned long)simple_strtol(s, NULL, 0);
 
@@ -125,7 +125,7 @@ static char *dfu_get_hash_algo(void)
 {
 	char *s;
 
-	s = env_get("dfu_hash_algo");
+	s = env_get(ctx_uboot, "dfu_hash_algo");
 	if (!s)
 		return NULL;
 
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 4864344853c2..daa8092383d9 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -250,7 +250,7 @@ void fastboot_data_complete(char *response)
 	fastboot_okay(NULL, response);
 	printf("\ndownloading of %d bytes finished\n", fastboot_bytes_received);
 	image_size = fastboot_bytes_received;
-	env_set_hex("filesize", image_size);
+	env_set_hex(ctx_uboot, "filesize", image_size);
 	fastboot_bytes_expected = 0;
 	fastboot_bytes_received = 0;
 }
@@ -322,7 +322,7 @@ static void oem_format(char *cmd_parameter, char *response)
 {
 	char cmdbuf[32];
 
-	if (!env_get("partitions")) {
+	if (!env_get(ctx_uboot, "partitions")) {
 		fastboot_fail("partitions not set", response);
 	} else {
 		sprintf(cmdbuf, "gpt write mmc %x $partitions",
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index e76af8ecc320..f0618c983317 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -116,7 +116,7 @@ void fastboot_boot(void)
 {
 	char *s;
 
-	s = env_get("fastboot_bootcmd");
+	s = env_get(ctx_uboot, "fastboot_bootcmd");
 	if (s) {
 		run_command(s, CMD_FLAG_ENV);
 	} else {
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 95cb4341895f..a57a1c4b5ed5 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -141,7 +141,7 @@ static void getvar_downloadsize(char *var_parameter, char *response)
 
 static void getvar_serialno(char *var_parameter, char *response)
 {
-	const char *tmp = env_get("serial#");
+	const char *tmp = env_get(ctx_uboot, "serial#");
 
 	if (tmp)
 		fastboot_okay(tmp, response);
@@ -156,7 +156,7 @@ static void getvar_version_baseband(char *var_parameter, char *response)
 
 static void getvar_product(char *var_parameter, char *response)
 {
-	const char *board = env_get("board");
+	const char *board = env_get(ctx_uboot, "board");
 
 	if (board)
 		fastboot_okay(board, response);
@@ -166,7 +166,7 @@ static void getvar_product(char *var_parameter, char *response)
 
 static void getvar_platform(char *var_parameter, char *response)
 {
-	const char *p = env_get("platform");
+	const char *p = env_get(ctx_uboot, "platform");
 
 	if (p)
 		fastboot_okay(p, response);
@@ -276,7 +276,7 @@ void fastboot_getvar(char *cmd_parameter, char *response)
 
 		snprintf(envstr, sizeof(envstr) - 1,
 			 FASTBOOT_ENV_PREFIX "%s", cmd_parameter);
-		s = env_get(envstr);
+		s = env_get(ctx_uboot, envstr);
 		if (s) {
 			fastboot_response("OKAY", response, "%s", s);
 			return;
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index b0b19c576252..02d45b20087c 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -39,7 +39,7 @@ static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
 		/* check for alias */
 		strcpy(env_alias_name, "fastboot_partition_alias_");
 		strncat(env_alias_name, name, PART_NAME_LEN);
-		aliased_part_name = env_get(env_alias_name);
+		aliased_part_name = env_get(ctx_uboot, env_alias_name);
 		if (aliased_part_name != NULL)
 			ret = part_get_info_by_name(dev_desc,
 					aliased_part_name, info);
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 98015899f21d..3cdeda42c11a 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -269,7 +269,7 @@ static int i8042_start(struct udevice *dev)
 
 	/* Init keyboard device (default US layout) */
 	keymap = KBD_US;
-	penv = env_get("keymap");
+	penv = env_get(ctx_uboot, "keymap");
 	if (penv != NULL) {
 		if (strncmp(penv, "de", 3) == 0)
 			keymap = KBD_GER;
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 6ab378b979bd..6e0c4cd9bf88 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -655,7 +655,7 @@ int input_stdio_register(struct stdio_dev *dev)
 	error = stdio_register(dev);
 #if !defined(CONFIG_SPL_BUILD) || CONFIG_IS_ENABLED(ENV_SUPPORT)
 	/* check if this is the standard input device */
-	if (!error && strcmp(env_get("stdin"), dev->name) == 0) {
+	if (!error && strcmp(env_get(ctx_uboot, "stdin"), dev->name) == 0) {
 		/* reassign the console */
 		if (OVERWRITE_CONSOLE ||
 				console_assign(stdin, dev->name))
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index 88e486e9d570..3959433dc419 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -142,10 +142,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
 	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
 	int ret;
 
-	storage_interface = env_get("storage_interface");
-	dev_part = env_get("fw_dev_part");
-	ubi_mtdpart = env_get("fw_ubi_mtdpart");
-	ubi_volume = env_get("fw_ubi_volume");
+	storage_interface = env_get(ctx_uboot, "storage_interface");
+	dev_part = env_get(ctx_uboot, "fw_dev_part");
+	ubi_mtdpart = env_get(ctx_uboot, "fw_ubi_mtdpart");
+	ubi_volume = env_get(ctx_uboot, "fw_ubi_volume");
 
 	if (storage_interface && dev_part) {
 		ret = fs_set_blk_dev(storage_interface, dev_part, FS_TYPE_ANY);
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index c59254c76e3e..a3e9d820e883 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -2374,7 +2374,7 @@ unsigned long flash_init(void)
 	/* read environment from EEPROM */
 	char s[64];
 
-	env_get_f("unlock", s, sizeof(s));
+	env_get_f(ctx_uboot, "unlock", s, sizeof(s));
 #endif
 
 #ifdef CONFIG_CFI_FLASH /* for driver model */
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 557422759831..2c178ac96cd6 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -19,7 +19,7 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts);
 static const char *get_mtdids(void)
 {
 	__maybe_unused const char *mtdparts = NULL;
-	const char *mtdids = env_get("mtdids");
+	const char *mtdids = env_get(ctx_uboot, "mtdids");
 
 	if (mtdids)
 		return mtdids;
@@ -33,7 +33,7 @@ static const char *get_mtdids(void)
 #endif
 
 	if (mtdids)
-		env_set("mtdids", mtdids);
+		env_set(ctx_uboot, "mtdids", mtdids);
 
 	return mtdids;
 }
@@ -126,8 +126,9 @@ static const char *get_mtdparts(void)
 	const char *mtdparts = NULL;
 
 	if (gd->flags & GD_FLG_ENV_READY)
-		mtdparts = env_get("mtdparts");
-	else if (env_get_f("mtdparts", tmp_parts, sizeof(tmp_parts)) != -1)
+		mtdparts = env_get(ctx_uboot, "mtdparts");
+	else if (env_get_f(ctx_uboot, "mtdparts", tmp_parts,
+			   sizeof(tmp_parts)) != -1)
 		mtdparts = tmp_parts;
 
 	if (mtdparts)
@@ -142,7 +143,7 @@ static const char *get_mtdparts(void)
 #endif
 
 	if (mtdparts)
-		env_set("mtdparts", mtdparts);
+		env_set(ctx_uboot, "mtdparts", mtdparts);
 
 	return mtdparts;
 }
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 080dbcf7db44..e6c63e60a2e7 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1162,7 +1162,7 @@ static int fec_probe(bd_t *bd, int dev_id, uint32_t base_addr,
 			sprintf(mac, "eth%daddr", fec->dev_id);
 		else
 			strcpy(mac, "ethaddr");
-		if (!env_get(mac))
+		if (!env_get(ctx_uboot, mac))
 			eth_env_set_enetaddr(mac, ethaddr);
 	}
 	return ret;
diff --git a/drivers/net/fm/b4860.c b/drivers/net/fm/b4860.c
index 5be0ad2ab3db..b67ce9d56fad 100644
--- a/drivers/net/fm/b4860.c
+++ b/drivers/net/fm/b4860.c
@@ -97,7 +97,8 @@ phy_interface_t fman_port_enet_if(enum fm_port port)
 			 * Extract hwconfig from environment since environment
 			 * is not setup yet
 			 */
-			env_get_f("hwconfig", buffer, sizeof(buffer));
+			env_get_f(ctx_uboot, "hwconfig", buffer,
+				  sizeof(buffer));
 			buf = buffer;
 
 			/* check if XFI interface enable in hwconfig for 10g */
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index 72d129475145..7d891b925082 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -36,7 +36,7 @@ void fdt_fixup_fman_firmware(void *blob)
 		return;
 
 	/* If the environment variable is not set, then exit silently */
-	p = env_get("fman_ucode");
+	p = env_get(ctx_uboot, "fman_ucode");
 	if (!p)
 		return;
 
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index 4c9dce8dc57b..6d946eb78b0b 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -428,7 +428,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	rc = fman_upload_firmware(index, &reg->fm_imem, addr);
 	if (rc)
 		return rc;
-	env_set_addr("fman_ucode", addr);
+	env_set_addr(ctx_uboot, "fman_ucode", addr);
 
 	fm_init_muram(index, &reg->muram);
 	fm_init_qmi(&reg->fm_qmi_common);
@@ -511,7 +511,7 @@ int fm_init_common(int index, struct ccsr_fman *reg)
 	rc = fman_upload_firmware(index, &reg->fm_imem, addr);
 	if (rc)
 		return rc;
-	env_set_addr("fman_ucode", addr);
+	env_set_addr(ctx_uboot, "fman_ucode", addr);
 
 	fm_init_muram(index, &reg->muram);
 	fm_init_qmi(&reg->fm_qmi_common);
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index c980ba4edb98..b88d8e6627ee 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -578,7 +578,7 @@ static unsigned long get_mc_boot_timeout_ms(void)
 {
 	unsigned long timeout_ms = CONFIG_SYS_LS_MC_BOOT_TIMEOUT_MS;
 
-	char *timeout_ms_env_var = env_get(MC_BOOT_TIMEOUT_ENV_VAR);
+	char *timeout_ms_env_var = env_get(ctx_uboot, MC_BOOT_TIMEOUT_ENV_VAR);
 
 	if (timeout_ms_env_var) {
 		timeout_ms = simple_strtoul(timeout_ms_env_var, NULL, 10);
@@ -893,7 +893,8 @@ unsigned long mc_get_dram_block_size(void)
 {
 	unsigned long dram_block_size = CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE;
 
-	char *dram_block_size_env_var = env_get(MC_MEM_SIZE_ENV_VAR);
+	char *dram_block_size_env_var = env_get(ctx_uboot,
+						MC_MEM_SIZE_ENV_VAR);
 
 	if (dram_block_size_env_var) {
 		dram_block_size = simple_strtoul(dram_block_size_env_var, NULL,
@@ -1668,7 +1669,7 @@ void mc_env_boot(void)
 	 * address info properly. Without MAC addresses, the MC code
 	 * can not properly initialize the DPC.
 	 */
-	mc_boot_env_var = env_get(MC_BOOT_ENV_VAR);
+	mc_boot_env_var = env_get(ctx_uboot, MC_BOOT_ENV_VAR);
 	if (mc_boot_env_var)
 		run_command_list(mc_boot_env_var, -1, 0);
 #endif /* CONFIG_FSL_MC_ENET */
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 73005ff94d9f..3e9855af48fe 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -60,8 +60,8 @@ static int is_broadcast(struct in_addr ip)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		netmask = env_get_ip("netmask");
-		our_ip = env_get_ip("ipaddr");
+		netmask = env_get_ip(ctx_uboot, "netmask");
+		our_ip = env_get_ip(ctx_uboot, "ipaddr");
 
 		env_changed_id = env_id;
 	}
@@ -80,11 +80,11 @@ static int refresh_settings_from_env(void)
 
 	/* update only when the environment has changed */
 	if (env_changed_id != env_id) {
-		if (env_get("ncip")) {
-			nc_ip = env_get_ip("ncip");
+		if (env_get(ctx_uboot, "ncip")) {
+			nc_ip = env_get_ip(ctx_uboot, "ncip");
 			if (!nc_ip.s_addr)
 				return -1;	/* ncip is 0.0.0.0 */
-			p = strchr(env_get("ncip"), ':');
+			p = strchr(env_get(ctx_uboot, "ncip"), ':');
 			if (p != NULL) {
 				nc_out_port = simple_strtoul(p + 1, NULL, 10);
 				nc_in_port = nc_out_port;
@@ -93,10 +93,10 @@ static int refresh_settings_from_env(void)
 			nc_ip.s_addr = ~0; /* ncip is not set, so broadcast */
 		}
 
-		p = env_get("ncoutport");
+		p = env_get(ctx_uboot, "ncoutport");
 		if (p != NULL)
 			nc_out_port = simple_strtoul(p, NULL, 10);
-		p = env_get("ncinport");
+		p = env_get(ctx_uboot, "ncinport");
 		if (p != NULL)
 			nc_in_port = simple_strtoul(p, NULL, 10);
 
diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c
index 0105fc5af1ea..6480786fa2ce 100644
--- a/drivers/net/phy/micrel_ksz90x1.c
+++ b/drivers/net/phy/micrel_ksz90x1.c
@@ -267,7 +267,7 @@ static int ksz9021_config(struct phy_device *phydev)
 	if (ret)
 		return ret;
 
-	if (env_get("disable_giga"))
+	if (env_get(ctx_uboot, "disable_giga"))
 		features &= ~(SUPPORTED_1000baseT_Half |
 		SUPPORTED_1000baseT_Full);
 	/* force master mode for 1000BaseT due to chip errata */
@@ -353,7 +353,7 @@ static int ksz9031_config(struct phy_device *phydev)
 		return ret;
 
 	/* add an option to disable the gigabit feature of this PHY */
-	if (env_get("disable_giga")) {
+	if (env_get(ctx_uboot, "disable_giga")) {
 		unsigned features;
 		unsigned bmcr;
 
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 3707ee35eb5c..aa09fcb0ffc1 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -28,8 +28,8 @@ static int sb_eth_raw_start(struct udevice *dev)
 
 	ret = sandbox_eth_raw_os_start(priv, pdata->enetaddr);
 	if (priv->local) {
-		env_set("ipaddr", "127.0.0.1");
-		env_set("serverip", "127.0.0.1");
+		env_set(ctx_uboot, "ipaddr", "127.0.0.1");
+		env_set(ctx_uboot, "serverip", "127.0.0.1");
 		net_ip = string_to_ip("127.0.0.1");
 		net_server_ip = net_ip;
 	}
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5db24f1c51d5..862452204c07 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -424,7 +424,7 @@ int pci_hose_scan(struct pci_controller *hose)
 
 	if (!gd->pcidelay_done) {
 		/* wait "pcidelay" ms (if defined)... */
-		s = env_get("pcidelay");
+		s = env_get(ctx_uboot, "pcidelay");
 		if (s) {
 			int val = simple_strtoul(s, NULL, 10);
 			for (i = 0; i < val; i++)
@@ -456,7 +456,7 @@ void pci_init(void)
 	hose_head = NULL;
 
 	/* allow env to disable pci init/enum */
-	if (env_get("pcidisable") != NULL)
+	if (env_get(ctx_uboot, "pcidisable"))
 		return;
 
 	/* now call board specific pci_init()... */
diff --git a/drivers/pci/pci_common.c b/drivers/pci/pci_common.c
index 5231b69dc9ad..007580066ca6 100644
--- a/drivers/pci/pci_common.c
+++ b/drivers/pci/pci_common.c
@@ -89,7 +89,7 @@ __weak int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev)
 		/*
 		 * Only skip configuration if "pciconfighost" is not set
 		 */
-		if (env_get("pciconfighost") == NULL)
+		if (!env_get(ctx_uboot, "pciconfighost"))
 			return 1;
 #else
 		return 1;
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 93ec9cfdb64a..6fb7ecb97ac0 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -48,7 +48,7 @@ static bool socfpga_reset_keep_enabled(void)
 	const char *env_str;
 	long val;
 
-	env_str = env_get("socfpga_legacy_reset_compat");
+	env_str = env_get(ctx_uboot, "socfpga_legacy_reset_compat");
 	if (env_str) {
 		val = simple_strtol(env_str, NULL, 0);
 		if (val == 1)
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index 532d2105e12c..8829d2a3c2d2 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -198,7 +198,7 @@ int rtc_set(struct rtc_time *tmp)
 void rtc_reset(void)
 {
 	uchar *const data = rtc_validate();
-	char const *const s = env_get("rtccal");
+	char const *const s = env_get(ctx_uboot, "rtccal");
 
 	if (!data)
 		return;
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 48cb2a2818bc..c6ca3447af19 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -681,7 +681,7 @@ int scsi_scan(bool verbose)
 
 	printf("Found %d device(s).\n", scsi_max_devs);
 #ifndef CONFIG_SPL_BUILD
-	env_set_ulong("scsidevs", scsi_max_devs);
+	env_set_ulong(ctx_uboot, "scsidevs", scsi_max_devs);
 #endif
 	return 0;
 }
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index 76d9c8a3a6df..cf4a37c9bb4a 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -526,7 +526,7 @@ int drv_usbtty_init (void)
 	int snlen;
 
 	/* Get serial number */
-	sn = env_get("serial#");
+	sn = env_get(ctx_uboot, "serial#");
 	if (!sn)
 		sn = "000000000000";
 	snlen = strlen(sn);
@@ -540,7 +540,7 @@ int drv_usbtty_init (void)
 
 	/* Decide on which type of UDC device to be.
 	 */
-	tt = env_get("usbtty");
+	tt = env_get(ctx_uboot, "usbtty");
 	if (!tt)
 		tt = "generic";
 	usbtty_init_terminal_type(strcmp(tt,"cdc_acm"));
diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index 432f312cee4c..cc6bace8f639 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -601,7 +601,7 @@ void udc_setup_ep(struct usb_device_instance *device,
 	if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
 		return;
 
-	tt = env_get("usbtty");
+	tt = env_get(ctx_uboot, "usbtty");
 	if (!tt)
 		tt = "generic";
 
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index a118283984c2..e5cb96aa7e9d 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2355,12 +2355,12 @@ static int _usb_eth_init(struct ether_priv *priv)
 	strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
 #endif
 	/* Check if the user overruled the MAC addresses */
-	if (env_get("usbnet_devaddr"))
-		strlcpy(dev_addr, env_get("usbnet_devaddr"),
+	if (env_get(ctx_uboot, "usbnet_devaddr"))
+		strlcpy(dev_addr, env_get(ctx_uboot, "usbnet_devaddr"),
 			sizeof(dev_addr));
 
-	if (env_get("usbnet_hostaddr"))
-		strlcpy(host_addr, env_get("usbnet_hostaddr"),
+	if (env_get(ctx_uboot, "usbnet_hostaddr"))
+		strlcpy(host_addr, env_get(ctx_uboot, "usbnet_hostaddr"),
 			sizeof(host_addr));
 
 	if (!is_eth_addr_valid(dev_addr)) {
@@ -2391,8 +2391,9 @@ static int _usb_eth_init(struct ether_priv *priv)
 	gadget = dev->gadget;
 	usb_gadget_connect(gadget);
 
-	if (env_get("cdc_connect_timeout"))
-		timeout = simple_strtoul(env_get("cdc_connect_timeout"),
+	if (env_get(ctx_uboot, "cdc_connect_timeout"))
+		timeout = simple_strtoul(env_get(ctx_uboot,
+						 "cdc_connect_timeout"),
 						NULL, 10) * CONFIG_SYS_HZ;
 	ts = get_timer(0);
 	while (!dev->network_started) {
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 675615513304..ec730087116c 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -725,7 +725,7 @@ static int dfu_bind(struct usb_configuration *c, struct usb_function *f)
 
 	cdev->req->context = f_dfu;
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index fc27dbe8de49..240b6c8936e5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -185,7 +185,7 @@ static int fastboot_bind(struct usb_configuration *c, struct usb_function *f)
 		f->hs_descriptors = fb_hs_function;
 	}
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c
index 1cfeabcd31ae..364da4c1d9d5 100644
--- a/drivers/usb/gadget/f_rockusb.c
+++ b/drivers/usb/gadget/f_rockusb.c
@@ -182,7 +182,7 @@ static int rockusb_bind(struct usb_configuration *c, struct usb_function *f)
 		f->hs_descriptors = rkusb_hs_function;
 	}
 
-	s = env_get("serial#");
+	s = env_get(ctx_uboot, "serial#");
 	if (s)
 		g_dnl_set_serialnumber((char *)s);
 
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index bcd1c5d47c10..ceadcc2e65c9 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -359,7 +359,7 @@ static void sdp_rx_data_complete(struct usb_ep *ep, struct usb_request *req)
 		return;
 
 #ifndef CONFIG_SPL_BUILD
-	env_set_hex("filesize", sdp->dnl_bytes);
+	env_set_hex(ctx_uboot, "filesize", sdp->dnl_bytes);
 #endif
 	printf("done\n");
 
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index ced295ef0fa4..b57d1fd6f667 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -240,7 +240,7 @@ static int ehci_fsl_init(int index, struct usb_ehci *ehci,
 				"phy_type", &len);
 #endif
 	else
-		phy_type = env_get("usb_phy_type");
+		phy_type = env_get(ctx_uboot, "usb_phy_type");
 
 	if (!phy_type) {
 #ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 6fce03363690..76d8ec4e0b2b 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -637,7 +637,7 @@ void *video_hw_init(void)
 
 	videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* deceide if it is a string */
 		if (penv[0] <= '9') {
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index e5c077e4f522..c073bd17618e 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -1861,7 +1861,7 @@ static void *video_logo(void)
 	splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
-	s = env_get("splashimage");
+	s = env_get(&ctx_boot, "splashimage");
 	if (s != NULL) {
 		ret = splash_screen_prepare();
 		if (ret < 0)
diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index 301c1f0df179..18eeba4ca1ec 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -246,7 +246,7 @@ unsigned int card_init (void)
 	tmp = 0;
 	videomode = 0x310;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* decide if it is a string */
 		if (penv[0] <= '9') {
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index a984443ef9d7..6eda807b9da3 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -814,7 +814,7 @@ void *video_hw_init(void)
 
 	videomode = CONFIG_SYS_DEFAULT_VIDEO_MODE;
 	/* get video mode via environment */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (penv) {
 		/* decide if it is a string */
 		if (penv[0] <= '9') {
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 6922a130c61a..5b03cead16cf 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -207,7 +207,7 @@ void *video_hw_init(void)
 	puts("Video: ");
 
 	/* Suck display configuration from "videomode" variable */
-	penv = env_get("videomode");
+	penv = env_get(ctx_uboot, "videomode");
 	if (!penv) {
 		puts("MXSFB: 'videomode' variable not set!\n");
 		return NULL;
diff --git a/drivers/video/videomodes.c b/drivers/video/videomodes.c
index ac25b45f8196..67130b992566 100644
--- a/drivers/video/videomodes.c
+++ b/drivers/video/videomodes.c
@@ -165,7 +165,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
 	/* first search for the environment containing the real param string */
 	s = penv;
 
-	p = env_get(s);
+	p = env_get(ctx_uboot, s);
 	if (p)
 		s = p;
 
@@ -235,7 +235,7 @@ int video_get_params (struct ctfb_res_modes *pPar, char *penv)
 int video_get_video_mode(unsigned int *xres, unsigned int *yres,
 	unsigned int *depth, unsigned int *freq, const char **options)
 {
-	char *p = env_get("video-mode");
+	char *p = env_get(ctx_uboot, "video-mode");
 	if (!p)
 		return 0;
 
-- 
2.21.0



More information about the U-Boot mailing list