[PATCH 1/2] env: mmc: Clean up macro usage

Tom Rini trini at konsulko.com
Wed Feb 8 16:22:45 CET 2023


On Wed, Feb 08, 2023 at 12:32:43PM +0100, Marek Vasut wrote:
> Consistently use 'if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID))' instead of
> mix of ifdef and IS_ENABLED. This deals with xPL variants of the config
> option and trims ifdeffery.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> Cc: Tom Rini <trini at konsulko.com>
> ---
>  env/mmc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/env/mmc.c b/env/mmc.c
> index 5b01f657a7a..b34a8dd982e 100644
> --- a/env/mmc.c
> +++ b/env/mmc.c
> @@ -73,8 +73,7 @@ static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
>  
>  		if (str && !strncmp((const char *)info.name, str, sizeof(info.name)))
>  			break;
> -#ifdef CONFIG_PARTITION_TYPE_GUID
> -		if (!str) {
> +		if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID) && !str) {
>  			const efi_guid_t env_guid = PARTITION_U_BOOT_ENVIRONMENT;
>  			efi_guid_t type_guid;
>  
> @@ -82,7 +81,6 @@ static inline int mmc_offset_try_partition(const char *str, int copy, s64 *val)
>  			if (!memcmp(&env_guid, &type_guid, sizeof(efi_guid_t)))
>  				break;
>  		}
> -#endif
>  	}
>  
>  	/* round up to info.blksz */
> @@ -121,7 +119,7 @@ static inline s64 mmc_offset(int copy)
>  	}
>  
>  	/* try the GPT partition with "U-Boot ENV" TYPE GUID */
> -	if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) {
> +	if (CONFIG_IS_ENABLED(PARTITION_TYPE_GUID)) {
>  		err = mmc_offset_try_partition(NULL, copy, &val);
>  		if (!err)
>  			return val;

I don't think this is right as we don't have xPL options for
PARTITION_TYPE_GUID and do want to have the same environment location
used in all stages (aside from when xPL says it only has no where for
the env), yes?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230208/0a8bb9e9/attachment.sig>


More information about the U-Boot mailing list