[PATCH v1 2/2] image: Explicitly declare do_bdinfo()

Simon Glass sjg at chromium.org
Mon Nov 8 16:58:30 CET 2021


Hi Andy,

On Mon, 8 Nov 2021 at 01:38, Andy Shevchenko <andy.shevchenko at gmail.com> wrote:
>
> On Sun, Nov 7, 2021 at 6:43 PM Simon Glass <sjg at chromium.org> wrote:
> > On Sat, 6 Nov 2021 at 01:59, Andy Shevchenko <andy.shevchenko at gmail.com> wrote:
> > > On Saturday, November 6, 2021, Simon Glass <sjg at chromium.org> wrote:
> > >> On Fri, 5 Nov 2021 at 14:10, Andy Shevchenko
> > >> <andriy.shevchenko at linux.intel.com> wrote:
> > >> >
> > >> > Compiler is not happy:
> > >> >
> > >> > common/image-board.c: In function ‘boot_get_kbd’:
> > >> > common/image-board.c:902:17: warning: implicit declaration of function ‘do_bdinfo’ [-Wimplicit-function-declaration]
> > >> >   902 |                 do_bdinfo(NULL, 0, 0, NULL);
> > >> >       |                 ^~~~~~~~~
> > >> >
> > >> > Move the forward declaration to a header.
> > >> >
> > >> > Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> > >> > ---
> > >> >  common/image.c | 5 -----
> > >> >  include/init.h | 5 +++++
> > >> >  2 files changed, 5 insertions(+), 5 deletions(-)
> > >> >
> > >> > diff --git a/common/image.c b/common/image.c
> > >> > index 3fa60b582796..57bf86278149 100644
> > >> > --- a/common/image.c
> > >> > +++ b/common/image.c
> > >> > @@ -29,11 +29,6 @@
> > >> >  #include <linux/errno.h>
> > >> >  #include <asm/io.h>
> > >> >
> > >> > -#ifdef CONFIG_CMD_BDI
> > >> > -extern int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc,
> > >> > -                    char *const argv[]);
> > >> > -#endif
> > >> > -
> > >> >  DECLARE_GLOBAL_DATA_PTR;
> > >> >
> > >> >  /* Set this if we have less than 4 MB of malloc() space */
> > >> > diff --git a/include/init.h b/include/init.h
> > >> > index c781789e367e..37ca9905414f 100644
> > >> > --- a/include/init.h
> > >> > +++ b/include/init.h
> > >> > @@ -332,6 +332,11 @@ void bdinfo_print_mhz(const char *name, unsigned long hz);
> > >> >  /* Show arch-specific information for the 'bd' command */
> > >> >  void arch_print_bdinfo(void);
> > >> >
> > >> > +#if defined(CONFIG_CMD_BDI)
> > >> > +extern int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc,
> > >> > +                    char *const argv[]);
> > >> > +#endif
> > >>
> > >> Can we drop the #if..#endif?
> > >
> > >
> > > No, AFAICT, but you can do it later somehow. Currently this fixes a warning.
> >
> > I mean drop the #if line and the #endif line.
>
> And we will have a dangling prototype when !CONFIG_CMD_BDI ?
> Is it okay?

Do you mean one that isn't used? Yes that is fine.

>
> >  We try to avoid this
> > sort that things like IS_ENABLED() work.

Regards,
Simon


More information about the U-Boot mailing list