All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Julien Stephan <jstephan@baylibre.com>
Cc: u-boot@lists.u-boot-project.org, Simon Glass <sjg@chromium.org>,
	GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	Anatolij Gustschin <ag.dev.uboot@gmail.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Quentin Schulz <quentin.schulz@cherry.de>,
	dlechner@baylibre.com
Subject: Re: [PATCH 2/2] video: fix build with CONFIG_VIDEO && !CONFIG_VIDEO_LOGO
Date: Wed, 2 Sep 2026 08:26:10 -0600	[thread overview]
Message-ID: <20260902142610.GG1145425@bill-the-cat> (raw)
In-Reply-To: <CAEHHSvbPWGishhJ13jDUBWC8TBH0wMqyVS7qBMEZu90ug-ntrw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4315 bytes --]

On Wed, Sep 02, 2026 at 10:48:38AM +0200, Julien Stephan wrote:
> Le mar. 1 sept. 2026 à 18:42, Tom Rini <trini@konsulko.com> a écrit :
> >
> > On Tue, Sep 01, 2026 at 10:52:43AM +0200, Julien Stephan wrote:
> > > Building with CONFIG_VIDEO enabled but CONFIG_VIDEO_LOGO disabled fails
> > > at link time:
> > >
> > >   video-uclass.o: in function `video_get_u_boot_logo':
> > >   video-uclass.c:593: undefined reference to `__splash_u_boot_logo_begin'
> > >
> > > The __splash_u_boot_logo_begin/_end symbols are provided by
> > > u_boot_logo.bmp.o, which is only built when CONFIG_VIDEO_LOGO is set:
> > >
> > >   obj-$(CONFIG_VIDEO_LOGO) += u_boot_logo.bmp.o
> > >
> > > video_get_u_boot_logo() and show_splash() reference those symbols
> > > unconditionally, so with the logo disabled the reference is left
> > > dangling. show_splash() alone would be dead-code eliminated (it is
> > > static and only reached under a CONFIG_IS_ENABLED(VIDEO_LOGO) guard),
> > > but video_get_u_boot_logo() is an exported function and is always
> > > emitted.
> > >
> > > Guard the splash helpers and their symbol references with
> > > CONFIG_IS_ENABLED(VIDEO_LOGO), and provide a static inline
> > > video_get_u_boot_logo() stub returning NULL for the disabled case in
> > > video.h. Callers already handle a NULL logo pointer (e.g.
> > > bootflow_menu.c), so no caller changes are needed.
> > >
> > > Reproduce with any board that enables VIDEO without VIDEO_LOGO or
> > > enabling SPLASH_SCREEN (it disables automatically VIDEO_LOGO).
> > >
> > > Fixes: 0d3890188d6b ("video: Add function to obtain the U-Boot logo")
> > > Signed-off-by: Julien Stephan <jstephan@baylibre.com>
> > > ---
> > >  drivers/video/video-uclass.c | 7 +++++--
> > >  include/video.h              | 9 ++++++++-
> > >  2 files changed, 13 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
> > > index de161054d52..4c959a57619 100644
> > > --- a/drivers/video/video-uclass.c
> > > +++ b/drivers/video/video-uclass.c
> > > @@ -579,6 +579,7 @@ int video_get_ysize(struct udevice *dev)
> > >       return priv->ysize;
> > >  }
> > >
> > > +#if CONFIG_IS_ENABLED(VIDEO_LOGO)
> > >  #define SPLASH_DECL(_name) \
> > >       extern u8 __splash_ ## _name ## _begin[]; \
> > >       extern u8 __splash_ ## _name ## _end[]
> > > @@ -598,6 +599,7 @@ static int show_splash(struct udevice *dev)
> > >
> > >       return video_bmp_display(dev, map_to_sysmem(data), -4, 4, true);
> > >  }
> > > +#endif
> > >
> > >  int video_default_font_height(struct udevice *dev)
> > >  {
> > > @@ -716,14 +718,15 @@ static int video_post_probe(struct udevice *dev)
> > >               return ret;
> > >       }
> > >
> > > -     if (CONFIG_IS_ENABLED(VIDEO_LOGO) &&
> > > -         !CONFIG_IS_ENABLED(SPLASH_SCREEN) && !plat->hide_logo) {
> > > +#if CONFIG_IS_ENABLED(VIDEO_LOGO)
> > > +     if (!CONFIG_IS_ENABLED(SPLASH_SCREEN) && !plat->hide_logo) {
> > >               ret = show_splash(dev);
> > >               if (ret) {
> > >                       log_debug("Cannot show splash screen\n");
> > >                       return ret;
> > >               }
> > >       }
> > > +#endif
> >
> > Is this hunk really needed? I can see getting here as part of debugging
> > the problem, but before the change it should evaluate to 'if (0 && ...)'
> > and be link-time eliminated.
> >
> 
> Hi Tom,
> 
> Yes it is needed since I moved show_splash() inside the #if
> CONFIG_IS_ENABLED(VIDEO_LOGO) guard above.
> I can go back to the runtime check, and keep show_splash() outside of
> the guard, but I'll have to use video_get_u_boot_logo() instead of
> relying on SPLASH_START(u_boot_logo);
> 
> What do you prefer?

Ah, I see now, that wasn't clear to me from the context. Looking at 1/2
and then 2/2 now, can we just remove show_splash() and call
video_bmp_display directly? That means not guarding SPLASH_START but
again it should optimize away. I do complain about how if
(CONFIG_IS_ENABLED(...)) isn't always great, but I think mixing that and
#if together just reads awkwardly too. So if we can't restructure the
code to keep if (CONFIG_IS_ENABLED(...)) then we should #if the whole
block there. Thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2026-09-02 14:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260901-fix-build-with-config-video-but-config-video-logo-disabled-v1-0-9dc80d307790@baylibre.com>
2026-09-01  9:16 ` [PATCH 0/2] video: fix build with VIDEO && !VIDEO_LOGO Julien Stephan
     [not found] ` <20260901-fix-build-with-config-video-but-config-video-logo-disabled-v1-1-9dc80d307790@baylibre.com>
2026-09-01  9:16   ` [PATCH 1/2] video: propagate show_splash() return value Julien Stephan
     [not found] ` <20260901-fix-build-with-config-video-but-config-video-logo-disabled-v1-2-9dc80d307790@baylibre.com>
2026-09-01  9:16   ` [PATCH 2/2] video: fix build with CONFIG_VIDEO && !CONFIG_VIDEO_LOGO Julien Stephan
2026-09-01 16:42   ` Tom Rini
2026-09-02  8:48     ` Julien Stephan
2026-09-02 14:26       ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260902142610.GG1145425@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=ag.dev.uboot@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jstephan@baylibre.com \
    --cc=quentin.schulz@cherry.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.u-boot-project.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.