[Uboot-stm32] [PATCH 08/11] board: stm32mp1: use IS_ENABLED to prevent ifdef in env functions

Patrice CHOTARD patrice.chotard at st.com
Thu Aug 13 11:53:40 CEST 2020


On 8/13/20 9:24 AM, Patrice CHOTARD wrote:
> Hi Patrick
>
> On 7/31/20 4:31 PM, Patrick Delaunay wrote:
>> Use IS_ENABLED to prevent ifdef in env functions:
>> - env_get_location
>> - env_ext4_get_intf
>> - mmc_get_env_dev
>>
>> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
>> ---
>>
>>  board/st/stm32mp1/stm32mp1.c | 36 +++++++++++++++++-------------------
>>  1 file changed, 17 insertions(+), 19 deletions(-)

Applied on u-boot-stm/master

Thanks


>> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
>> index a9705baa24..08d18b6da8 100644
>> --- a/board/st/stm32mp1/stm32mp1.c
>> +++ b/board/st/stm32mp1/stm32mp1.c
>> @@ -785,31 +785,33 @@ enum env_location env_get_location(enum env_operation op, int prio)
>>  		return ENVL_UNKNOWN;
>>  
>>  	switch (bootmode & TAMP_BOOT_DEVICE_MASK) {
>> -#if CONFIG_IS_ENABLED(ENV_IS_IN_MMC)
>>  	case BOOT_FLASH_SD:
>>  	case BOOT_FLASH_EMMC:
>> -		return ENVL_MMC;
>> -#endif
>> -#if CONFIG_IS_ENABLED(ENV_IS_IN_EXT4)
>> -	case BOOT_FLASH_SD:
>> -	case BOOT_FLASH_EMMC:
>> -		return ENVL_EXT4;
>> -#endif
>> -#if CONFIG_IS_ENABLED(ENV_IS_IN_UBI)
>> +		if (CONFIG_IS_ENABLED(ENV_IS_IN_MMC))
>> +			return ENVL_MMC;
>> +		else if (CONFIG_IS_ENABLED(ENV_IS_IN_EXT4))
>> +			return ENVL_EXT4;
>> +		else
>> +			return ENVL_NOWHERE;
>> +
>>  	case BOOT_FLASH_NAND:
>>  	case BOOT_FLASH_SPINAND:
>> -		return ENVL_UBI;
>> -#endif
>> -#if CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH)
>> +		if (CONFIG_IS_ENABLED(ENV_IS_IN_UBI))
>> +			return ENVL_UBI;
>> +		else
>> +			return ENVL_NOWHERE;
>> +
>>  	case BOOT_FLASH_NOR:
>> -		return ENVL_SPI_FLASH;
>> -#endif
>> +		if (CONFIG_IS_ENABLED(ENV_IS_IN_SPI_FLASH))
>> +			return ENVL_SPI_FLASH;
>> +		else
>> +			return ENVL_NOWHERE;
>> +
>>  	default:
>>  		return ENVL_NOWHERE;
>>  	}
>>  }
>>  
>> -#if defined(CONFIG_ENV_IS_IN_EXT4)
>>  const char *env_ext4_get_intf(void)
>>  {
>>  	u32 bootmode = get_bootmode();
>> @@ -830,16 +832,12 @@ const char *env_ext4_get_dev_part(void)
>>  
>>  	return dev_part[(bootmode & TAMP_BOOT_INSTANCE_MASK) - 1];
>>  }
>> -#endif
>> -
>> -#if defined(CONFIG_ENV_IS_IN_MMC)
>>  int mmc_get_env_dev(void)
>>  {
>>  	u32 bootmode = get_bootmode();
>>  
>>  	return (bootmode & TAMP_BOOT_INSTANCE_MASK) - 1;
>>  }
>> -#endif
>>  
>>  #if defined(CONFIG_OF_BOARD_SETUP)
>>  int ft_board_setup(void *blob, struct bd_info *bd)
> Reviewed-by: Patrice Chotard <patrice.chotard at st.com>
>
> Thanks
>
> Patrice
> _______________________________________________
> Uboot-stm32 mailing list
> Uboot-stm32 at st-md-mailman.stormreply.com
> https://st-md-mailman.stormreply.com/mailman/listinfo/uboot-stm32


More information about the U-Boot mailing list