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 X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 783E1C433F5 for ; Tue, 7 Sep 2021 11:41:23 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 90E21604E9 for ; Tue, 7 Sep 2021 11:41:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90E21604E9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 808B483264; Tue, 7 Sep 2021 13:41:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=collabora.com 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 24EB982CDE; Tue, 7 Sep 2021 13:41:19 +0200 (CEST) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) (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 CD4EF8327C for ; Tue, 7 Sep 2021 13:41:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=arnaud.ferraris@collabora.com Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: aferraris) with ESMTPSA id 0428E1F424EB Subject: Re: [PATCH 1/2] board: sunxi: enable status LED early To: Andre Przywara Cc: u-boot@lists.denx.de, Jagan Teki , Samuel Holland , Maxime Ripard References: <20210906205753.176175-1-arnaud.ferraris@collabora.com> <20210906205753.176175-2-arnaud.ferraris@collabora.com> <20210907004644.290710e8@slackpad.fritz.box> From: Arnaud Ferraris Message-ID: Date: Tue, 7 Sep 2021 13:41:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210907004644.290710e8@slackpad.fritz.box> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Hi André, Thanks for your feedback! Le 07/09/2021 à 01:46, Andre Przywara a écrit : > On Mon, 6 Sep 2021 22:57:52 +0200 > Arnaud Ferraris wrote: > > Hi Arnaud, > >> diff --git a/board/sunxi/board.c b/board/sunxi/board.c >> index 1a46100e40..6e0bf5fbf9 100644 >> --- a/board/sunxi/board.c >> +++ b/board/sunxi/board.c >> @@ -46,6 +46,9 @@ >> #include >> #include >> #include >> +#if defined(CONFIG_LED_STATUS) && defined(CONFIG_SPL_DRIVERS_MISC) >> +#include > > status_led.h already guards for CONFIG_LED_STATUS, so you can just > unconditionally include this here, no #ifdefs needed. Understood, will do. > >> +#endif >> >> #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) >> /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ >> @@ -672,6 +675,10 @@ void sunxi_board_init(void) >> { >> int power_failed = 0; >> >> +#if defined(CONFIG_LED_STATUS) && defined(CONFIG_SPL_DRIVERS_MISC) > > Unfortunately status_led.h doesn't define a dummy prototype for this, > so we need the #ifdef CONFIG_LED_STATUS. But I don't think you need > CONFIG_SPL_DRIVERS_MISC here. If that should only trigger in the SPL, use: > > if (IS_ENABLED(CONFIG_SPL_BUILD)) > status_led_init(); > Actually the status_led driver isn't compiled into SPL unless CONFIG_SPL_DRIVERS_MISC is set, resulting in a link error if that's not the case. We should therefore check for both CONFIG_LED_STATUS and CONFIG_SPL_DRIVERS_MISC to prevent build errors both at compile time and link time. The alternative would be: #ifdef CONFIG_LED_STATUS if (IS_ENABLED(CONFIG_SPL_DRIVERS_MISC)) status_led_init(); #endif Which is more or less the same, except that it relies on the compiler optimizing out this function call if CONFIG_SPL_DRIVERS_MISC isn't defined. That assumption feels less safe to me, but overall I'm fine with both implementations. Please also note the whole sunxi_board_init() function itself is already inside a #ifdef CONFIG_SPL_BUILD block. Cheers, Arnaud > Cheers, > Andre > >> + status_led_init(); >> +#endif >> + >> #ifdef CONFIG_SY8106A_POWER >> power_failed = sy8106a_set_vout1(CONFIG_SY8106A_VOUT1_VOLT); >> #endif