diff mbox

[U-Boot,2/2] config_cmd_default.h: wrap each definition in "ifndef"

Message ID 1420291209-20249-3-git-send-email-abrodkin@synopsys.com
State Deferred
Delegated to: Masahiro Yamada
Headers show

Commit Message

Alexey Brodkin Jan. 3, 2015, 1:20 p.m. UTC
Now with switch to Kconfig it's possible to select commands via
menuconfig or defconfigs.

Moreover some commands are enabled by default in both
"config_cmd_default.h" as a legacy way and in "common/Kconfig".

And on attempt to build U-Boot following warnings are printed for
definitions made in both:
--->---
In file included from include/configs/arcangel4.h:45:0,
                 from include/config.h:4,
                 from include/common.h:18,
                 from examples/standalone/stubs.c:1:
include/config_cmd_default.h:20:0: warning: "CONFIG_CMD_BDI" redefined
[enabled by default]
 #define CONFIG_CMD_BDI  /* bdinfo   */
 ^
In file included from ././include/linux/kconfig.h:4:0,
                 from <command-line>:0:
include/generated/autoconf.h:10:0: note: this is the location of the
previous definition
 #define CONFIG_CMD_BDI 1
 ^
--->---

An obvious fix is to wrap all definitions in "config_cmd_default.h"
since we still have to keep it util we're done with complete switch to
Kconfig.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Tom Rini <trini@ti.com>
---
 include/config_cmd_default.h | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

Comments

Alexey Brodkin Jan. 9, 2015, 9:21 p.m. UTC | #1
Hi all,

On Sat, 2015-01-03 at 16:20 +0300, Alexey Brodkin wrote:
> Now with switch to Kconfig it's possible to select commands via
> menuconfig or defconfigs.
> 
> Moreover some commands are enabled by default in both
> "config_cmd_default.h" as a legacy way and in "common/Kconfig".
> 
> And on attempt to build U-Boot following warnings are printed for
> definitions made in both:
> --->---
> In file included from include/configs/arcangel4.h:45:0,
>                  from include/config.h:4,
>                  from include/common.h:18,
>                  from examples/standalone/stubs.c:1:
> include/config_cmd_default.h:20:0: warning: "CONFIG_CMD_BDI" redefined
> [enabled by default]
>  #define CONFIG_CMD_BDI  /* bdinfo   */
>  ^
> In file included from ././include/linux/kconfig.h:4:0,
>                  from <command-line>:0:
> include/generated/autoconf.h:10:0: note: this is the location of the
> previous definition
>  #define CONFIG_CMD_BDI 1
>  ^
> --->---
> 
> An obvious fix is to wrap all definitions in "config_cmd_default.h"
> since we still have to keep it util we're done with complete switch to
> Kconfig.
> 
> Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> Cc: Tom Rini <trini@ti.com>
> ---
>  include/config_cmd_default.h | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
> 
> diff --git a/include/config_cmd_default.h b/include/config_cmd_default.h
> index 73c9544..b33f21b 100644
> --- a/include/config_cmd_default.h
> +++ b/include/config_cmd_default.h
> @@ -16,28 +16,70 @@
>   * hardware, not fully tested, etc.).
>   */
>  
> +#ifndef CONFIG_CMD_BDI
>  #define CONFIG_CMD_BDI		/* bdinfo			*/
> +#endif
> +#ifndef CONFIG_CMD_BOOTD
>  #define CONFIG_CMD_BOOTD	/* bootd			*/
> +#endif
> +#ifndef CONFIG_CMD_CONSOLE
>  #define CONFIG_CMD_CONSOLE	/* coninfo			*/
> +#endif
> +#ifndef CONFIG_CMD_ECHO
>  #define CONFIG_CMD_ECHO		/* echo arguments		*/
> +#endif
> +#ifndef CONFIG_CMD_EDITENV
>  #define CONFIG_CMD_EDITENV	/* editenv			*/
> +#endif
> +#ifndef CONFIG_CMD_FPGA
>  #define CONFIG_CMD_FPGA		/* FPGA configuration Support	*/
> +#endif
> +#ifndef CONFIG_CMD_IMI
>  #define CONFIG_CMD_IMI		/* iminfo			*/
> +#endif
> +#ifndef CONFIG_CMD_ITEST
>  #define CONFIG_CMD_ITEST	/* Integer (and string) test	*/
> +#endif
>  #ifndef CONFIG_SYS_NO_FLASH
> +#ifndef CONFIG_CMD_FLASH
>  #define CONFIG_CMD_FLASH	/* flinfo, erase, protect	*/
> +#endif
> +#ifndef CONFIG_CMD_IMLS
>  #define CONFIG_CMD_IMLS		/* List all found images	*/
>  #endif
> +#endif /* CONFIG_SYS_NO_FLASH */
> +#ifndef CONFIG_CMD_LOADB
>  #define CONFIG_CMD_LOADB	/* loadb			*/
> +#endif
> +#ifndef CONFIG_CMD_LOADS
>  #define CONFIG_CMD_LOADS	/* loads			*/
> +#endif
> +#ifndef CONFIG_CMD_MEMORY
>  #define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop */
> +#endif
> +#ifndef CONFIG_CMD_MISC
>  #define CONFIG_CMD_MISC		/* Misc functions like sleep etc*/
> +#endif
> +#ifndef CONFIG_CMD_NET
>  #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
> +#endif
> +#ifndef CONFIG_CMD_NFS
>  #define CONFIG_CMD_NFS		/* NFS support			*/
> +#endif
> +#ifndef CONFIG_CMD_RUN
>  #define CONFIG_CMD_RUN		/* run command in env variable	*/
> +#endif
> +#ifndef CONFIG_CMD_SAVEENV
>  #define CONFIG_CMD_SAVEENV	/* saveenv			*/
> +#endif
> +#ifndef CONFIG_CMD_SETGETDCR
>  #define CONFIG_CMD_SETGETDCR	/* DCR support on 4xx		*/
> +#endif
> +#ifndef CONFIG_CMD_SOURCE
>  #define CONFIG_CMD_SOURCE	/* "source" command support	*/
> +#endif
> +#ifndef CONFIG_CMD_XIMG
>  #define CONFIG_CMD_XIMG		/* Load part of Multi Image	*/
> +#endif
>  
>  #endif	/* _CONFIG_CMD_DEFAULT_H */

Looks like the first patch from this series is not yet ready for a
prime-time (look at discussion here
http://patchwork.ozlabs.org/patch/425106/) I still think this particular
patch makes sense because users may select command via Kconfig now and
once one of the commands listed in "config_cmd_default.h" is selected
inevitably warnings will appear in build console.

So if there're no comment and objections I'll re-send this patch
separately.

-Alexey
Masahiro Yamada Jan. 14, 2015, 4:12 a.m. UTC | #2
On Fri, 9 Jan 2015 21:21:20 +0000
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:

> Hi all,
> 
> On Sat, 2015-01-03 at 16:20 +0300, Alexey Brodkin wrote:
> > Now with switch to Kconfig it's possible to select commands via
> > menuconfig or defconfigs.
> > 
> > Moreover some commands are enabled by default in both
> > "config_cmd_default.h" as a legacy way and in "common/Kconfig".
> > 
> > And on attempt to build U-Boot following warnings are printed for
> > definitions made in both:
> > --->---
> > In file included from include/configs/arcangel4.h:45:0,
> >                  from include/config.h:4,
> >                  from include/common.h:18,
> >                  from examples/standalone/stubs.c:1:
> > include/config_cmd_default.h:20:0: warning: "CONFIG_CMD_BDI" redefined
> > [enabled by default]
> >  #define CONFIG_CMD_BDI  /* bdinfo   */
> >  ^
> > In file included from ././include/linux/kconfig.h:4:0,
> >                  from <command-line>:0:
> > include/generated/autoconf.h:10:0: note: this is the location of the
> > previous definition
> >  #define CONFIG_CMD_BDI 1
> >  ^
> > --->---
> > 
> > An obvious fix is to wrap all definitions in "config_cmd_default.h"
> > since we still have to keep it util we're done with complete switch to
> > Kconfig.
> > 
> > Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
> > Cc: Tom Rini <trini@ti.com>
> > ---
> >  include/config_cmd_default.h | 42 ++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 42 insertions(+)
> > 
> > diff --git a/include/config_cmd_default.h b/include/config_cmd_default.h
> > index 73c9544..b33f21b 100644
> > --- a/include/config_cmd_default.h
> > +++ b/include/config_cmd_default.h
> > @@ -16,28 +16,70 @@
> >   * hardware, not fully tested, etc.).
> >   */
> >  
> > +#ifndef CONFIG_CMD_BDI
> >  #define CONFIG_CMD_BDI		/* bdinfo			*/
> > +#endif
> > +#ifndef CONFIG_CMD_BOOTD
> >  #define CONFIG_CMD_BOOTD	/* bootd			*/
> > +#endif
> > +#ifndef CONFIG_CMD_CONSOLE
> >  #define CONFIG_CMD_CONSOLE	/* coninfo			*/
> > +#endif
> > +#ifndef CONFIG_CMD_ECHO
> >  #define CONFIG_CMD_ECHO		/* echo arguments		*/
> > +#endif
> > +#ifndef CONFIG_CMD_EDITENV
> >  #define CONFIG_CMD_EDITENV	/* editenv			*/
> > +#endif
> > +#ifndef CONFIG_CMD_FPGA
> >  #define CONFIG_CMD_FPGA		/* FPGA configuration Support	*/
> > +#endif
> > +#ifndef CONFIG_CMD_IMI
> >  #define CONFIG_CMD_IMI		/* iminfo			*/
> > +#endif
> > +#ifndef CONFIG_CMD_ITEST
> >  #define CONFIG_CMD_ITEST	/* Integer (and string) test	*/
> > +#endif
> >  #ifndef CONFIG_SYS_NO_FLASH
> > +#ifndef CONFIG_CMD_FLASH
> >  #define CONFIG_CMD_FLASH	/* flinfo, erase, protect	*/
> > +#endif
> > +#ifndef CONFIG_CMD_IMLS
> >  #define CONFIG_CMD_IMLS		/* List all found images	*/
> >  #endif
> > +#endif /* CONFIG_SYS_NO_FLASH */
> > +#ifndef CONFIG_CMD_LOADB
> >  #define CONFIG_CMD_LOADB	/* loadb			*/
> > +#endif
> > +#ifndef CONFIG_CMD_LOADS
> >  #define CONFIG_CMD_LOADS	/* loads			*/
> > +#endif
> > +#ifndef CONFIG_CMD_MEMORY
> >  #define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop */
> > +#endif
> > +#ifndef CONFIG_CMD_MISC
> >  #define CONFIG_CMD_MISC		/* Misc functions like sleep etc*/
> > +#endif
> > +#ifndef CONFIG_CMD_NET
> >  #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
> > +#endif
> > +#ifndef CONFIG_CMD_NFS
> >  #define CONFIG_CMD_NFS		/* NFS support			*/
> > +#endif
> > +#ifndef CONFIG_CMD_RUN
> >  #define CONFIG_CMD_RUN		/* run command in env variable	*/
> > +#endif
> > +#ifndef CONFIG_CMD_SAVEENV
> >  #define CONFIG_CMD_SAVEENV	/* saveenv			*/
> > +#endif
> > +#ifndef CONFIG_CMD_SETGETDCR
> >  #define CONFIG_CMD_SETGETDCR	/* DCR support on 4xx		*/
> > +#endif
> > +#ifndef CONFIG_CMD_SOURCE
> >  #define CONFIG_CMD_SOURCE	/* "source" command support	*/
> > +#endif
> > +#ifndef CONFIG_CMD_XIMG
> >  #define CONFIG_CMD_XIMG		/* Load part of Multi Image	*/
> > +#endif
> >  
> >  #endif	/* _CONFIG_CMD_DEFAULT_H */
> 
> Looks like the first patch from this series is not yet ready for a
> prime-time (look at discussion here
> http://patchwork.ozlabs.org/patch/425106/) I still think this particular
> patch makes sense because users may select command via Kconfig now and
> once one of the commands listed in "config_cmd_default.h" is selected
> inevitably warnings will appear in build console.
> 
> So if there're no comment and objections I'll re-send this patch
> separately.
> 
> -Alexey


I think this change is harmless, but

#define CONFIG_CMD_BDI   1

is simpler than

#ifndef CONFIG_CMD_BDI
#define CONFIG_CMD_BDI
#endif


Maybe?



Best Regards
Masahiro Yamada
Alexey Brodkin Jan. 14, 2015, 6:23 a.m. UTC | #3
Hi Masahiro-san,

On Wed, 2015-01-14 at 13:12 +0900, Masahiro Yamada wrote:
> On Fri, 9 Jan 2015 21:21:20 +0000
> Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:
> I think this change is harmless, but
> 
> #define CONFIG_CMD_BDI   1
> 
> is simpler than
> 
> #ifndef CONFIG_CMD_BDI
> #define CONFIG_CMD_BDI
> #endif
> 
> 
> Maybe?

I don't think so :)

Please look at Wolfgang's comment here
http://lists.denx.de/pipermail/u-boot/2014-February/172494.html

--->8---
Please do not define values for logical variables [please check
everywhere].
--->8---

-Alexey
Masahiro Yamada Jan. 14, 2015, 6:42 a.m. UTC | #4
Hi Alexey,



On Wed, 14 Jan 2015 06:23:55 +0000
Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:

> Hi Masahiro-san,
> 
> On Wed, 2015-01-14 at 13:12 +0900, Masahiro Yamada wrote:
> > On Fri, 9 Jan 2015 21:21:20 +0000
> > Alexey Brodkin <Alexey.Brodkin@synopsys.com> wrote:
> > I think this change is harmless, but
> > 
> > #define CONFIG_CMD_BDI   1
> > 
> > is simpler than
> > 
> > #ifndef CONFIG_CMD_BDI
> > #define CONFIG_CMD_BDI
> > #endif
> > 
> > 
> > Maybe?
> 
> I don't think so :)
> 
> Please look at Wolfgang's comment here
> http://lists.denx.de/pipermail/u-boot/2014-February/172494.html
> 
> --->8---
> Please do not define values for logical variables [please check
> everywhere].
> --->8---


Uh, OK.

Yours will do.



Best Regards
Masahiro Yamada
diff mbox

Patch

diff --git a/include/config_cmd_default.h b/include/config_cmd_default.h
index 73c9544..b33f21b 100644
--- a/include/config_cmd_default.h
+++ b/include/config_cmd_default.h
@@ -16,28 +16,70 @@ 
  * hardware, not fully tested, etc.).
  */
 
+#ifndef CONFIG_CMD_BDI
 #define CONFIG_CMD_BDI		/* bdinfo			*/
+#endif
+#ifndef CONFIG_CMD_BOOTD
 #define CONFIG_CMD_BOOTD	/* bootd			*/
+#endif
+#ifndef CONFIG_CMD_CONSOLE
 #define CONFIG_CMD_CONSOLE	/* coninfo			*/
+#endif
+#ifndef CONFIG_CMD_ECHO
 #define CONFIG_CMD_ECHO		/* echo arguments		*/
+#endif
+#ifndef CONFIG_CMD_EDITENV
 #define CONFIG_CMD_EDITENV	/* editenv			*/
+#endif
+#ifndef CONFIG_CMD_FPGA
 #define CONFIG_CMD_FPGA		/* FPGA configuration Support	*/
+#endif
+#ifndef CONFIG_CMD_IMI
 #define CONFIG_CMD_IMI		/* iminfo			*/
+#endif
+#ifndef CONFIG_CMD_ITEST
 #define CONFIG_CMD_ITEST	/* Integer (and string) test	*/
+#endif
 #ifndef CONFIG_SYS_NO_FLASH
+#ifndef CONFIG_CMD_FLASH
 #define CONFIG_CMD_FLASH	/* flinfo, erase, protect	*/
+#endif
+#ifndef CONFIG_CMD_IMLS
 #define CONFIG_CMD_IMLS		/* List all found images	*/
 #endif
+#endif /* CONFIG_SYS_NO_FLASH */
+#ifndef CONFIG_CMD_LOADB
 #define CONFIG_CMD_LOADB	/* loadb			*/
+#endif
+#ifndef CONFIG_CMD_LOADS
 #define CONFIG_CMD_LOADS	/* loads			*/
+#endif
+#ifndef CONFIG_CMD_MEMORY
 #define CONFIG_CMD_MEMORY	/* md mm nm mw cp cmp crc base loop */
+#endif
+#ifndef CONFIG_CMD_MISC
 #define CONFIG_CMD_MISC		/* Misc functions like sleep etc*/
+#endif
+#ifndef CONFIG_CMD_NET
 #define CONFIG_CMD_NET		/* bootp, tftpboot, rarpboot	*/
+#endif
+#ifndef CONFIG_CMD_NFS
 #define CONFIG_CMD_NFS		/* NFS support			*/
+#endif
+#ifndef CONFIG_CMD_RUN
 #define CONFIG_CMD_RUN		/* run command in env variable	*/
+#endif
+#ifndef CONFIG_CMD_SAVEENV
 #define CONFIG_CMD_SAVEENV	/* saveenv			*/
+#endif
+#ifndef CONFIG_CMD_SETGETDCR
 #define CONFIG_CMD_SETGETDCR	/* DCR support on 4xx		*/
+#endif
+#ifndef CONFIG_CMD_SOURCE
 #define CONFIG_CMD_SOURCE	/* "source" command support	*/
+#endif
+#ifndef CONFIG_CMD_XIMG
 #define CONFIG_CMD_XIMG		/* Load part of Multi Image	*/
+#endif
 
 #endif	/* _CONFIG_CMD_DEFAULT_H */