public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Tom Rini <trini@konsulko.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Sinthu Raja <sinthu.raja@ti.com>,
	Manorit Chawdhry <m-chawdhry@ti.com>, Reid Tonking <reidt@ti.com>,
	Neha Malcom Francis <n-francis@ti.com>, Andrew Davis <afd@ti.com>,
	Simon Glass <sjg@chromium.org>,
	Robert Nelson <robertcnelson@gmail.com>,
	Jason Kridner <jkridner@beagleboard.org>,
	Nishanth Menon <nm@ti.com>, <u-boot@lists.denx.de>
Subject: [PATCH V2 03/12] board: ti: j721e: evm: Switch to using IS_ENABLED
Date: Sat, 4 Nov 2023 02:21:41 -0500	[thread overview]
Message-ID: <20231104072150.3339-4-nm@ti.com> (raw)
In-Reply-To: <20231104072150.3339-1-nm@ti.com>

Switch to using IS_ENABLED() for inline function usage.

Signed-off-by: Nishanth Menon <nm@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;
 }
-- 
2.37.2


  parent reply	other threads:[~2023-11-04  7:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04  7:21 [PATCH V2 00/12] board: ti: j721e: cleanup Nishanth Menon
2023-11-04  7:21 ` [PATCH V2 01/12] board: ti: j721e: evm: Drop unused headers Nishanth Menon
2023-11-07  7:02   ` Neha Malcom Francis
2023-11-22 20:49   ` Tom Rini
2023-11-04  7:21 ` [PATCH V2 02/12] board: ti: j721e: evm: Drop board check for ESM Nishanth Menon
2023-11-07  7:06   ` Neha Malcom Francis
2023-11-04  7:21 ` Nishanth Menon [this message]
2023-11-07  7:08   ` [PATCH V2 03/12] board: ti: j721e: evm: Switch to using IS_ENABLED Neha Malcom Francis
2023-11-04  7:21 ` [PATCH V2 04/12] board: ti: j721e: j721e.env: Add explicit boot_targets Nishanth Menon
2023-11-07  7:09   ` Neha Malcom Francis
2023-11-04  7:21 ` [PATCH V2 05/12] configs: j721e_evm_a72_defconfig: Switch to bootstd Nishanth Menon
2023-11-07  7:09   ` Neha Malcom Francis
2023-11-04  7:21 ` [PATCH V2 06/12] arm: mach-k3: Kconfig: Introduce a symbol to indicate J7200 Nishanth Menon
2023-11-06 16:45   ` Andrew Davis
2023-11-06 16:50     ` Nishanth Menon
2023-11-04  7:21 ` [PATCH V2 07/12] board: ti: j721e: Select SOC_K3_J721E_J7200 for J7200evm Nishanth Menon
2023-11-04  7:21 ` [PATCH V2 08/12] arm: mach-k3: arm64-mmu: Refactor to be independent of board Nishanth Menon
2023-11-06 16:54   ` Andrew Davis
2023-11-04  7:21 ` [PATCH V2 09/12] arm: mach-k3: j721e: Improve support for UDA FS Nishanth Menon
2023-11-04  7:21 ` [PATCH V2 10/12] configs: j7200: Remove HBMC_AM654 config Nishanth Menon
2023-11-07  7:11   ` Neha Malcom Francis
2023-11-04  7:21 ` [PATCH V2 11/12] configs: j7200_evm_a72_defconfig: Switch to bootstd Nishanth Menon
2023-11-07  7:12   ` Neha Malcom Francis
2023-11-04  7:21 ` [PATCH V2 12/12] doc: board: ti: j721e_evm: Use board relative path for include directives Nishanth Menon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231104072150.3339-4-nm@ti.com \
    --to=nm@ti.com \
    --cc=afd@ti.com \
    --cc=jkridner@beagleboard.org \
    --cc=m-chawdhry@ti.com \
    --cc=n-francis@ti.com \
    --cc=reidt@ti.com \
    --cc=robertcnelson@gmail.com \
    --cc=sinthu.raja@ti.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox