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 BBF8EC433EF for ; Mon, 18 Jul 2022 09:53:17 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2BC8083C10; Mon, 18 Jul 2022 11:53:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinet.cat Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 0B4E783E16; Mon, 18 Jul 2022 11:53:08 +0200 (CEST) Received: from mx1.tinet.cat (mx1.dipta.cat [195.76.233.59]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 51C0D839F6 for ; Mon, 18 Jul 2022 11:53:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=tinet.cat Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xdrudis@tinet.cat X-ASG-Debug-ID: 1658137983-12aaf258c39017f0001-4l7tJC Received: from smtp01.tinet.cat (smtp01.tinet.cat [195.77.216.131]) by mx1.tinet.cat with ESMTP id U9jsatmRcAIvfFrZ; Mon, 18 Jul 2022 11:53:03 +0200 (CEST) X-Barracuda-Envelope-From: xdrudis@tinet.cat X-Barracuda-Effective-Source-IP: smtp01.tinet.cat[195.77.216.131] X-Barracuda-Apparent-Source-IP: 195.77.216.131 Received: from begut (99.red-79-152-185.dynamicip.rima-tde.net [79.152.185.99]) by smtp01.tinet.cat (Postfix) with ESMTPSA id 3082A605E0C3; Mon, 18 Jul 2022 11:53:03 +0200 (CEST) Date: Mon, 18 Jul 2022 11:53:01 +0200 From: Xavier Drudis Ferran To: Quentin Schulz Cc: sjg@chromium.org, philipp.tomsich@vrull.eu, kever.yang@rock-chips.com, alpernebiyasak@gmail.com, email2tema@gmail.com, jagan@amarulasolutions.com, u-boot@lists.denx.de, Quentin Schulz Subject: Re: [SPAM] [PATCH v2 2/2] rockchip: rk3399: fix incorrect ifdef check on SPL_GPIO Message-ID: <20220718095301.GE1824@begut> X-ASG-Orig-Subj: Re: [SPAM] [PATCH v2 2/2] rockchip: rk3399: fix incorrect ifdef check on SPL_GPIO References: <20220715150949.952853-1-foss+uboot@0leil.net> <20220715150949.952853-2-foss+uboot@0leil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220715150949.952853-2-foss+uboot@0leil.net> User-Agent: Mutt/1.10.1 (2018-07-13) X-Barracuda-Connect: smtp01.tinet.cat[195.77.216.131] X-Barracuda-Start-Time: 1658137983 X-Barracuda-URL: https://webmail.tinet.cat:443/cgi-mod/mark.cgi X-Barracuda-Scan-Msg-Size: 2504 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.6760 1.0000 1.1945 X-Barracuda-Spam-Score: 1.19 X-Barracuda-Spam-Status: No, SCORE=1.19 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=6.0 KILL_LEVEL=8.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.99460 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean El Fri, Jul 15, 2022 at 05:09:49PM +0200, Quentin Schulz deia: > From: Quentin Schulz > > The check to perform is on CONFIG_SPL_GPIO and not SPL_GPIO. > Because this was never compiled in, it missed an include of cru.h that > was not detected before. Let's include it too. > > Also switch to IS_ENABLED ifdef and in-code check. > Thank you. That helps when CONGIF_SPL_GPIO is enabled. But in case CONFIG_SPL_GPIO is disabled... > Fixes: 07586ee4322a ("rockchip: rk3399: Support common spl_board_init") > Cc: Quentin Schulz > Signed-off-by: Quentin Schulz > --- > > v2: > - use IS_ENABLED checks, > > arch/arm/mach-rockchip/rk3399/rk3399.c | 45 ++++++++++++++------------ > 1 file changed, 24 insertions(+), 21 deletions(-) > > diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c > index 920da22307..db8a6cb83a 100644 > --- a/arch/arm/mach-rockchip/rk3399/rk3399.c > +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c > @@ -221,7 +221,9 @@ void spl_perform_fixups(struct spl_image_info *spl_image) > "u-boot,spl-boot-device", boot_ofpath); > } > > -#if defined(SPL_GPIO) > +#if IS_ENABLED(CONFIG_SPL_GPIO) > + > +#include then (if CONFIG_SPL_GPIO is disabled...) the include is not in effect, but the call to > static void rk3399_force_power_on_reset(void) > { > ofnode node; the #endif for that #if is somewhere over here. > @@ -253,27 +255,28 @@ void spl_board_init(void) > { > led_setup(); > > -#if defined(SPL_GPIO) > - struct rockchip_cru *cru = rockchip_get_cru(); > + if (IS_ENABLED(CONFIG_SPL_GPIO)) { > + struct rockchip_cru *cru = rockchip_get_cru(); > [...] > + /* [...] > + */ > + if (cru->glb_rst_st != 0) This gives me a compilation error (rock-pi-4, CONFIG_SPL_GPIO disabled), because of the missing include defining rockchip_cru (and glb_rst_st as a member of it) > + rk3399_force_power_on_reset(); This gives a warning, because the function declaration is #ifdefed out. So we could leave the include outside the #if defined(SPL_GPIO) and add an inline dummy function in #else, or we could change the if (IS_ENABLED(CONFIG_SPL_GPIO)) to #if (IS_ENABLED(CONFIG_SPL_GPIO)) I think the first is preferred in U-Boot, but not sure if that might somehow make SPL bigger or something. I don't think so.