Re: [PATCH v3 4/5] board_init_r(): use static calls

Simon Glass
2025-01-04T19:40:46Z

Hi Caleb,

On Sat, 4 Jan 2025 at 14:54, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> Hi Jerome,
>
> On 03/01/2025 12:13, Jerome Forissier wrote:
> > Replace the init_sequence_r function array by direct calls.
> > bloat-o-meter stats before/after on u-boot.bin for configuration
> > xilinx_zynqmp_kria_defconfig are the following:
> >
> > - With LTO:
> > add/remove: 87/128 grow/shrink: 8/23 up/down: 19743/-20923 (-1180)
> > Total: Before=1067882, After=1066702, chg -0.11%
> >
> > - Without LTO:
> > add/remove: 0/23 grow/shrink: 2/0 up/down: 795/-1112 (-317)
> > Total: Before=1119494, After=1119177, chg -0.03%
> >
> > Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
> > ---
>
> [...]
>
> > + INITCALL(stdio_add_devices);
> > + INITCALL(jumptable_init);
> > + CONFIG_IS_ENABLED(API, (INITCALL(api_init);))
> > + INITCALL(console_init_r); /* fully init console as a device */
> > + CONFIG_IS_ENABLED(DISPLAY_BOARDINFO_LATE,
> > + (INITCALL(console_announce_r);
> > + INITCALL(show_board_info);))
>
> Not that the array was extremely readable, but I think this is
> significantly worse. Particularly as my IDE will no longer grey-out
> sections for config options which are disabled.
>
> I would honestly rather still see pre-processor #if's here, or at least
> something better than this semicolon-in-macro stuff.

Hmmm I think you have a point.

I was actually thinking about having something like

INIT_CALL_CONFIG(DISPLAY_BOARD_INFO_LATE, console_announce_r)

i.e. a macro to combine the two things and the semicolon. But I
decided it is really no better than this patch so didn't mention it.

So another option would be to keep the #ifs as you say, with
everything else about this patch left alone. I have the same issue
with the IDE (I suspect some clever integration could be written to
fix it). But I have changed my mind and think #ifs are better, in this
case.

Regards,
Simon