Skip to contentSkip to conversation

s390: A couple of fixes for -Wmissing-prototypes

PATCH Applied Nathan Chancellor 3 participants 8 messages Dec 1, 2023 – Dec 5, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover s390: A couple of fixes for -Wmissing-prototypes

Hi all,

This series resolves a couple of -Wmissing-prototypes that I see in my builds of -next, even though the issues appear to be latent. The patch to enable -Wmissing-prototypes is in Andrew's tree, so these should likely go there as well with acks from the s390 maintainers.

---
Nathan Chancellor (2):
s390/dasd: Remove dasd_stats_generic_show()
s390/traps: Only define is_valid_bugaddr() under CONFIG_GENERIC_BUG

 arch/s390/kernel/traps.c  | 2 ++
 drivers/s390/block/dasd.c | 6 ------
 2 files changed, 2 insertions(+), 6 deletions(-)

---
base-commit: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
change-id: 20231130-s390-missing-prototypes-7d95aae2cdcb

Best regards,

Signature · 1 line
Nathan Chancellor <[email protected]>
#1 lore raw

PATCH 1/2 s390/dasd: Remove dasd_stats_generic_show()

With CONFIG_DASD_PROFILE=n, there is a warning that dasd_stats_generic_show() is missing a prototype:

drivers/s390/block/dasd.c:1109:5: warning: no previous prototype for 'dasd_stats_generic_show' [-Wmissing-prototypes]
1109 | int dasd_stats_generic_show(struct seq_file *m, void *v)

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

This function has been unused since its introduction in commit 4fa52aa7a82f ("[S390] dasd: add enhanced DASD statistics interface"), remove it to clear up the warning.

---
Cc: [email protected]
Cc: [email protected]

---
 drivers/s390/block/dasd.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/s390/block/dasd.c +0 -6
index 833cfab7d877..7327e81352e9 100644
@@ -1106,12 +1106,6 @@ static void dasd_statistics_removeroot(void)
 	return;
 }
 
-int dasd_stats_generic_show(struct seq_file *m, void *v)
-{
-	seq_puts(m, "Statistics are not activated in this kernel\n");
-	return 0;
-}
-
 static void dasd_profile_init(struct dasd_profile *profile,
 			      struct dentry *base_dentry)
 {
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] s390/dasd: Remove dasd_stats_generic_show()

Quoted 27 lines · Nathan Chancellor

With CONFIG_DASD_PROFILE=n, there is a warning that dasd_stats_generic_show() is missing a prototype:

drivers/s390/block/dasd.c:1109:5: warning: no previous prototype for 'dasd_stats_generic_show' [-Wmissing-prototypes]
1109 | int dasd_stats_generic_show(struct seq_file *m, void *v)

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

This function has been unused since its introduction in commit 4fa52aa7a82f ("[S390] dasd: add enhanced DASD statistics interface"), remove it to clear up the warning.

---
Cc: [email protected]
Cc: [email protected]

---
 drivers/s390/block/dasd.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/s390/block/dasd.c +0 -0
index 833cfab7d877..7327e81352e9 100644
@@ -1106,12 +1106,6 @@ static void dasd_statistics_removeroot(void)
 	return;
 }

drivers/s390/block/dasd.c static void dasd_statistics_removeroot(void) · line 1111

Quoted 10 lines
drivers/s390/block/dasd.c +0 -6
 
-int dasd_stats_generic_show(struct seq_file *m, void *v)
-{
-	seq_puts(m, "Statistics are not activated in this kernel\n");
-	return 0;
-}
-
 static void dasd_profile_init(struct dasd_profile *profile,
 			      struct dentry *base_dentry)
 {
maintainer Acked-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] s390/dasd: Remove dasd_stats_generic_show()

In reply to Nathan Chancellor

Am 01.12.23 um 01:22 schrieb Nathan Chancellor:

Quoted 7 lines

With CONFIG_DASD_PROFILE=n, there is a warning that dasd_stats_generic_show() is missing a prototype:

drivers/s390/block/dasd.c:1109:5: warning: no previous prototype for 'dasd_stats_generic_show' [-Wmissing-prototypes]
1109 | int dasd_stats_generic_show(struct seq_file *m, void *v)
| ^~~~~~~~~~~~~~~~~~~~~~~

Quoted 6 lines

This function has been unused since its introduction in commit 4fa52aa7a82f ("[S390] dasd: add enhanced DASD statistics interface"), remove it to clear up the warning.

---

#4 lore raw

PATCH 2/2 s390/traps: Only define is_valid_bugaddr() under CONFIG_GENERIC_BUG

In reply to Nathan Chancellor

When building with -Wmissing-prototypes without CONFIG_GENERIC_BUG, there is a warning about a missing prototype for is_valid_bugaddr():

arch/s390/kernel/traps.c:46:5: warning: no previous prototype for 'is_valid_bugaddr' [-Wmissing-prototypes]
46 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~

The prototype is only declared with CONFIG_GENERIC_BUG, so only define the function under the same condition to clear up the warning, which matches other architectures.

---
 arch/s390/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/kernel/traps.c +2 -0
index 1d2aa448d103..cc3e3a01dfa5 100644
@@ -43,10 +43,12 @@ static inline void __user *get_trap_ip(struct pt_regs *regs)
 	return (void __user *) (address - (regs->int_code >> 16));
 }
 
+#ifdef CONFIG_GENERIC_BUG
 int is_valid_bugaddr(unsigned long addr)
 {
 	return 1;
 }
+#endif
 
 void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
 {
Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH 2/2] s390/traps: Only define is_valid_bugaddr() under CONFIG_GENERIC_BUG

On Thu, Nov 30, 2023 at 05:22:33PM -0700, Nathan Chancellor wrote:

Hi Nathan,

Quoted 10 lines

When building with -Wmissing-prototypes without CONFIG_GENERIC_BUG, there is a warning about a missing prototype for is_valid_bugaddr():

arch/s390/kernel/traps.c:46:5: warning: no previous prototype for 'is_valid_bugaddr' [-Wmissing-prototypes]
46 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~

The prototype is only declared with CONFIG_GENERIC_BUG, so only define the function under the same condition to clear up the warning, which matches other architectures.

Thanks for the fix!
The patch is fine, although I have not been able to reproduce the warning. How did you trigger it?

Quoted 4 lines
---
 arch/s390/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)

...

Thanks!

#6 lore raw

Re: [PATCH 2/2] s390/traps: Only define is_valid_bugaddr() under CONFIG_GENERIC_BUG

Quoted 11 lines · Alexander Gordeev

On Thu, Nov 30, 2023 at 05:22:33PM -0700, Nathan Chancellor wrote:

Hi Nathan,

Quoted 7 lines

When building with -Wmissing-prototypes without CONFIG_GENERIC_BUG, there is a warning about a missing prototype for is_valid_bugaddr():

arch/s390/kernel/traps.c:46:5: warning: no previous prototype for 'is_valid_bugaddr' [-Wmissing-prototypes]
46 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 3 lines

The prototype is only declared with CONFIG_GENERIC_BUG, so only define the function under the same condition to clear up the warning, which matches other architectures.

Thanks for the fix!
The patch is fine, although I have not been able to reproduce the warning. How did you trigger it?

Thanks for taking a look! I am able to trigger this on v6.7-rc4 with:

# Flip off CONFIG_BUG in menuconfig

  $ make -skj"$(nproc)" ARCH=s390 CROSS_COMPILE=s390-linux- KCFLAGS=-Wmissing-prototypes defconfig menuconfig arch/s390/kernel/traps.o
  arch/s390/kernel/traps.c:46:5: warning: no previous prototype for 'is_valid_bugaddr' [-Wmissing-prototypes]
     46 | int is_valid_bugaddr(unsigned long addr)
        |     ^~~~~~~~~~~~~~~~

I initially found this by testing just the tinyconfig target.

Quoted 7 lines
Quoted 4 lines
---
 arch/s390/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)

...

Thanks!

maintainer Reviewed-by on v1 2/2
#7 lore raw

Re: [PATCH 2/2] s390/traps: Only define is_valid_bugaddr() under CONFIG_GENERIC_BUG

In reply to Nathan Chancellor
Quoted 23 lines · Nathan Chancellor

When building with -Wmissing-prototypes without CONFIG_GENERIC_BUG, there is a warning about a missing prototype for is_valid_bugaddr():

arch/s390/kernel/traps.c:46:5: warning: no previous prototype for 'is_valid_bugaddr' [-Wmissing-prototypes]
46 | int is_valid_bugaddr(unsigned long addr)
| ^~~~~~~~~~~~~~~~

The prototype is only declared with CONFIG_GENERIC_BUG, so only define the function under the same condition to clear up the warning, which matches other architectures.

---
 arch/s390/kernel/traps.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/kernel/traps.c +0 -0
index 1d2aa448d103..cc3e3a01dfa5 100644
@@ -43,10 +43,12 @@ static inline void __user *get_trap_ip(struct pt_regs *regs)
 	return (void __user *) (address - (regs->int_code >> 16));
 }

arch/s390/kernel/traps.c static inline void __user *get_trap_ip(struct pt_regs *regs) · line 54

Quoted 10 lines
arch/s390/kernel/traps.c +2 -0
 
+#ifdef CONFIG_GENERIC_BUG
 int is_valid_bugaddr(unsigned long addr)
 {
 	return 1;
 }
+#endif
 
 void do_report_trap(struct pt_regs *regs, int si_signo, int si_code, char *str)
 {