[PATCH V2 03/12] board: ti: j721e: evm: Switch to using IS_ENABLED

Neha Malcom Francis n-francis at ti.com
Tue Nov 7 08:08:41 CET 2023


Hi Nishanth,

On 04/11/23 12:51, Nishanth Menon wrote:
> Switch to using IS_ENABLED() for inline function usage.
> 
> Signed-off-by: Nishanth Menon <nm at ti.com>
> ---
>   board/ti/j721e/evm.c | 83 ++++++++++++++++++++++----------------------
>   1 file changed, 42 insertions(+), 41 deletions(-)
> 
> diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
> index 8f0996c32ee6..17640ae79665 100644
> --- a/board/ti/j721e/evm.c
> +++ b/board/ti/j721e/evm.c
> @@ -300,53 +300,54 @@ static int probe_daughtercards(void)
>   		printf("Detected: %s rev %s\n", ep.name, ep.version);
>   		daughter_card_detect_flags[i] = true;
>   
> -#ifndef CONFIG_SPL_BUILD
> -		int j;
> -		/*
> -		 * Populate any MAC addresses from daughtercard into the U-Boot
> -		 * environment, starting with a card-specific offset so we can
> -		 * have multiple ext_cards contribute to the MAC pool in a well-
> -		 * defined manner.
> -		 */
> -		for (j = 0; j < mac_addr_cnt; j++) {
> -			if (!is_valid_ethaddr((u8 *)mac_addr[j]))
> -				continue;
> -
> -			eth_env_set_enetaddr_by_index("eth",
> -						      ext_cards[i].eth_offset + j,
> -						      (uchar *)mac_addr[j]);
> +		if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
> +			int j;
> +			/*
> +			 * Populate any MAC addresses from daughtercard into the U-Boot
> +			 * environment, starting with a card-specific offset so we can
> +			 * have multiple ext_cards contribute to the MAC pool in a well-
> +			 * defined manner.
> +			 */
> +			for (j = 0; j < mac_addr_cnt; j++) {
> +				if (!is_valid_ethaddr((u8 *)mac_addr[j]))
> +					continue;
> +
> +				eth_env_set_enetaddr_by_index("eth",
> +							      ext_cards[i].eth_offset + j,
> +							      (uchar *)mac_addr[j]);
> +			}
>   		}
> -#endif
>   	}
> -#ifndef CONFIG_SPL_BUILD
> -	char name_overlays[1024] = { 0 };
>   
> -	for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
> -		if (!daughter_card_detect_flags[i])
> -			continue;
> +	if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
> +		char name_overlays[1024] = { 0 };
>   
> -		/* Skip if no overlays are to be added */
> -		if (!strlen(ext_cards[i].dtbo_name))
> -			continue;
> +		for (i = 0; i < ARRAY_SIZE(ext_cards); i++) {
> +			if (!daughter_card_detect_flags[i])
> +				continue;
>   
> -		/*
> -		 * Make sure we are not running out of buffer space by checking
> -		 * if we can fit the new overlay, a trailing space to be used
> -		 * as a separator, plus the terminating zero.
> -		 */
> -		if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
> -		    sizeof(name_overlays))
> -			return -ENOMEM;
> -
> -		/* Append to our list of overlays */
> -		strcat(name_overlays, ext_cards[i].dtbo_name);
> -		strcat(name_overlays, " ");
> -	}
> +			/* Skip if no overlays are to be added */
> +			if (!strlen(ext_cards[i].dtbo_name))
> +				continue;
>   
> -	/* Apply device tree overlay(s) to the U-Boot environment, if any */
> -	if (strlen(name_overlays))
> -		return env_set("name_overlays", name_overlays);
> -#endif
> +			/*
> +			 * Make sure we are not running out of buffer space by checking
> +			 * if we can fit the new overlay, a trailing space to be used
> +			 * as a separator, plus the terminating zero.
> +			 */
> +			if (strlen(name_overlays) + strlen(ext_cards[i].dtbo_name) + 2 >
> +			    sizeof(name_overlays))
> +				return -ENOMEM;
> +
> +			/* Append to our list of overlays */
> +			strcat(name_overlays, ext_cards[i].dtbo_name);
> +			strcat(name_overlays, " ");
> +		}
> +
> +		/* Apply device tree overlay(s) to the U-Boot environment, if any */
> +		if (strlen(name_overlays))
> +			return env_set("name_overlays", name_overlays);
> +	}
>   
>   	return 0;
>   }

Reviewed-by: Neha Malcom Francis <n-francis at ti.com>

-- 
Thanking You
Neha Malcom Francis


More information about the U-Boot mailing list