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 6AF33ECAAD8 for ; Wed, 21 Sep 2022 13:49:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8B8898497B; Wed, 21 Sep 2022 15:49:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="LGAVeANF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 99FF984BB3; Wed, 21 Sep 2022 15:49:24 +0200 (CEST) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8D83D845C1 for ; Wed, 21 Sep 2022 15:49:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x82d.google.com with SMTP id cj27so4075198qtb.7 for ; Wed, 21 Sep 2022 06:49:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=f3LtJLXdzqrbIx3q0SqUBBrgI6HwWesDMkFSGfePqWI=; b=LGAVeANF1/a8DEXr+1/nlZnzWL6uil1bDxE5D2wloUwIsuIe5jeGYVMa6WTu8keqef 4v0TY2ncvqFbcEQ4RM1h6zKxDTvwn20fStK3g6ZPeIWL7tTI1HHuVpZxzDKjR9RytEvc tTpXBU5J5QL6BMZZBlT+PumxRyZSt2PC2V4iQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=f3LtJLXdzqrbIx3q0SqUBBrgI6HwWesDMkFSGfePqWI=; b=MH0jzgjFsX0NaBRTUfRT/Zn4+c/F1m3gHUkON+90l/ZU3qTUAy6VnI+4PNWF/ZRcAo cLXUUa7PiwlgXSSrm2l4VMOrFWqdfxVX0tBCFSraRNVIwyR9sFTJEynhJlqXaZMJnjTg 1AvwLD6K/ggT1+yt0MF7bcqCJ+RnV/rKyMX6cwvak/Zc3WKbGiBcgi3qLMOqqkb9FWuM wjhvJOlwEQjhknIvARuk6hYtXb81ATzG4eCo5Ey2seo47zIWuzbjbw3JE3VYMuvCvTzo hsFxC0XkXk0FcmZJApxRgLPpQfRGQderOmxQvBRTpRQrMOaopYFzxp5bWhcYQLJHxC+c EDEA== X-Gm-Message-State: ACrzQf37X3H6UOMbvFNAMqN1wprpBDPcHTPpTNg33Jj9Xo1JBfdDyJ8h Vhgf/0k+jxORqSag9Ci22ucN0g== X-Google-Smtp-Source: AMsMyM5w1QQl3h+XeWA+IJ1lU0MuY3mmBJzHxPAap3m3Uzux9DZyIONfo6xNimVSQLfErUPD1Pz4dg== X-Received: by 2002:a05:622a:60d:b0:343:808:f55c with SMTP id z13-20020a05622a060d00b003430808f55cmr23267198qta.438.1663768160289; Wed, 21 Sep 2022 06:49:20 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-7442-0e7b-49ca-6995.res6.spectrum.com. [2603:6081:7b00:6400:7442:e7b:49ca:6995]) by smtp.gmail.com with ESMTPSA id k16-20020a05620a415000b006cbe3be300esm2033355qko.12.2022.09.21.06.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Sep 2022 06:49:19 -0700 (PDT) Date: Wed, 21 Sep 2022 09:49:17 -0400 From: Tom Rini To: Marek Vasut Cc: Simon Glass , U-Boot Mailing List Subject: Re: [RFC][PATCH] spl: Turn spl_board_init() into weak symbol Message-ID: <20220921134917.GP3044094@bill-the-cat> References: <20220919195204.106370-1-marex@denx.de> <20220920190452.GM3044094@bill-the-cat> <48aa7432-3d97-5aa3-6649-bffc53bfd941@denx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NqNl6FRZtoRUn5bW" Content-Disposition: inline In-Reply-To: <48aa7432-3d97-5aa3-6649-bffc53bfd941@denx.de> X-Clacks-Overhead: GNU Terry Pratchett 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 --NqNl6FRZtoRUn5bW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 21, 2022 at 02:56:29AM +0200, Marek Vasut wrote: > On 9/20/22 21:04, Tom Rini wrote: > > On Tue, Sep 20, 2022 at 05:56:50PM +0200, Marek Vasut wrote: > > > On 9/20/22 17:43, Simon Glass wrote: > > > > On Mon, 19 Sept 2022 at 21:52, Marek Vasut wrote: > > > > >=20 > > > > > Make spl_board_init() a weak symbol and get rid of Kconfig symbols > > > > > and ifdeffery guarding this function. Since the spl_board_init() = is > > > > > now a weak symbol, boards can either use the default implementati= on > > > > > which is empty and gets inlined with zero text increase, or overr= ide > > > > > the implementation with their own as needed. > > > > >=20 > > > > > Signed-off-by: Marek Vasut > > > > > --- > > > > > Cc: Simon Glass > > > > > Cc: Tom Rini > > > > > --- > > > >=20 > > > > Reviewed-by: Simon Glass > > > >=20 > > > > but please add a nice comment to spl_board_init() indicating what it > > > > is for and when it is called. > > >=20 > > > Actually, I wonder, should we start turning all the other symbols whi= ch are > > > now protected by Kconfig symbol (the #ifdef CONFIG_FOO) into weak sym= bols > > > without any need for Kconfig symbol guard instead as well? > >=20 > > I'm not sure this is a good idea. An #ifdef in and of itself is not a > > bad thing, and now we add a dummy function on another set of platforms. >=20 > The empty dummy function is inlined, so that itself does not increase text > size. No, it's 4/8 bytes, weak functions don't get inlined. It's not a big deal nor a deal breaker, but it's not free. > > What is true is that a lot of SPL_foo symbols should be select'd rather > > than asked because it's not an option. You enable it, it works, you > > disable it, your platform doesn't work. If it's just the #if, we could > > rewrite the line as > > if (CONFIG_IS_ENABLED(BOARD_INIT)) > > spl_board_init(); > >=20 > > as the prototype shouldn't be guarded anyhow. >=20 > The third option is what is implemented in this patch -- the board port > developer implements the weak function override and it always works, beca= use > it is no longer selectable. It's similar, yes. I think the biggest hang-up for me is that while the Kconfig help text isn't the best documentation for what is needed when adding SPL to a board, it's better than code-only comments. I know Simon asked for a comment on the weak function, but how about starting doc/develop/spl.rst and make at least this new content kernel-doc format so it can be included there? --=20 Tom --NqNl6FRZtoRUn5bW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmMrFlMACgkQFHw5/5Y0 tyxcqgwAtCHuV3Jyctp9DlTfgwO/rQiEqh4s/M6KH+R5/m2NTk7jY3jYWy1aR7wu wAUBTt2nTynVIsxBqAsEP+7s7Cjs7jFpQmxmP3O032qt48fbj1a5BDlbX+h2y+ZJ D05Fw3Zm1oRUCDBfg6N+Fj3WsauqJP+CwAh+x2eRCgW4wcXX2l/6cp7ht52WVkCH HSlJb47/t5HqoGCbLTeGKX0Pa3SWLvhuKgV+Z0KkRxgA7IuOc9ZI/2VWvLDgQ7z4 7ussWIWZeIOmCuNQr8JSOPkEt0hizZB3xP71pHeJwXY9fsa9+U2lMb19i2ddpAuG 9Pg/MIgR23qxwKbPVfV9sLYw1dIsdI6HKkgGSqYmtShpcLt9IZHC1ttD/DO3y2T0 w6uiZavxf0Ykwv5E9N8ZuRvC/CA3g76JVLIUQ4HLPicN8loF5oQvYI4PGg0dtzGb MiLkBTatSonSi3bTv3InG66tdWg8c6TtcjOUAhu82cpbGcgiDk2Y46hw2zqLS/+L GE3bMLmT =J57s -----END PGP SIGNATURE----- --NqNl6FRZtoRUn5bW--