Skip to contentSkip to conversation

image: Fix typo in boot_get_kbd()

PATCH Superseded Andy Shevchenko 3 participants 8 messages Nov 5, 2021 – Nov 8, 2021

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 image: Fix typo in boot_get_kbd()

After the commit 4ed37abc49c2 ("image: Remove ifdefs around image_setup_linux() el at"):

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: error: expected ‘)’ before ‘do_bdinfo’

  902 |                 do_bdinfo(NULL, 0, 0, NULL);
      |                 ^~~~~~~~~

common/image-board.c:901:12: note: to match this ‘(’
901 | if (IS_ENABLED(CONFIG_CMD_BDI)
| ^
common/image-board.c:906:1: error: expected expression before ‘}’ token
906 | }

      | ^
common/image-board.c:906:1: warning: control reaches end of non-void function [-Wreturn-type]
  906 | }
      | ^

Fix obvious typo.

Fixes 4ed37abc49c2 ("image: Remove ifdefs around image_setup_linux() el at")

Revert "image: Partially revert too aggressive ifdeferry removal"

This reverts commit 84631af9d0454ff8252c1aebb1e9c232b8077692.

---
 common/image-board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/image-board.c +1 -1
index e7660352e96a..ddf30c67302e 100644
@@ -898,7 +898,7 @@ int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd)
 	debug("## kernel board info at 0x%08lx\n", (ulong)*kbd);
 
 #if defined(DEBUG)
-	if (IS_ENABLED(CONFIG_CMD_BDI)
+	if (IS_ENABLED(CONFIG_CMD_BDI))
 		do_bdinfo(NULL, 0, 0, NULL);
 #endif
 
Signature · 1 line
2.33.0
#1 lore raw

PATCH 2/2 image: Explicitly declare do_bdinfo()

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.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +5 -0
index c781789e367e..37ca9905414f 100644
@@ -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
+
 #endif	/* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
Signature · 1 line
2.33.0
#2 lore raw

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

Hi Andy,

Quoted 37 lines · Andy Shevchenko

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.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +0 -0
index c781789e367e..37ca9905414f 100644

include/init.h void bdinfo_print_mhz(const char *name, unsigned long hz); · line 338

Quoted 7 lines
include/init.h +4 -0
@@ -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?

Quoted 7 lines
include/init.h +1 -1
+
 #endif /* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
--

2.33.0

Regards,
SImon

#3 lore raw

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

Quoted 46 lines · Simon Glass

Hi Andy,

Quoted 5 lines · Andy Shevchenko

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]

include/init.h void bdinfo_print_mhz(const char *name, unsigned

Quoted 32 lines
  902 |                 do_bdinfo(NULL, 0, 0, NULL);
      |                 ^~~~~~~~~

Move the forward declaration to a header.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +0 -0
index c781789e367e..37ca9905414f 100644
@@ -332,6 +332,11 @@ void bdinfo_print_mhz(const char *name, unsigned

long hz);

Quoted 3 lines
include/init.h +0 -0
 /* Show arch-specific information for the 'bd' command */
 void arch_print_bdinfo(void);
 
Quoted 6 lines

include/init.h void bdinfo_print_mhz(const char *name, unsigned long hz); · line 338

Quoted 4 lines
include/init.h +4 -0
+#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.

Quoted 12 lines
Quoted 8 lines
include/init.h +1 -1
+
 #endif /* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
--

2.33.0

Regards,
SImon

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

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

Hi Andy,

Quoted 57 lines · Andy Shevchenko
Quoted 45 lines · Simon Glass

Hi Andy,

Quoted 40 lines · Andy Shevchenko

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.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +0 -0
index c781789e367e..37ca9905414f 100644
@@ -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);
 
Quoted 6 lines

include/init.h void bdinfo_print_mhz(const char *name, unsigned long hz); · line 338

Quoted 4 lines
include/init.h +4 -0
+#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?

Quoted 1 line

No, AFAICT, but you can do it later somehow. Currently this fixes a warning.

I mean drop the #if line and the #endif line. We try to avoid this sort that things like IS_ENABLED() work.

Also please drop the 'extern'.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
include/init.h +1 -1
+
 #endif /* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
--

2.33.0

Regards,
SImon

#5 lore raw

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

Quoted 52 lines · Simon Glass
Quoted 51 lines · Andy Shevchenko
Quoted 48 lines · Simon Glass
Quoted 37 lines · Andy Shevchenko

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.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +0 -0
index c781789e367e..37ca9905414f 100644

include/init.h void bdinfo_print_mhz(const char *name, unsigned long hz); · line 338

Quoted 7 lines
include/init.h +4 -0
@@ -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?

Quoted 3 lines
Quoted 1 line

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?

Quoted 2 lines

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

--
With Best Regards,
Andy Shevchenko

#6 lore raw

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

Hi Andy,

Quoted 54 lines · Andy Shevchenko
Quoted 52 lines · Simon Glass
Quoted 51 lines · Andy Shevchenko
Quoted 48 lines · Simon Glass
Quoted 37 lines · Andy Shevchenko

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.

---
 common/image.c | 5 -----
 include/init.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
common/image.c +0 -5
index 3fa60b582796..57bf86278149 100644
@@ -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 */
include/init.h +0 -0
index c781789e367e..37ca9905414f 100644

include/init.h void bdinfo_print_mhz(const char *name, unsigned long hz); · line 338

Quoted 7 lines
include/init.h +4 -0
@@ -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?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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.

Quoted 3 lines
Quoted 3 lines

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

Regards,
Simon

Reviewed-by on v1 1/2
#7 lore raw
In reply to Andy Shevchenko
Quoted 23 lines · Andy Shevchenko

After the commit 4ed37abc49c2 ("image: Remove ifdefs around image_setup_linux() el at"):

common/image-board.c: In function ‘boot_get_kbd’:
common/image-board.c:902:17: error: expected ‘)’ before ‘do_bdinfo’

  902 |                 do_bdinfo(NULL, 0, 0, NULL);
      |                 ^~~~~~~~~

common/image-board.c:901:12: note: to match this ‘(’
901 | if (IS_ENABLED(CONFIG_CMD_BDI)
| ^
common/image-board.c:906:1: error: expected expression before ‘}’ token
906 | }

      | ^
common/image-board.c:906:1: warning: control reaches end of non-void function [-Wreturn-type]
  906 | }
      | ^

Fix obvious typo.

Fixes 4ed37abc49c2 ("image: Remove ifdefs around image_setup_linux() el at")
Quoted 8 lines

Revert "image: Partially revert too aggressive ifdeferry removal"

This reverts commit 84631af9d0454ff8252c1aebb1e9c232b8077692.

---
 common/image-board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)