[PATCH u-boot-marvell v4 8/9] arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible

Pali Rohár pali at kernel.org
Fri Jan 14 14:31:44 CET 2022


From: Marek Behún <marek.behun at nic.cz>

Use the preferred
  if (IS_ENABLED(X))
instead of
  #ifdef X
where possible.

There are still places where this is not possible or is more complicated
to convert in this file. Leave those be for now.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
Reviewed-by: Stefan Roese <sr at denx.de>
---
 arch/arm/mach-mvebu/spl.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 103049b49b89..5006f9e80bb0 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -149,26 +149,24 @@ int spl_parse_board_header(struct spl_image_info *spl_image,
 		return -EINVAL;
 	}
 
-#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
-	if (bootdev->boot_device == BOOT_DEVICE_SPI &&
+	if (IS_ENABLED(CONFIG_SPL_SPI_FLASH_SUPPORT) &&
+	    bootdev->boot_device == BOOT_DEVICE_SPI &&
 	    mhdr->blockid != IBR_HDR_SPI_ID) {
 		printf("ERROR: Wrong blockid (0x%x) in SPI kwbimage\n",
 		       mhdr->blockid);
 		return -EINVAL;
 	}
-#endif
 
-#ifdef CONFIG_SPL_SATA
-	if (bootdev->boot_device == BOOT_DEVICE_SATA &&
+	if (IS_ENABLED(CONFIG_SPL_SATA) &&
+	    bootdev->boot_device == BOOT_DEVICE_SATA &&
 	    mhdr->blockid != IBR_HDR_SATA_ID) {
 		printf("ERROR: Wrong blockid (0x%x) in SATA kwbimage\n",
 		       mhdr->blockid);
 		return -EINVAL;
 	}
-#endif
 
-#ifdef CONFIG_SPL_MMC
-	if ((bootdev->boot_device == BOOT_DEVICE_MMC1 ||
+	if (IS_ENABLED(CONFIG_SPL_MMC) &&
+	    (bootdev->boot_device == BOOT_DEVICE_MMC1 ||
 	     bootdev->boot_device == BOOT_DEVICE_MMC2 ||
 	     bootdev->boot_device == BOOT_DEVICE_MMC2_2) &&
 	    mhdr->blockid != IBR_HDR_SDIO_ID) {
@@ -176,18 +174,16 @@ int spl_parse_board_header(struct spl_image_info *spl_image,
 		       mhdr->blockid);
 		return -EINVAL;
 	}
-#endif
 
 	spl_image->offset = mhdr->srcaddr;
 
-#ifdef CONFIG_SPL_SATA
 	/*
 	 * For SATA srcaddr is specified in number of sectors.
 	 * The main header is must be stored at sector number 1.
 	 * This expects that sector size is 512 bytes and recalculates
 	 * data offset to bytes relative to the main header.
 	 */
-	if (mhdr->blockid == IBR_HDR_SATA_ID) {
+	if (IS_ENABLED(CONFIG_SPL_SATA) && mhdr->blockid == IBR_HDR_SATA_ID) {
 		if (spl_image->offset < 1) {
 			printf("ERROR: Wrong srcaddr (0x%08x) in SATA kwbimage\n",
 			       spl_image->offset);
@@ -196,17 +192,14 @@ int spl_parse_board_header(struct spl_image_info *spl_image,
 		spl_image->offset -= 1;
 		spl_image->offset *= 512;
 	}
-#endif
 
-#ifdef CONFIG_SPL_MMC
 	/*
 	 * For SDIO (eMMC) srcaddr is specified in number of sectors.
 	 * This expects that sector size is 512 bytes and recalculates
 	 * data offset to bytes.
 	 */
-	if (mhdr->blockid == IBR_HDR_SDIO_ID)
+	if (IS_ENABLED(CONFIG_SPL_MMC) && mhdr->blockid == IBR_HDR_SDIO_ID)
 		spl_image->offset *= 512;
-#endif
 
 	if (spl_image->offset % 4 != 0) {
 		printf("ERROR: Wrong srcaddr (0x%08x) in kwbimage\n",
-- 
2.20.1



More information about the U-Boot mailing list