Skip to contentSkip to conversation

powerpc: Make code compilable with -Wmissing-prototypes

PATCH In review Thomas Huth 2 participants 2 messages Jun 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Make code compilable with -Wmissing-prototypes

It's always better to check whether the implementations match the prototypes, so make the code compilable with the -Wmissing-prototypes compiler flag. (However, the flag is not turned on yet since the other architectures are not ready for this yet)

---
 lib/powerpc/asm/setup.h | 2 ++
 lib/powerpc/hcall.c     | 2 ++
 lib/powerpc/io.c        | 3 ++-
 lib/powerpc/io.h        | 8 ++++++++
 lib/powerpc/setup.c     | 2 +-
 powerpc/reloc64.c       | 2 ++
 6 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 lib/powerpc/io.h
lib/powerpc/asm/setup.h +2 -0
index 23b4156..cc7cf5e 100644
@@ -27,4 +27,6 @@ extern unsigned __icache_bytes, __dcache_bytes;
 #define PHYSICAL_START		(__physical_start)
 #define PHYSICAL_END		(__physical_end)
 
+void setup(const void *fdt);
+
 #endif /* _ASMPOWERPC_SETUP_H_ */
lib/powerpc/hcall.c +2 -0
index 7b05265..711cb1b 100644
@@ -9,6 +9,8 @@
  * This work is licensed under the terms of the GNU LGPL, version 2.
  */
 #include <asm/hcall.h>
+#include <libcflat.h>
+#include "io.h"
 
 int hcall_have_broken_sc1(void)
 {
lib/powerpc/io.c +2 -1
index 6a94bcc..915e12e 100644
@@ -8,9 +8,10 @@
 #include <libcflat.h>
 #include <asm/spinlock.h>
 #include <asm/rtas.h>
+#include <asm/setup.h>
+#include "io.h"
 
 extern void halt(int code);
-extern void putchar(int c);
 
 static struct spinlock print_lock;
 
lib/powerpc/io.h new file +8 -0
new file mode 100644
index 0000000..1f5a7bd
@@ -0,0 +1,8 @@
+/*
+ * Prototypes for io.c
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.
+ */
+
+extern void io_init(void);
+extern void putchar(int c);
lib/powerpc/setup.c +1 -1
index d8f4327..1be4c03 100644
@@ -19,9 +19,9 @@
 #include <asm/setup.h>
 #include <asm/page.h>
 #include <asm/hcall.h>
+#include "io.h"
 
 extern unsigned long stacktop;
-extern void io_init(void);
 
 char *initrd;
 u32 initrd_size;
powerpc/reloc64.c +2 -0
index d919372..f6aaabe 100644
@@ -24,6 +24,8 @@ struct elf64_rela {
 	signed long long addend;
 };
 
+void relocate(unsigned long load_addr, struct elf64_dyn *dyn_table);
+
 void relocate(unsigned long load_addr, struct elf64_dyn *dyn_table)
 {
 	unsigned long long rela_addr = 0, rela_count = 0, *addr;
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Thomas Huth

It's always better to check whether the implementations match the prototypes, so make the code compilable with the -Wmissing-prototypes compiler flag. (However, the flag is not turned on yet since the other architectures are not ready for this yet)

Quoted 9 lines
---
 lib/powerpc/asm/setup.h | 2 ++
 lib/powerpc/hcall.c     | 2 ++
 lib/powerpc/io.c        | 3 ++-
 lib/powerpc/io.h        | 8 ++++++++
 lib/powerpc/setup.c     | 2 +-
 powerpc/reloc64.c       | 2 ++
 6 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100644 lib/powerpc/io.h