Skip to contentSkip to conversation

openrisc: Fix compiler warnings in setup

PATCH In review Stafford Horne 3 participants 6 messages Aug 5, 2021 – Aug 10, 2021 Openrisc architecture

lore
Share & tools
lore

Stafford Horne

author maintainer
#0 lore raw

PATCH 1/1 openrisc: Fix compiler warnings in setup

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

    arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype for 'or1k_early_setup' [-Wmissing-prototypes]
      220 | void __init or1k_early_setup(void *fdt)
	  |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype for 'detect_unit_config' [-Wmissing-prototypes]
246 | void __init detect_unit_config(unsigned long upr, unsigned long mask,
| ^~~~~~~~~~~~~~~~~~

The function detect_unit_config is not used, just remove it.

arch/openrisc/kernel/setup.c:221: warning: Function parameter or member 'fdt' not described in 'or1k_early_setup'

Add @fdt docs to the function comment to suppress this warning.

---
 arch/openrisc/include/asm/setup.h | 14 ++++++++++++++
 arch/openrisc/kernel/setup.c      | 16 +---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
 create mode 100644 arch/openrisc/include/asm/setup.h
arch/openrisc/include/asm/setup.h new file +14 -0
new file mode 100644
index 000000000000..b6d096eeb11c
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2021 Stafford Horne
+ */
+#ifndef _ASM_OR1K_SETUP_H
+#define _ASM_OR1K_SETUP_H
+
+#include <asm-generic/setup.h>
+
+#ifndef __ASSEMBLY__
+void __init or1k_early_setup(void *fdt);
+#endif
+
+#endif /* _ASM_OR1K_SETUP_H */
arch/openrisc/kernel/setup.c +1 -15
index 7eddcac0ef2f..0cd04d936a7a 100644
@@ -210,6 +210,7 @@ void __init setup_cpuinfo(void)
 
 /**
  * or1k_early_setup
+ * @fdt: pointer to the start of the device tree in memory or NULL
  *
  * Handles the pointer to the device tree that this kernel is to use
  * for establishing the available platform devices.
@@ -243,21 +244,6 @@ static inline unsigned long extract_value(unsigned long reg, unsigned long mask)
 	return mask & reg;
 }
 
-void __init detect_unit_config(unsigned long upr, unsigned long mask,
-			       char *text, void (*func) (void))
-{
-	if (text != NULL)
-		printk("%s", text);
-
-	if (upr & mask) {
-		if (func != NULL)
-			func();
-		else
-			printk("present\n");
-	} else
-		printk("not present\n");
-}
-
 /*
  * calibrate_delay
  *
Signature · 1 line
2.31.1
#1 lore raw
Quoted 15 lines · Stafford Horne

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

     arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype for 'or1k_early_setup' [-Wmissing-prototypes]
       220 | void __init or1k_early_setup(void *fdt)
	  |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype for 'detect_unit_config' [-Wmissing-prototypes]
246 | void __init detect_unit_config(unsigned long upr, unsigned long mask,
| ^~~~~~~~~~~~~~~~~~

Quoted 8 lines

The function detect_unit_config is not used, just remove it.

arch/openrisc/kernel/setup.c:221: warning: Function parameter or member 'fdt' not described in 'or1k_early_setup'

Add @fdt docs to the function comment to suppress this warning.

Hi Stafford,

Does this patch apply to your openrisc tree, but not to linux-next? I get a patch error when trying to apply it to linux-next-20210805 and this warning is still present:

../arch/openrisc/kernel/setup.c:221:13: warning: no previous prototype for 'or32_early_setup' [-Wmissing-prototypes]
221 | void __init or32_early_setup(void *fdt)

       |             ^~~~~~~~~~~~~~~~

presumably because some openrisc patches are not yet in linux-next??

thanks.

Quoted 6 lines
---
  arch/openrisc/include/asm/setup.h | 14 ++++++++++++++
  arch/openrisc/kernel/setup.c      | 16 +---------------
  2 files changed, 15 insertions(+), 15 deletions(-)

create mode 100644 arch/openrisc/include/asm/setup.h

Signature · 1 line
~Randy
author maintainer
#2 lore raw

PATCH 1/1 openrisc: Fix compiler warnings in setup

Quoted 35 lines · Randy Dunlap
Quoted 5 lines · Stafford Horne

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype

for 'or1k_early_setup' [-Wmissing-prototypes]

Quoted 7 lines
       220 | void __init or1k_early_setup(void *fdt)
        |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype

for 'detect_unit_config' [-Wmissing-prototypes]

Quoted 1 line

246 | void __init detect_unit_config(unsigned long upr, unsigned

long mask,

Quoted 5 lines
        |             ^~~~~~~~~~~~~~~~~~

The function detect_unit_config is not used, just remove it.

arch/openrisc/kernel/setup.c:221: warning: Function parameter or

member 'fdt' not described in 'or1k_early_setup'

Quoted 5 lines

Add @fdt docs to the function comment to suppress this warning.

Hi Stafford,

Does this patch apply to your openrisc tree, but not to linux-next? I get a patch error when trying to apply it to linux-next-20210805 and this warning is still present:

Quoted 9 lines

../arch/openrisc/kernel/setup.c:221:13: warning: no previous prototype for 'or32_early_setup' [-Wmissing-prototypes]
221 | void __init or32_early_setup(void *fdt)

       |             ^~~~~~~~~~~~~~~~

presumably because some openrisc patches are not yet in linux-next??

thanks.

Hi Randy,

Thats right, this patch is on top of my openrisc/for-next branch. It should show up in linux-next soon.

The branch is here.

https://github.com/openrisc/linux/commit/19e14f3a81d227f1c8b8d5371de28b3ab3deb556

I put this patch on the branch already. I plan to adjust if any feedback.

-stafford

Quoted 1 line

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.librecores.org/pipermail/openrisc/attachments/20210807/0f8dbb35/attachment.htm>

#3 lore raw
In reply to Stafford Horne
Quoted 15 lines · Stafford Horne

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

    arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype for 'or1k_early_setup' [-Wmissing-prototypes]
      220 | void __init or1k_early_setup(void *fdt)
	  |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype for 'detect_unit_config' [-Wmissing-prototypes]
246 | void __init detect_unit_config(unsigned long upr, unsigned long mask,
| ^~~~~~~~~~~~~~~~~~

Quoted 8 lines

The function detect_unit_config is not used, just remove it.

arch/openrisc/kernel/setup.c:221: warning: Function parameter or member 'fdt' not described in 'or1k_early_setup'

Add @fdt docs to the function comment to suppress this warning.

Puzzled. This patch gives me:

Building openrisc:or1ksim_defconfig ... failed
------------
Error log:
In file included from ./arch/openrisc/include/asm/page.h:35,
from ./include/linux/generic-radix-tree.h:39, from lib/generic-radix-tree.c:3:
./arch/openrisc/include/asm/setup.h:11:13: error:

		expected '=', ',', ';', 'asm' or '__attribute__' before 'or1k_early_setup'
   11 | void __init or1k_early_setup(void *fdt);
      |             ^~~~~~~~~~~~~~~~

make[1]: *** [scripts/Makefile.build:272: lib/generic-radix-tree.o] Error 1

Bisect log attached for completeness.

Guenter

---
# bad: [7999516e20bd9bb5d1f7351cbd05ca529a3a8d60] Add linux-next specific files for 20210806 # good: [c500bee1c5b2f1d59b1081ac879d73268ab0ff17] Linux 5.14-rc4
git bisect start 'HEAD' 'v5.14-rc4'
# bad: [66f67fa46df4630dfcad6bd2d3bb4af20d3a2490] Merge remote-tracking branch 'mlx5-next/mlx5-next' git bisect bad 66f67fa46df4630dfcad6bd2d3bb4af20d3a2490
# bad: [e2e00a1babe63d45518d967d17f4f17a31b051fa] Merge remote-tracking branch 'cifsd/cifsd-for-next' git bisect bad e2e00a1babe63d45518d967d17f4f17a31b051fa
# good: [d1af031ab8b8114a190af28e8f70636e8dbbd9d1] Merge remote-tracking branch 'qcom/for-next' git bisect good d1af031ab8b8114a190af28e8f70636e8dbbd9d1
# bad: [014a079a3d5f4e6426e42659284911abc1ae7b58] Merge remote-tracking branch 'pidfd/for-next' git bisect bad 014a079a3d5f4e6426e42659284911abc1ae7b58
# good: [4e2cdb3c5c59ae30a2e282734d57d9aeaf428ce1] Merge remote-tracking branch 'clk/clk-next' git bisect good 4e2cdb3c5c59ae30a2e282734d57d9aeaf428ce1
# good: [e6e9bca186a091f1fbbfe202c65b1e4f099476a2] Merge branch 'features' into for-next git bisect good e6e9bca186a091f1fbbfe202c65b1e4f099476a2
# good: [dcc54fc624d3a285ccbe97e9bbe3a6b26f1dfc01] Merge remote-tracking branch 'mips/mips-next' git bisect good dcc54fc624d3a285ccbe97e9bbe3a6b26f1dfc01
# bad: [9dec8a9fb4d32a212290548f166e39d8a1d02e61] Merge remote-tracking branch 'risc-v/for-next' git bisect bad 9dec8a9fb4d32a212290548f166e39d8a1d02e61
# bad: [a82c3bd806da0fb68319be21f088bdb70712ed6c] Merge remote-tracking branch 'powerpc/next' git bisect bad a82c3bd806da0fb68319be21f088bdb70712ed6c
# bad: [01315cd759a2c7c1436b661cc1f54c202f127b4a] Merge remote-tracking branch 'parisc-hd/for-next' git bisect bad 01315cd759a2c7c1436b661cc1f54c202f127b4a
# bad: [19e14f3a81d227f1c8b8d5371de28b3ab3deb556] openrisc: Fix compiler warnings in setup git bisect bad 19e14f3a81d227f1c8b8d5371de28b3ab3deb556
# good: [11648cbb7b335b7eb54e1ff973fb938939616f46] openrisc: rename or32 code & comments to or1k git bisect good 11648cbb7b335b7eb54e1ff973fb938939616f46

# first bad commit: [19e14f3a81d227f1c8b8d5371de28b3ab3deb556] openrisc: Fix compiler warnings in setup
#4 lore raw
Quoted 18 lines · Guenter Roeck
Quoted 17 lines · Stafford Horne

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

     arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype for 'or1k_early_setup' [-Wmissing-prototypes]
       220 | void __init or1k_early_setup(void *fdt)
	  |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype for 'detect_unit_config' [-Wmissing-prototypes]
246 | void __init detect_unit_config(unsigned long upr, unsigned long mask,
| ^~~~~~~~~~~~~~~~~~

The function detect_unit_config is not used, just remove it.

Quoted 8 lines
Quoted 6 lines

arch/openrisc/kernel/setup.c:221: warning: Function parameter or member 'fdt' not described in 'or1k_early_setup'

Add @fdt docs to the function comment to suppress this warning.

Puzzled. This patch gives me:

Stafford posted a v2 earlier today:
https://lore.kernel.org/lkml/20210808135437.3640549-1-shorne at gmail.com/

Quoted 7 lines

Building openrisc:or1ksim_defconfig ... failed
------------
Error log:
In file included from ./arch/openrisc/include/asm/page.h:35,
from ./include/linux/generic-radix-tree.h:39, from lib/generic-radix-tree.c:3:
./arch/openrisc/include/asm/setup.h:11:13: error:

Quoted 6 lines
		expected '=', ',', ';', 'asm' or '__attribute__' before 'or1k_early_setup'
    11 | void __init or1k_early_setup(void *fdt);
       |             ^~~~~~~~~~~~~~~~

make[1]: *** [scripts/Makefile.build:272: lib/generic-radix-tree.o] Error 1

Bisect log attached for completeness.

That needs #include <linux/init.h>

Signature · 1 line
~Randy
author maintainer
#5 lore raw
Quoted 23 lines · Randy Dunlap
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Stafford Horne

This was pointed out with the recent name change of or32_early_setup to or1k_early_setup. Investigating the file I found a few other warnings so cleaning them up here.

     arch/openrisc/kernel/setup.c:220:13: warning: no previous prototype for 'or1k_early_setup' [-Wmissing-prototypes]
       220 | void __init or1k_early_setup(void *fdt)
	  |             ^~~~~~~~~~~~~~~~

Fix this the missing or1k_early_setup prototype warning by adding an asm/setup.h file to define the prototype.

arch/openrisc/kernel/setup.c:246:13: warning: no previous prototype for 'detect_unit_config' [-Wmissing-prototypes]
246 | void __init detect_unit_config(unsigned long upr, unsigned long mask,
| ^~~~~~~~~~~~~~~~~~

The function detect_unit_config is not used, just remove it.

arch/openrisc/kernel/setup.c:221: warning: Function parameter or member 'fdt' not described in 'or1k_early_setup'

Add @fdt docs to the function comment to suppress this warning.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Puzzled. This patch gives me:

Stafford posted a v2 earlier today:
https://lore.kernel.org/lkml/20210808135437.3640549-1-shorne at gmail.com/

Yes, thanks for pointing this out. I found why I missed this in v1, basically I failed to miss this using my local build and my CI service on travis seems to have been stopped. I have switched to use github actions for CI.

For my local build I will need to watch more carefully.

-Stafford

Quoted 19 lines
Quoted 7 lines

Building openrisc:or1ksim_defconfig ... failed
------------
Error log:
In file included from ./arch/openrisc/include/asm/page.h:35,
from ./include/linux/generic-radix-tree.h:39, from lib/generic-radix-tree.c:3:
./arch/openrisc/include/asm/setup.h:11:13: error:

Quoted 6 lines
		expected '=', ',', ';', 'asm' or '__attribute__' before 'or1k_early_setup'
    11 | void __init or1k_early_setup(void *fdt);
       |             ^~~~~~~~~~~~~~~~

make[1]: *** [scripts/Makefile.build:272: lib/generic-radix-tree.o] Error 1

Bisect log attached for completeness.

That needs #include <linux/init.h>

Signature · 1 line
~Randy