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 62597C433EF for ; Fri, 26 Nov 2021 14:39:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CFEE08377C; Fri, 26 Nov 2021 15:38:37 +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="EyOYGCdv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BAE3A83019; Fri, 26 Nov 2021 15:38:13 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 193CE83762 for ; Fri, 26 Nov 2021 15:37:58 +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 ams.source.kernel.org (Postfix) with ESMTPS id B9B54B827EB; Fri, 26 Nov 2021 14:37:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4435AC9305D; Fri, 26 Nov 2021 14:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637937476; bh=HqXnKy8Ia/FhgzWKeH+DqvRhOi1jipUEH5NOPBhxDPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EyOYGCdvF84FfJcpi1E9EIwmS6Z97zQaNy/Vb98SOHbs+7Ol1JNPBM/FXZOEz92fL zPYVSJi76wkeBDzoktyBFyMrlFRroeMWoQfXBQFFzxUoMziG1Lb+i2v3dA5PVPxg1V iLS6chtpP0zayG7vcq0xPnDR1ndKwmnwOkI7Yw5CqzH3TAiy5rIaMikyCMvZJd0Qtw 6cridercKbtNKEiaMrCOaDEl7CLF4axNd+af6NhmCCrf4d1pDd1ojpVMzwTV8x1S0w CkP6CgrwOIuHoYZIvABIuu0WLmX4kBOF/mPoIastlSNw8ziUNa1tpBeITs4qunH8U5 8mdD3lmeszTnQ== 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 v2 8/9] arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible Date: Fri, 26 Nov 2021 15:37:37 +0100 Message-Id: <20211126143738.23830-9-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211126143738.23830-1-kabel@kernel.org> References: <20211126143738.23830-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.37 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 --- 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 97d7aea179..7dbe8eeba3 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 SATA srcaddr (%u) in 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