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 468CEC433F5 for ; Tue, 14 Dec 2021 09:45:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0894811BB; Tue, 14 Dec 2021 10:45: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="Tm75Mnl7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6382D810EC; Tue, 14 Dec 2021 10:45:26 +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 569CB8203C for ; Tue, 14 Dec 2021 10:45:23 +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 82F2D61369; Tue, 14 Dec 2021 09:45:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CED6AC34601; Tue, 14 Dec 2021 09:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1639475120; bh=UuVx882V+NWzNAH4y4/yrtmgAGw+TpkSgs+sLkJt/vA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Tm75Mnl7OvBd9TrKtqy7voOYsrRjR6RoPaTFrpZyQT2lKGCelxJZcLNNrPFFK87lM 2U0sEHRrlVgxpSM/dPaP/e6R92GOxSXvZGikAxRmb6/3KaqX7088toGk8i50r+ZoCF jkwSarcNjZn8Pj/fvDsLGvvbmfXeATn0GgYFPFEBhIDfrKTitjgJIVUqJ6mtg+NDd2 sD6BI2Hn4eAIRRufkI/6iINsbbfx+ZgxijFHTKYIUoY2sDIXPIBT5+I3BgRyB60gFd 20+LGZvNMa/SnXPi59Ul++ajD6rAK9xekl3w1ufCDI7UmHV/IoCJOAK6s7GaeStWHg w8sX+DkoYnNBA== Date: Tue, 14 Dec 2021 10:45:15 +0100 From: Marek =?UTF-8?B?QmVow7pu?= To: Pali =?UTF-8?B?Um9ow6Fy?= Cc: Stefan Roese , u-boot@lists.denx.de, Marek =?UTF-8?B?QmVo?= =?UTF-8?B?w7pu?= Subject: Re: [PATCH u-boot-marvell v2 8/9] arm: mvebu: spl: Use IS_ENABLED() instead of #ifdef where possible Message-ID: <20211214104515.2ae03d0d@thinkpad> In-Reply-To: <20211214093600.e2sy5yrtpz7gvfna@pali> References: <20211126143738.23830-1-kabel@kernel.org> <20211126143738.23830-9-kabel@kernel.org> <20211214093600.e2sy5yrtpz7gvfna@pali> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Tue, 14 Dec 2021 10:36:00 +0100 Pali Roh=C3=A1r wrote: > On Friday 26 November 2021 15:37:37 Marek Beh=C3=BAn wrote: > > @@ -340,17 +333,17 @@ void board_init_f(ulong dummy) > > timer_init(); > > =20 > > /* 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 =3D 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 =3D ddr3_init(); > > + if (ret) { > > + debug("ddr3_init() failed: %d\n", ret); > > + hang(); > > + } > > } > > -#endif =20 >=20 > As written in comment above there is no SerDes and DDR3 support for > Armada 375 and therefore there is no serdes_phy_config() or ddr3_init() > function. So this code needs not to be compiled at all and usage of > #ifdef is correct here. #ifdefs are almost never correct in C-files, for the parts of the code they guard isn't put through syntactic analysis, and can therefore contain bugs which we are not warned about. Using if (IS_ENABLED()) almost never producess a different binary, because the code is optimized away. Marek