2021-08-05 05:03:57

by Stafford Horne

[permalink] [raw]
Subject: [PATCH] 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.

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Stafford Horne <[email protected]>
---
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

diff --git a/arch/openrisc/include/asm/setup.h b/arch/openrisc/include/asm/setup.h
new file mode 100644
index 000000000000..b6d096eeb11c
--- /dev/null
+++ b/arch/openrisc/include/asm/setup.h
@@ -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 */
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index 7eddcac0ef2f..0cd04d936a7a 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -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
*
--
2.31.1


2021-08-05 21:29:03

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] openrisc: Fix compiler warnings in setup

On 8/4/21 8:00 PM, Stafford Horne wrote:
> 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.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Stafford Horne <[email protected]>

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.

> ---
> 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
>



--
~Randy

2021-08-09 01:33:19

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH] openrisc: Fix compiler warnings in setup

On Thu, Aug 05, 2021 at 12:00:33PM +0900, Stafford Horne wrote:
> 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.
>
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Stafford Horne <[email protected]>

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

2021-08-09 02:32:00

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] openrisc: Fix compiler warnings in setup

On 8/8/21 6:31 PM, Guenter Roeck wrote:
> On Thu, Aug 05, 2021 at 12:00:33PM +0900, Stafford Horne wrote:
>> 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.
>>
>> Reported-by: kernel test robot <[email protected]>
>> Signed-off-by: Stafford Horne <[email protected]>
>
> Puzzled. This patch gives me:

Stafford posted a v2 earlier today:
https://lore.kernel.org/lkml/[email protected]/


> 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.

That needs #include <linux/init.h>

--
~Randy

2021-08-10 21:18:32

by Stafford Horne

[permalink] [raw]
Subject: Re: [PATCH] openrisc: Fix compiler warnings in setup

On Sun, Aug 08, 2021 at 07:28:38PM -0700, Randy Dunlap wrote:
> On 8/8/21 6:31 PM, Guenter Roeck wrote:
> > On Thu, Aug 05, 2021 at 12:00:33PM +0900, Stafford Horne wrote:
> > > 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.
> > >
> > > Reported-by: kernel test robot <[email protected]>
> > > Signed-off-by: Stafford Horne <[email protected]>
> >
> > Puzzled. This patch gives me:
>
> Stafford posted a v2 earlier today:
> https://lore.kernel.org/lkml/[email protected]/

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

> > 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.
>
> That needs #include <linux/init.h>
>
> --
> ~Randy
>