From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E5A7C433EF for ; Tue, 14 Dec 2021 13:24:09 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B31F783090; Tue, 14 Dec 2021 14:23:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="iEuMsGni"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E4D9D811BB; Tue, 14 Dec 2021 14:22:56 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 86E7A83022 for ; Tue, 14 Dec 2021 14:22:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 67459614D7; Tue, 14 Dec 2021 13:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC217C34606; Tue, 14 Dec 2021 13:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639488158; bh=9RIbjWIscMkddzqx+UO3W+NjNniDyb4CO56LxYh4UtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEuMsGni5snP0hi62NntgjYfuWXUdRtSAzVrYiKAqLXvHZX4Ip1JvNom16T/CVdJl Iyv5FxXCiWXv2h44+k/oSQOs/Y/p/C6N5Y5Vfry+KPmXinDPBJw/FKutJDw/MGaeRL AZbBdh3vIxMyk/o9KDCpHlqseYYjXIBJYqvIee8WxySd/vpA/3m3wHpMnpSqQ8GHZG wJ1MmwDCBzFwJrOGsscnR6ggQh0BwRl5koAXiR7+wCxUw2alDGNfLXkEL8pRPbjLsF EJDvIcApZy4KcfgLhBsWyLmSZ4VR8kaaiS/TpAPpHtYFsWxsz6LzK/5cg2mx6zDAhl 6Id+FmUbr2CfQ== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH u-boot-marvell v3 8/9] arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible Date: Tue, 14 Dec 2021 14:22:21 +0100 Message-Id: <20211214132222.21324-9-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214132222.21324-1-kabel@kernel.org> References: <20211214132222.21324-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Marek BehĂșn 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 Reviewed-by: Stefan Roese --- arch/arm/mach-mvebu/spl.c | 43 ++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 97cb70f147..6e2a9e38ec 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -150,26 +150,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 (%u) 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 (%u) 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) { @@ -177,18 +175,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 (%u) in SATA kwbimage\n", spl_image->offset); @@ -197,17 +193,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 (%u) in kwbimage\n", @@ -340,17 +333,17 @@ void board_init_f(ulong dummy) timer_init(); /* Armada 375 does not support SerDes and DDR3 init yet */ -#if !defined(CONFIG_ARMADA_375) - /* First init the serdes PHY's */ - serdes_phy_config(); - - /* Setup DDR */ - ret = ddr3_init(); - if (ret) { - debug("ddr3_init() failed: %d\n", ret); - hang(); + if (!IS_ENABLED(CONFIG_ARMADA_375)) { + /* First init the serdes PHY's */ + serdes_phy_config(); + + /* Setup DDR */ + ret = ddr3_init(); + if (ret) { + debug("ddr3_init() failed: %d\n", ret); + hang(); + } } -#endif /* Initialize Auto Voltage Scaling */ mv_avs_init(); -- 2.32.0