Skip to contentSkip to conversation

Eliminate GCC -Wmissing-prototype warnings

PATCH In review Darshana Padmadas 3 participants 20 messages Mar 4, 2015

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

cover Eliminate GCC -Wmissing-prototype warnings

GCC warns about functions without previous
prototypes i.e -Wmissing-prototypes warnings.

In the following patches the following fixes have been adopted to eliminate these warnings:
- Functions defined in a file, that are internal to that file have been made static.
- Header files have been included in files whose non-internal functions have their prototypes defined in these headers files.
- Adding prototypes for several non-internal functions in the appropriate header file while keeping the structure definitions of the parameters used by the functions in mind.
- Add the prototype above the
function definition.

These warnings can be generated by adding -Wmissing-prototypes to KBUILD_FLAGS in the top-level Makefile and then perform the build.

Darshana Padmadas (16):
arch: x86: boot: Make function static and add function prototype
arch: x86: boot: Add prototype for decompress_kernel
arch: x86: boot: Include header string.h for function prototypes
arch: x86: ia32: Add prototype for compat_ni_syscall
arch: x86: kernel: Make internal functions static in
cpu/intel_cacheinfo.c
arch: x86: kernel: cpu: Mark function mce_chrdev_write static
arch: x86: kernel: Mark internal function EVT_TO_HPET_DEV static
arch: x86: kernel: Mark internal functions static in kvm.c
arch: x86: kernel: Include <asm/switch_to.h> for function prototype
arch: x86: kernel: Add prototype for function sys32_x32_rt_sigreturn
arch: x86: kernel: Add prototype for smp_reboot_interrupt
arch: x86: kernel: Add prototype for fixup_bad_iret in traps.c
arch: x86: xen: Add prototype for xen_start_kernel in enlighten.c
arch: x86: xen: Mark internal function xen_flush_tlb_all static.
arch: x86: xen: Add prototypes for functions defined in mmu.c
arch: x86: xen: Mark internal functions static in setup.c

 arch/x86/boot/compressed/eboot.c      | 9 ++++++++-
 arch/x86/boot/compressed/misc.c       | 7 +++++++
 arch/x86/boot/string.c                | 1 +
 arch/x86/ia32/nosyscall.c             | 2 ++
 arch/x86/kernel/cpu/intel_cacheinfo.c | 4 ++--
 arch/x86/kernel/cpu/mcheck/mce.c      | 2 +-
 arch/x86/kernel/hpet.c                | 2 +-
 arch/x86/kernel/kvm.c                 | 4 ++--
 arch/x86/kernel/process.c             | 1 +
 arch/x86/kernel/signal.c              | 3 +++
 arch/x86/kernel/smp.c                 | 2 ++
 arch/x86/kernel/traps.c               | 3 +++
 arch/x86/xen/enlighten.c              | 2 ++
 arch/x86/xen/mmu.c                    | 2 +-
 arch/x86/xen/mmu.h                    | 8 ++++++++
 arch/x86/xen/setup.c                  | 4 ++--
 16 files changed, 46 insertions(+), 10 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/16 arch: x86: boot: Make function static and add function prototype

compressed/eboot.c defines an internal function setup_graphics(struct boot_params *boot_params). No other file refers to this function with the same parameters so make this function static.

This eliminates the following warning:

arch/x86/boot/compressed/eboot.c:1004:6: warning: no previous prototype for ‘setup_graphics’ [-Wmissing-prototypes]

Also make_boot_params is declared only in this file and is used in some assembly. So add a prototype for this function.

This eliminates the following warning:

arch/x86/boot/compressed/eboot.c:1042:21: warning: no previous prototype for ‘make_boot_params’ [-Wmissing-prototypes]

---
 arch/x86/boot/compressed/eboot.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/boot/compressed/eboot.c +8 -1
index 92b9a5f..cb4ebab 100644
@@ -1001,7 +1001,7 @@ free_handle:
 	return status;
 }
 
-void setup_graphics(struct boot_params *boot_params)
+static void setup_graphics(struct boot_params *boot_params)
 {
 	efi_guid_t graphics_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 	struct screen_info *si;
@@ -1039,6 +1039,9 @@ void setup_graphics(struct boot_params *boot_params)
  * The caller is responsible for filling out ->code32_start in the
  * returned boot_params.
  */
+
+struct boot_params *make_boot_params(struct efi_config *c);
+
 struct boot_params *make_boot_params(struct efi_config *c)
 {
 	struct boot_params *boot_params;
@@ -1378,6 +1381,10 @@ free_mem_map:
  * On success we return a pointer to a boot_params structure, and NULL
  * on failure.
  */
+
+struct boot_params *efi_main(struct efi_config *c,
+			     struct boot_params *boot_params);
+
 struct boot_params *efi_main(struct efi_config *c,
 			     struct boot_params *boot_params)
 {
Signature · 1 line
1.9.1
#2 lore raw

Re: [PATCH 01/16] arch: x86: boot: Make function static and add function prototype

Quoted 26 lines · Darshana Padmadas

compressed/eboot.c defines an internal function setup_graphics(struct boot_params *boot_params). No other file refers to this function with the same parameters so make this function static.

This eliminates the following warning:

arch/x86/boot/compressed/eboot.c:1004:6: warning: no previous prototype for ‘setup_graphics’ [-Wmissing-prototypes]

Also make_boot_params is declared only in this file and is used in some assembly. So add a prototype for this function.

This eliminates the following warning:

arch/x86/boot/compressed/eboot.c:1042:21: warning: no previous prototype for ‘make_boot_params’ [-Wmissing-prototypes]

---
 arch/x86/boot/compressed/eboot.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
arch/x86/boot/compressed/eboot.c +0 -0
index 92b9a5f..cb4ebab 100644

arch/x86/boot/compressed/eboot.c free_handle: · line 1004

Quoted 5 lines
arch/x86/boot/compressed/eboot.c +1 -1
@@ -1001,7 +1001,7 @@ free_handle:
 	return status;
 }
 
-void setup_graphics(struct boot_params *boot_params)
+static void setup_graphics(struct boot_params *boot_params)

This category of change is good: making needlessly global functions static is absolutely useful even if the kernel doesn't use the -Wmissing-prototypes warning, because this allows the compiler to potentially inline the function and thus reduce the size of the kernel. (even if it's not inlined, it's a small reduction in kernel image size.)

arch/x86/boot/compressed/eboot.c void setup_graphics(struct boot_params *boot_params) · line 1045

Quoted 11 lines
arch/x86/boot/compressed/eboot.c +3 -0
 {
 	efi_guid_t graphics_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID;
 	struct screen_info *si;
@@ -1039,6 +1039,9 @@ void setup_graphics(struct boot_params *boot_params)
  * The caller is responsible for filling out ->code32_start in the
  * returned boot_params.
  */
+
+struct boot_params *make_boot_params(struct efi_config *c);
+
 struct boot_params *make_boot_params(struct efi_config *c)

This category of change is not so useful in that form: look at the duplicated line in the .c file, it looks weird and not very useful at first glance already.

The way this is typically solved in user-space projects that use -Wall -Werror (such as tools/perf/) is to stick the external prototypes into a proper header file.

If a function is global because it's only interfacing with assembly code then put that into a comment before the prototype lines as well, in the header file. In this case the extra prototypes are also useful:
they keep people modifying those functions informed and careful, as changing the function parameters signature could break assembly code without creating any obvious build time errors or warnings.

Thanks,

Ingo

#3 lore raw

PATCH 2/16 arch: x86: boot: Add prototype for decompress_kernel

In reply to Darshana Padmadas

compressed/misc.c declares internal function decompress_kernel used only in this file and in some assembly. Add a prototype for the function.

This eliminates the followig warning:
arch/x86/boot/compressed/misc.c:369:28: warning: no previous prototype for ‘decompress_kernel’ [-Wmissing-prototypes]

---
 arch/x86/boot/compressed/misc.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/x86/boot/compressed/misc.c +7 -0
index a950864..43bb537 100644
@@ -371,6 +371,13 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
 				  unsigned long input_len,
 				  unsigned char *output,
 				  unsigned long output_len,
+				  unsigned long run_size);
+
+asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap,
+				  unsigned char *input_data,
+				  unsigned long input_len,
+				  unsigned char *output,
+				  unsigned long output_len,
 				  unsigned long run_size)
 {
 	unsigned char *output_orig = output;
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/16 arch: x86: boot: Include header string.h for function prototypes

In reply to Darshana Padmadas

Include header file string.h that declares prototypes for functions defined in string.c.

This eliminates the following warnings:

arch/x86/boot/string.c:18:5: warning: no previous prototype for ‘memcmp’ [-Wmissing-prototypes] arch/x86/boot/compressed/../string.c:18:5: warning: no previous prototype for ‘memcmp’ [-Wmissing-prototypes] arch/x86/boot/compressed/string.c:18:7: warning: no previous prototype for ‘memcpy’ [-Wmissing-prototypes] arch/x86/boot/compressed/string.c:33:7: warning: no previous prototype for ‘memset’ [-Wmissing-prototypes]

---
 arch/x86/boot/string.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/boot/string.c +1 -0
index 493f3fd..847f56c 100644
@@ -14,6 +14,7 @@
 
 #include <linux/types.h>
 #include "ctype.h"
+#include "string.h"
 
 int memcmp(const void *s1, const void *s2, size_t len)
 {
Signature · 1 line
1.9.1
#5 lore raw

PATCH 4/16 arch: x86: ia32: Add prototype for compat_ni_syscall

In reply to Darshana Padmadas

nosyscall.c declares function compat_ni_syscall that returns long datatype. compat_ni_syscall is also defined in syscall_ia32.c but returns void. Add prototype for this function.

This eliminates the following warning:

arch/x86/ia32/nosyscall.c:4:6: warning: no previous prototype for ‘compat_ni_syscall’ [-Wmissing-prototypes]

---
 arch/x86/ia32/nosyscall.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/ia32/nosyscall.c +2 -0
index 51ecd5b..22f757b 100644
@@ -1,6 +1,8 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 
+long compat_ni_syscall(void);
+
 long compat_ni_syscall(void)
 {
 	return -ENOSYS;
Signature · 1 line
1.9.1
#6 lore raw

PATCH 5/16 arch: x86: kernel: Make internal functions static in cpu/intel_cacheinfo.c

In reply to Darshana Padmadas

cpu/intel_cacheinfo.c defines two functions amd_get_l3_disable_slot and amd_set_l3_disable_slot. No other file uses these functions. So make these static.

This eliminates the following warnings:

arch/x86/kernel/cpu/intel_cacheinfo.c:349:5: warning: no previous prototype for ‘amd_get_l3_disable_slot’ [-Wmissing-prototypes] arch/x86/kernel/cpu/intel_cacheinfo.c:427:5: warning: no previous prototype for ‘amd_set_l3_disable_slot’ [-Wmissing-prototypes]

---
 arch/x86/kernel/cpu/intel_cacheinfo.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/intel_cacheinfo.c +2 -2
index 6596433..c5ab252 100644
@@ -346,7 +346,7 @@ static void amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, int index)
  *
  * @returns: the disabled index if used or negative value if slot free.
  */
-int amd_get_l3_disable_slot(struct amd_northbridge *nb, unsigned slot)
+static int amd_get_l3_disable_slot(struct amd_northbridge *nb, unsigned slot)
 {
 	unsigned int reg = 0;
 
@@ -424,7 +424,7 @@ static void amd_l3_disable_index(struct amd_northbridge *nb, int cpu,
  *
  * @return: 0 on success, error status on failure
  */
-int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
+static int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
 			    unsigned long index)
 {
 	int ret = 0;
Signature · 1 line
1.9.1
maintainer
#7 lore raw

Re: [PATCH 05/16] arch: x86: kernel: Make internal functions static in cpu/intel_cacheinfo.c

Quoted 8 lines · Darshana Padmadas

cpu/intel_cacheinfo.c defines two functions amd_get_l3_disable_slot and amd_set_l3_disable_slot. No other file uses these functions. So make these static.

This eliminates the following warnings:

arch/x86/kernel/cpu/intel_cacheinfo.c:349:5: warning: no previous prototype for ‘amd_get_l3_disable_slot’ [-Wmissing-prototypes] arch/x86/kernel/cpu/intel_cacheinfo.c:427:5: warning: no previous prototype for ‘amd_set_l3_disable_slot’ [-Wmissing-prototypes]

Please correct your commit message - this patch is making functions static and not fixing -Wmissing-prototypes warnings. Also, go through the rest of the patchset as I see other cases of this too.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#8 lore raw

Re: [PATCH 05/16] arch: x86: kernel: Make internal functions static in cpu/intel_cacheinfo.c

Quoted 5 lines · Borislav Petkov
Quoted 4 lines · Darshana Padmadas

cpu/intel_cacheinfo.c defines two functions amd_get_l3_disable_slot and amd_set_l3_disable_slot. No other file uses these functions. So make these static.

Quoted 8 lines
Quoted 4 lines

This eliminates the following warnings:

arch/x86/kernel/cpu/intel_cacheinfo.c:349:5: warning: no previous prototype for ‘amd_get_l3_disable_slot’ [-Wmissing-prototypes] arch/x86/kernel/cpu/intel_cacheinfo.c:427:5: warning: no previous prototype for ‘amd_set_l3_disable_slot’ [-Wmissing-prototypes]

Please correct your commit message - this patch is making functions static and not fixing -Wmissing-prototypes warnings. Also, go through the rest of the patchset as I see other cases of this too.

So mentioning the warning is OK as long as it's characterised as a tool that helped find these kernel inefficiencies. So a better commit message would be something like:

cpu/intel_cacheinfo.c defines two functions amd_get_l3_disable_slot() and amd_set_l3_disable_slot(). No other file uses these functions. So make these static to reduce the kernel's size.

This was found via -Wmissing-prototypes warnings:

arch/x86/kernel/cpu/intel_cacheinfo.c:349:5: warning: no previous prototype for ‘amd_get_l3_disable_slot’ [-Wmissing-prototypes] arch/x86/kernel/cpu/intel_cacheinfo.c:427:5: warning: no previous prototype for ‘amd_set_l3_disable_slot’ [-Wmissing-prototypes]

also note how we refer to function names in changelogs:
'amd_get_l3_disable_slot()', not 'amd_get_l3_disable_slot'.

This style should be used for the other patches in this series as well, plus the feedback I gave for the extra prototype lines should be followed as well.

Thanks,

Ingo

#9 lore raw

PATCH 6/16 arch: x86: kernel: cpu: Mark function mce_chrdev_write static

In reply to Darshana Padmadas

cpu/mcheck/mce.c defines mce_chrdev_write. No other file uses or defines this function, so make this static.

This eliminates the follwing warning:
arch/x86/kernel/cpu/mcheck/mce.c:1981:9: warning: no previous prototype for ‘mce_chrdev_write’ [-Wmissing-prototypes]

---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +1 -1
index 4c5cd75..b0c9ea7 100644
@@ -1978,7 +1978,7 @@ void register_mce_write_callback(ssize_t (*fn)(struct file *filp,
 }
 EXPORT_SYMBOL_GPL(register_mce_write_callback);
 
-ssize_t mce_chrdev_write(struct file *filp, const char __user *ubuf,
+static ssize_t mce_chrdev_write(struct file *filp, const char __user *ubuf,
 			 size_t usize, loff_t *off)
 {
 	if (mce_write)
Signature · 1 line
1.9.1
#10 lore raw

PATCH 7/16 arch: x86: kernel: Mark internal function EVT_TO_HPET_DEV static

In reply to Darshana Padmadas

hpet.c defines the function EVT_TO_HPET_DEV internally. No other file defines this function. So make this function static.

This eliminates the following warning:

arch/x86/kernel/hpet.c:55:25: warning: no previous prototype for ‘EVT_TO_HPET_DEV’ [-Wmissing-prototypes]

---
 arch/x86/kernel/hpet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/hpet.c +1 -1
index 319bcb9..bdb9e8c 100644
@@ -52,7 +52,7 @@ struct hpet_dev {
 	char				name[10];
 };
 
-inline struct hpet_dev *EVT_TO_HPET_DEV(struct clock_event_device *evtdev)
+static inline struct hpet_dev *EVT_TO_HPET_DEV(struct clock_event_device *evtdev)
 {
 	return container_of(evtdev, struct hpet_dev, evt);
 }
Signature · 1 line
1.9.1
#11 lore raw

PATCH 8/16 arch: x86: kernel: Mark internal functions static in kvm.c

In reply to Darshana Padmadas

kvm.c defines functions kvm_guest_cpu_init and kvm_init_debugfs internally. No other file defines these, so make them static.

This also eliminates the following warnings:

arch/x86/kernel/kvm.c:334:6: warning: no previous prototype for ‘kvm_guest_cpu_init’ [-Wmissing-prototypes] arch/x86/kernel/kvm.c:658:16: warning: no previous prototype for ‘kvm_init_debugfs’ [-Wmissing-prototypes]

---
 arch/x86/kernel/kvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/kvm.c +2 -2
index 94f6434..484f869 100644
@@ -331,7 +331,7 @@ static void kvm_guest_apic_eoi_write(u32 reg, u32 val)
 	apic_write(APIC_EOI, APIC_EOI_ACK);
 }
 
-void kvm_guest_cpu_init(void)
+static void kvm_guest_cpu_init(void)
 {
 	if (!kvm_para_available())
 		return;
@@ -655,7 +655,7 @@ static inline void spin_time_accum_blocked(u64 start)
 static struct dentry *d_spin_debug;
 static struct dentry *d_kvm_debug;
 
-struct dentry *kvm_init_debugfs(void)
+static struct dentry *kvm_init_debugfs(void)
 {
 	d_kvm_debug = debugfs_create_dir("kvm-guest", NULL);
 	if (!d_kvm_debug)
Signature · 1 line
1.9.1
#12 lore raw

PATCH 9/16 arch: x86: kernel: Include <asm/switch_to.h> for function prototype

In reply to Darshana Padmadas

process.c defines function __switch_to_xtra which has a prototype in arch/x86/include/asm/switch_to.h. Include this header file for function prototype for __switch_to_xtra.

This eliminates the following warning:
arch/x86/kernel/process.c:200:6: warning: no previous prototype for ‘__switch_to_xtra’ [-Wmissing-prototypes]

---
 arch/x86/kernel/process.c | 1 +
 1 file changed, 1 insertion(+)
arch/x86/kernel/process.c +1 -0
index e127dda..1c77bc6 100644
@@ -28,6 +28,7 @@
 #include <asm/fpu-internal.h>
 #include <asm/debugreg.h>
 #include <asm/nmi.h>
+#include <asm/switch_to.h>
 
 /*
  * per-CPU TSS segments. Threads are completely 'soft' on Linux,
Signature · 1 line
1.9.1
#13 lore raw

PATCH 10/16 arch: x86: kernel: Add prototype for function sys32_x32_rt_sigreturn

In reply to Darshana Padmadas

signal.c defines the function sys32_x32_rt_sigreturn, which is used in this file and some assembly. So add a prototype for the function.

This eliminates the following warning:
arch/x86/kernel/signal.c:784:17: warning: no previous prototype for ‘sys32_x32_rt_sigreturn’ [-Wmissing-prototypes]

---
 arch/x86/kernel/signal.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/signal.c +3 -0
index 0a62df4..2625c23 100644
@@ -781,6 +781,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
 }
 
 #ifdef CONFIG_X86_X32_ABI
+
+asmlinkage long sys32_x32_rt_sigreturn(void);
+
 asmlinkage long sys32_x32_rt_sigreturn(void)
 {
 	struct pt_regs *regs = current_pt_regs();
Signature · 1 line
1.9.1
#14 lore raw

PATCH 11/16 arch: x86: kernel: Add prototype for smp_reboot_interrupt

In reply to Darshana Padmadas

smp.c defines smp_reboot_interrupt used in this file and in some assembly, so add a prototype for the same in smp.c

This eliminates the following warning:
arch/x86/kernel/smp.c:171:27: warning: no previous prototype for ‘smp_reboot_interrupt’ [-Wmissing-prototypes]

---
 arch/x86/kernel/smp.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/smp.c +2 -0
index be8e1bd..07e8dec 100644
@@ -168,6 +168,8 @@ static int smp_stop_nmi_callback(unsigned int val, struct pt_regs *regs)
  * this function calls the 'stop' function on all other CPUs in the system.
  */
 
+asmlinkage __visible void smp_reboot_interrupt(void);
+
 asmlinkage __visible void smp_reboot_interrupt(void)
 {
 	ack_APIC_irq();
Signature · 1 line
1.9.1
#15 lore raw

PATCH 12/16 arch: x86: kernel: Add prototype for fixup_bad_iret in traps.c

In reply to Darshana Padmadas

traps.c defines the function fixup_bad_iret used in this file only and in some assembly. No header file declares this function so, add a prototype for fixup_bad_iret above the function definition.

This also satisfies the following gcc(-Wmissing-prototypes) warning:
arch/x86/kernel/traps.c:500:24: warning: no previous prototype for ‘fixup_bad_iret’ [-Wmissing-prototypes]

---
 arch/x86/kernel/traps.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/traps.c +3 -0
index fb4cb6a..ab015cd 100644
@@ -497,6 +497,9 @@ struct bad_iret_stack {
 };
 
 asmlinkage __visible notrace
+struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s);
+
+asmlinkage __visible notrace
 struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
 {
 	/*
Signature · 1 line
1.9.1
#16 lore raw

PATCH 13/16 arch: x86: xen: Add prototype for xen_start_kernel in enlighten.c

In reply to Darshana Padmadas

enlighten.c defines xen_start_kernel which is used only in this file and is not defined in any header file. So add a proto- type for the same above the function definition.

This satisfies the -Wmissing-prototypes gcc warning:
arch/x86/xen/enlighten.c:1534:34: warning: no previous prototype for ‘xen_start_kernel’ [-Wmissing-prototypes]

---
 arch/x86/xen/enlighten.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/xen/enlighten.c +2 -0
index 78a881b..4061672 100644
@@ -1531,6 +1531,8 @@ static void __init xen_pvh_early_guest_init(void)
 #endif    /* CONFIG_XEN_PVH */
 
 /* First C function to be called on Xen boot */
+asmlinkage __visible void __init xen_start_kernel(void);
+
 asmlinkage __visible void __init xen_start_kernel(void)
 {
 	struct physdev_set_iopl set_iopl;
Signature · 1 line
1.9.1
#17 lore raw

PATCH 14/16 arch: x86: xen: Mark internal function xen_flush_tlb_all static.

In reply to Darshana Padmadas

xen_flush_tlb_all is defined only in mmu.c, so mark it static.

This eliminates the following gcc warning:

arch/x86/xen/mmu.c:1211:6: warning: no previous prototype for ‘xen_flush_tlb_all’ [-Wmissing-prototypes]

---
 arch/x86/xen/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/mmu.c +1 -1
index 5c1f9ac..14e2fc1 100644
@@ -1208,7 +1208,7 @@ unsigned long xen_read_cr2_direct(void)
 	return this_cpu_read(xen_vcpu_info.arch.cr2);
 }
 
-void xen_flush_tlb_all(void)
+static void xen_flush_tlb_all(void)
 {
 	struct mmuext_op *op;
 	struct multicall_space mcs;
Signature · 1 line
1.9.1
#18 lore raw

PATCH 15/16 arch: x86: xen: Add prototypes for functions defined in mmu.c

In reply to Darshana Padmadas

mmu.c defines the following functions:
__visible pteval_t xen_pte_val(pte_t pte)
__visible pgdval_t xen_pgd_val(pgd_t pgd)
__visible pte_t xen_make_pte(pteval_t pte)
__visible pgd_t xen_make_pgd(pgdval_t pgd)
__visible pmdval_t xen_pmd_val(pmd_t pmd)
__visible pmd_t xen_make_pmd(pmdval_t pmd)
__visible pudval_t xen_pud_val(pud_t pud)
__visible pud_t xen_make_pud(pudval_t pud)

Include prototypes for these files in mmu.h since no header file declares them.

This eliminates the following warnings:
arch/x86/xen/mmu.c:410:20: warning: no previous prototype for ‘xen_pte_val’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:418:20: warning: no previous prototype for ‘xen_pgd_val’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:424:17: warning: no previous prototype for ‘xen_make_pte’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:432:17: warning: no previous prototype for ‘xen_make_pgd’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:439:20: warning: no previous prototype for ‘xen_pmd_val’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:498:17: warning: no previous prototype for ‘xen_make_pmd’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:506:20: warning: no previous prototype for ‘xen_pud_val’ [-Wmissing-prototypes] arch/x86/xen/mmu.c:512:17: warning: no previous prototype for ‘xen_make_pud’ [-Wmissing-prototypes]

---
 arch/x86/xen/mmu.h | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/x86/xen/mmu.h +8 -0
index 73809bb..d38126d 100644
@@ -20,6 +20,14 @@ void  xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
 				  pte_t *ptep, pte_t pte);
 
 unsigned long xen_read_cr2_direct(void);
+pteval_t xen_pte_val(pte_t pte);
+pgdval_t xen_pgd_val(pgd_t pgd);
+pte_t xen_make_pte(pteval_t pte);
+pgd_t xen_make_pgd(pgdval_t pgd);
+pmdval_t xen_pmd_val(pmd_t pmd);
+pmd_t xen_make_pmd(pmdval_t pmd);
+pudval_t xen_pud_val(pud_t pud);
+pud_t xen_make_pud(pudval_t pud);
 
 extern void xen_init_mmu_ops(void);
 extern void xen_hvm_init_mmu_ops(void);
Signature · 1 line
1.9.1
#19 lore raw

PATCH 16/16 arch: x86: xen: Mark internal functions static in setup.c

In reply to Darshana Padmadas

setup.c defines xen_pvmmu_arch_setup and xen_ignore_unusable used only in this file. So mark them static.

This eliminates the following gcc warnings:
arch/x86/xen/setup.c:561:6: warning: no previous prototype for ‘xen_ignore_unusable’ [-Wmissing-prototypes] arch/x86/xen/setup.c:831:13: warning: no previous prototype for ‘xen_pvmmu_arch_setup’ [-Wmissing-prototypes]

---
 arch/x86/xen/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/setup.c +2 -2
index 865e56c..2b3f935 100644
@@ -558,7 +558,7 @@ static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
 	e820_add_region(start, end - start, type);
 }
 
-void xen_ignore_unusable(struct e820entry *list, size_t map_size)
+static void xen_ignore_unusable(struct e820entry *list, size_t map_size)
 {
 	struct e820entry *entry;
 	unsigned int i;
@@ -828,7 +828,7 @@ void xen_enable_syscall(void)
 #endif /* CONFIG_X86_64 */
 }
 
-void __init xen_pvmmu_arch_setup(void)
+static void __init xen_pvmmu_arch_setup(void)
 {
 	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
 	HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
Signature · 1 line
1.9.1