All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()
@ 2026-08-03 23:17 Marek Vasut via U-Boot
  2026-08-10  8:28 ` Stefan Roese via U-Boot
  2026-08-10 20:53 ` Tom Rini
  0 siblings, 2 replies; 5+ messages in thread
From: Marek Vasut via U-Boot @ 2026-08-03 23:17 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Stefan Roese, Tom Rini

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 <marek.vasut+renesas@mailbox.org>
---
Cc: Stefan Roese <stefan.roese@mailbox.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.u-boot-project.org
---
 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
-- 
2.53.0


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

* Re: [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()
  2026-08-03 23:17 [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno() Marek Vasut via U-Boot
@ 2026-08-10  8:28 ` Stefan Roese via U-Boot
  2026-08-10 10:01   ` Marek Vasut via U-Boot
  2026-08-10 18:18   ` Tom Rini
  2026-08-10 20:53 ` Tom Rini
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Roese via U-Boot @ 2026-08-10  8:28 UTC (permalink / raw)
  To: Marek Vasut, u-boot; +Cc: Tom Rini

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 <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Stefan Roese <stefan.roese@mailbox.org>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.u-boot-project.org

Reviewed-by: Stefan Roese <stefan.roese@mailbox.org>

@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


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

* Re: [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()
  2026-08-10  8:28 ` Stefan Roese via U-Boot
@ 2026-08-10 10:01   ` Marek Vasut via U-Boot
  2026-08-10 18:18   ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Marek Vasut via U-Boot @ 2026-08-10 10:01 UTC (permalink / raw)
  To: Stefan Roese, Marek Vasut, u-boot; +Cc: Tom Rini

On 8/10/26 10:28 AM, Stefan Roese wrote:
> 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 <marek.vasut+renesas@mailbox.org>
>> ---
>> Cc: Stefan Roese <stefan.roese@mailbox.org>
>> Cc: Tom Rini <trini@konsulko.com>
>> Cc: u-boot@lists.u-boot-project.org
> 
> Reviewed-by: Stefan Roese <stefan.roese@mailbox.org>
> 
> @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.
HyperFlash is also CFI NOR flash, and that is used at least by Renesas, 
TI and ST, so it isn't quite as dead as it seems.

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

* Re: [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()
  2026-08-10  8:28 ` Stefan Roese via U-Boot
  2026-08-10 10:01   ` Marek Vasut via U-Boot
@ 2026-08-10 18:18   ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2026-08-10 18:18 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Marek Vasut, u-boot

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

On Mon, Aug 10, 2026 at 10:28:57AM +0200, Stefan Roese wrote:
> 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 <marek.vasut+renesas@mailbox.org>
> > ---
> > Cc: Stefan Roese <stefan.roese@mailbox.org>
> > Cc: Tom Rini <trini@konsulko.com>
> > Cc: u-boot@lists.u-boot-project.org
> 
> Reviewed-by: Stefan Roese <stefan.roese@mailbox.org>
> 
> @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.

OK, I can do that.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* Re: [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno()
  2026-08-03 23:17 [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno() Marek Vasut via U-Boot
  2026-08-10  8:28 ` Stefan Roese via U-Boot
@ 2026-08-10 20:53 ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2026-08-10 20:53 UTC (permalink / raw)
  To: Marek Vasut via U-Boot; +Cc: Marek Vasut, Stefan Roese

On Tue, 04 Aug 2026 01:17:31 +0200, Marek Vasut via U-Boot 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.
> 
> 

Applied to u-boot/main, thanks!

[1/1] mtd: cfi: Replace env_get_f() with env_get_yesno()
      commit: c882fc0fe40e184e75035909aea2f3109cbe78bb
-- 
Tom



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

end of thread, other threads:[~2026-08-10 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 23:17 [PATCH] mtd: cfi: Replace env_get_f() with env_get_yesno() Marek Vasut via U-Boot
2026-08-10  8:28 ` Stefan Roese via U-Boot
2026-08-10 10:01   ` Marek Vasut via U-Boot
2026-08-10 18:18   ` Tom Rini
2026-08-10 20:53 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.