Re: [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()

Stefan Roese via U-Boot <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <cfca4027-3c8a-41d6-a8c5-602994df4822__47611.4949256711$1786350561$gmane$org@mailbox.org>
On 8/4/26 01:17, Marek Vasut wrote:
> Simplify the code, replace env_get_f() with env_get_yesno(). The
> env_get_yesno() internally calls env_get() which may fall back to
> env_get_f() if the environment access is not initialized yet.
> 
> Signed-off-by: Marek Vasut <[email protected]>
> ---
> Cc: Stefan Roese <[email protected]>
> Cc: Tom Rini <[email protected]>
> Cc: [email protected]

Reviewed-by: Stefan Roese <[email protected]>

@Tom, could you please pull this directly. AFAIU, we did not create
the cfi-flash custodian repo in the new infrastructure. I don't see a
real need for it, as CFI flash is just very rarely used nowadays.

Thanks,
Stefan

> ---
>   drivers/mtd/cfi_flash.c | 9 +--------
>   1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index e50502824ac..cf52abf1554 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -2407,13 +2407,6 @@ unsigned long flash_init(void)
>   	unsigned long size = 0;
>   	int i;
>   
> -#ifdef CONFIG_SYS_FLASH_PROTECTION
> -	/* read environment from EEPROM */
> -	char s[64];
> -
> -	env_get_f("unlock", s, sizeof(s));
> -#endif
> -
>   #ifdef CONFIG_CFI_FLASH /* for driver model */
>   	cfi_flash_init_dm();
>   #endif
> @@ -2438,7 +2431,7 @@ unsigned long flash_init(void)
>   #endif /* CONFIG_SYS_FLASH_QUIET_TEST */
>   		}
>   #ifdef CONFIG_SYS_FLASH_PROTECTION
> -		else if (strcmp(s, "yes") == 0) {
> +		else if (env_get_yesno("unlock")) {
>   			/*
>   			 * Only the U-Boot image and it's environment
>   			 * is protected, all other sectors are
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.