diff mbox

[kvm-unit-tests] lib/alloc: Fix/check the prototypes in the allocator files

Message ID 1522743052-8266-1-git-send-email-thuth@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Thomas Huth April 3, 2018, 8:10 a.m. UTC
We should make sure that the prototypes match the implementations and
thus include the alloc_page.h header from alloc_page.c, and the
alloc_phys.h header from alloc_phys.c. This way the file can be
compiled with -Wmissing-prototypes and -Wstrict-prototypes, too.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 lib/alloc_page.c | 1 +
 lib/alloc_page.h | 2 +-
 lib/alloc_phys.c | 1 +
 lib/vmalloc.h    | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

Comments

David Hildenbrand April 3, 2018, 8:19 a.m. UTC | #1
On 03.04.2018 10:10, Thomas Huth wrote:
> We should make sure that the prototypes match the implementations and
> thus include the alloc_page.h header from alloc_page.c, and the
> alloc_phys.h header from alloc_phys.c. This way the file can be
> compiled with -Wmissing-prototypes and -Wstrict-prototypes, too.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/alloc_page.c | 1 +
>  lib/alloc_page.h | 2 +-
>  lib/alloc_phys.c | 1 +
>  lib/vmalloc.h    | 2 +-
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index 361b584..730f2b5 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -7,6 +7,7 @@
>  #include "libcflat.h"
>  #include "alloc.h"
>  #include "alloc_phys.h"
> +#include "alloc_page.h"
>  #include "bitops.h"
>  #include <asm/page.h>
>  #include <asm/io.h>
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 51d4841..5cdfec5 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -10,7 +10,7 @@
>  
>  bool page_alloc_initialized(void);
>  void page_alloc_ops_enable(void);
> -void *alloc_page();
> +void *alloc_page(void);
>  void *alloc_pages(unsigned long order);
>  void free_page(void *page);
>  void free_pages(void *mem, unsigned long size);
> diff --git a/lib/alloc_phys.c b/lib/alloc_phys.c
> index 736c312..72e20f7 100644
> --- a/lib/alloc_phys.c
> +++ b/lib/alloc_phys.c
> @@ -9,6 +9,7 @@
>  #include "alloc.h"
>  #include "asm/spinlock.h"
>  #include "asm/io.h"
> +#include "alloc_phys.h"
>  
>  #define PHYS_ALLOC_NR_REGIONS	256
>  
> diff --git a/lib/vmalloc.h b/lib/vmalloc.h
> index b4cde65..3658b80 100644
> --- a/lib/vmalloc.h
> +++ b/lib/vmalloc.h
> @@ -6,7 +6,7 @@
>  extern void *alloc_vpages(ulong nr);
>  extern void *alloc_vpage(void);
>  extern void init_alloc_vpage(void *top);
> -extern void setup_vm();
> +extern void setup_vm(void);
>  
>  extern void *setup_mmu(phys_addr_t top);
>  extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt);
> 

Reviewed-by: David Hildenbrand <david@redhat.com>
Paolo Bonzini April 6, 2018, 11:44 a.m. UTC | #2
On 03/04/2018 10:10, Thomas Huth wrote:
> We should make sure that the prototypes match the implementations and
> thus include the alloc_page.h header from alloc_page.c, and the
> alloc_phys.h header from alloc_phys.c. This way the file can be
> compiled with -Wmissing-prototypes and -Wstrict-prototypes, too.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  lib/alloc_page.c | 1 +
>  lib/alloc_page.h | 2 +-
>  lib/alloc_phys.c | 1 +
>  lib/vmalloc.h    | 2 +-
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index 361b584..730f2b5 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -7,6 +7,7 @@
>  #include "libcflat.h"
>  #include "alloc.h"
>  #include "alloc_phys.h"
> +#include "alloc_page.h"
>  #include "bitops.h"
>  #include <asm/page.h>
>  #include <asm/io.h>
> diff --git a/lib/alloc_page.h b/lib/alloc_page.h
> index 51d4841..5cdfec5 100644
> --- a/lib/alloc_page.h
> +++ b/lib/alloc_page.h
> @@ -10,7 +10,7 @@
>  
>  bool page_alloc_initialized(void);
>  void page_alloc_ops_enable(void);
> -void *alloc_page();
> +void *alloc_page(void);
>  void *alloc_pages(unsigned long order);
>  void free_page(void *page);
>  void free_pages(void *mem, unsigned long size);
> diff --git a/lib/alloc_phys.c b/lib/alloc_phys.c
> index 736c312..72e20f7 100644
> --- a/lib/alloc_phys.c
> +++ b/lib/alloc_phys.c
> @@ -9,6 +9,7 @@
>  #include "alloc.h"
>  #include "asm/spinlock.h"
>  #include "asm/io.h"
> +#include "alloc_phys.h"
>  
>  #define PHYS_ALLOC_NR_REGIONS	256
>  
> diff --git a/lib/vmalloc.h b/lib/vmalloc.h
> index b4cde65..3658b80 100644
> --- a/lib/vmalloc.h
> +++ b/lib/vmalloc.h
> @@ -6,7 +6,7 @@
>  extern void *alloc_vpages(ulong nr);
>  extern void *alloc_vpage(void);
>  extern void init_alloc_vpage(void *top);
> -extern void setup_vm();
> +extern void setup_vm(void);
>  
>  extern void *setup_mmu(phys_addr_t top);
>  extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt);
> 

Applied, thanks.

Paolo
diff mbox

Patch

diff --git a/lib/alloc_page.c b/lib/alloc_page.c
index 361b584..730f2b5 100644
--- a/lib/alloc_page.c
+++ b/lib/alloc_page.c
@@ -7,6 +7,7 @@ 
 #include "libcflat.h"
 #include "alloc.h"
 #include "alloc_phys.h"
+#include "alloc_page.h"
 #include "bitops.h"
 #include <asm/page.h>
 #include <asm/io.h>
diff --git a/lib/alloc_page.h b/lib/alloc_page.h
index 51d4841..5cdfec5 100644
--- a/lib/alloc_page.h
+++ b/lib/alloc_page.h
@@ -10,7 +10,7 @@ 
 
 bool page_alloc_initialized(void);
 void page_alloc_ops_enable(void);
-void *alloc_page();
+void *alloc_page(void);
 void *alloc_pages(unsigned long order);
 void free_page(void *page);
 void free_pages(void *mem, unsigned long size);
diff --git a/lib/alloc_phys.c b/lib/alloc_phys.c
index 736c312..72e20f7 100644
--- a/lib/alloc_phys.c
+++ b/lib/alloc_phys.c
@@ -9,6 +9,7 @@ 
 #include "alloc.h"
 #include "asm/spinlock.h"
 #include "asm/io.h"
+#include "alloc_phys.h"
 
 #define PHYS_ALLOC_NR_REGIONS	256
 
diff --git a/lib/vmalloc.h b/lib/vmalloc.h
index b4cde65..3658b80 100644
--- a/lib/vmalloc.h
+++ b/lib/vmalloc.h
@@ -6,7 +6,7 @@ 
 extern void *alloc_vpages(ulong nr);
 extern void *alloc_vpage(void);
 extern void init_alloc_vpage(void *top);
-extern void setup_vm();
+extern void setup_vm(void);
 
 extern void *setup_mmu(phys_addr_t top);
 extern phys_addr_t virt_to_pte_phys(pgd_t *pgtable, void *virt);