x86, earlyprintk: Fix two 'defined but not used' compile warnings
PATCH 1/1 x86, earlyprintk: Fix two 'defined but not used' compile warnings
Two static functions are only used if CONFIG_PCI is defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static void mem32_serial_out(unsigned long addr, int offset, int value)
^
arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function]
static unsigned int mem32_serial_in(unsigned long addr, int offset)
^--- arch/x86/kernel/early_printk.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/early_printk.c +2 -0
@@ -95,6 +95,7 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ +#ifdef CONFIG_PCI static void mem32_serial_out (unsigned long addr,int offset,int value) {uint32_t *vaddr = (uint32_t *)addr;
@@ -108,6 +109,7 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset)/* shift implied by pointer type */ return readl(vaddr + offset); } +#endif static unsigned int io_serial_in (unsigned long addr,int offset) {
Signature · 1 line
2.1.4
Borislav Petkov
maintainerQuoted 27 lines · Mark Einon
Two static functions are only used if
CONFIG_PCIis defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static voidmem32_serial_out(unsigned long addr, int offset, int value)^ arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function] static unsigned int mem32_serial_in(unsigned long addr, int offset) ^Signed-off-by Mark Einon <[email protected]>--- arch/x86/kernel/early_printk.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kernel/early_printk.c +1
-0@@ -95,6 +95,7 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ +#ifdef CONFIG_PCI static void mem32_serial_out (unsigned long addr,int offset,int value) {uint32_t *vaddr = (uint32_t *)addr;
arch/x86/kernel/early_printk.c static unsigned int mem32_serial_in(unsigned long addr, int offset) · line 112
Quoted 4 lines
arch/x86/kernel/early_printk.c +1
-0@@ -108,6 +109,7 @@ static unsigned int mem32_serial_in(unsigned long addr, int offset)/* shift implied by pointer type */ return readl(vaddr + offset); } +#endif
I'm sceptical we ever build x86 with CONFIG_PCI disabled but whatever.
Instead of adding another #ifdef CONFIG_PCI, please move those two functions right over early_pci_serial_init() inside the #ifdef CONFIG_PCI there.
Thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--PATCH v2 1/1 x86, earlyprintk: Fix two 'defined but not used' compile warnings
In reply to Mark EinonTwo static functions are only used if CONFIG_PCI is defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static void mem32_serial_out(unsigned long addr, int offset, int value)
^
arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function]
static unsigned int mem32_serial_in(unsigned long addr, int offset)
^---
v2 - Move code to another #ifdef instead of creating a new ifdef pair after comment by Borislav Petkov <[email protected]>.
arch/x86/kernel/early_printk.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)
arch/x86/kernel/early_printk.c +20 -14
@@ -95,20 +95,6 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ -static void mem32_serial_out (unsigned long addr,int offset,int value) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -writel (value, vaddr + offset); -} - -static unsigned int mem32_serial_in (unsigned long addr,int offset) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -return readl (vaddr + offset); -} -static unsigned int io_serial_in (unsigned long addr,int offset) {return inb (addr + offset);
@@ -205,6 +191,20 @@ static __init void early_serial_init(char *s) }#ifdef CONFIG_PCI +static void mem32_serial_out (unsigned long addr,int offset,int value) +{ +uint32_t *vaddr = (uint32_t *)addr; +/* shift implied by pointer type */ +writel (value, vaddr + offset); +} + +static unsigned int mem32_serial_in (unsigned long addr,int offset) +{ +uint32_t *vaddr = (uint32_t *)addr; +/* shift implied by pointer type */ +return readl (vaddr + offset); +} +/* * early_pci_serial_init() *
@@ -375,6 +375,12 @@ static int __init setup_early_printk(char *buf)if (!strncmp (buf,"xen" ,3 ))early_console_register (&xenboot_console, keep);#endif +#ifdef CONFIG_EARLY_PRINTK_INTEL_MID +if (!strncmp (buf,"hsu" ,3 )) { +hsu_early_console_init (buf +3 ); +early_console_register (&early_hsu_console, keep); + } +#endif #ifdef CONFIG_EARLY_PRINTK_EFI if (!strncmp (buf,"efi" ,3 ))early_console_register (&early_efi_console, keep);
Signature · 1 line
2.1.4
Quoted 51 lines · Mark Einon
Two static functions are only used if
CONFIG_PCIis defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static voidmem32_serial_out(unsigned long addr, int offset, int value)^ arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function] static unsigned int mem32_serial_in(unsigned long addr, int offset) ^Signed-off-by Mark Einon <[email protected]>---
v2 - Move code to another #ifdef instead of creating a new ifdef pair after comment by Borislav Petkov <[email protected]>.arch/x86/kernel/early_printk.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)arch/x86/kernel/early_printk.c +3
-14@@ -95,20 +95,6 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ -static void mem32_serial_out (unsigned long addr,int offset,int value) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -writel (value, vaddr + offset); -} - -static unsigned int mem32_serial_in (unsigned long addr,int offset) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -return readl (vaddr + offset); -} -static unsigned int io_serial_in (unsigned long addr,int offset) {return inb (addr + offset);@@ -205,6 +191,20 @@ static __init void early_serial_init(char *s) }#ifdef CONFIG_PCI +static void mem32_serial_out (unsigned long addr,int offset,int value) +{ +uint32_t *vaddr = (uint32_t *)addr;
arch/x86/kernel/early_printk.c static __init void early_serial_init(char *s) · line 206
Quoted 10 lines
arch/x86/kernel/early_printk.c +10
-0+/* shift implied by pointer type */ +writel (value, vaddr + offset); +} + +static unsigned int mem32_serial_in (unsigned long addr,int offset) +{ +uint32_t *vaddr = (uint32_t *)addr; +/* shift implied by pointer type */ +return readl (vaddr + offset); +}
btw., while at it, this should use 'u32'.
Quoted 7 lines
arch/x86/kernel/early_printk.c +1
-0+/* * early_pci_serial_init() * @@ -375,6 +375,12 @@ static int __init setup_early_printk(char *buf)if (!strncmp (buf,"xen" ,3 ))early_console_register (&xenboot_console, keep);
arch/x86/kernel/early_printk.c static int __init setup_early_printk(char *buf) · line 386
Quoted 10 lines
arch/x86/kernel/early_printk.c +6
-0#endif +#ifdef CONFIG_EARLY_PRINTK_INTEL_MID +if (!strncmp (buf,"hsu" ,3 )) { +hsu_early_console_init (buf +3 ); +early_console_register (&early_hsu_console, keep); + } +#endif #ifdef CONFIG_EARLY_PRINTK_EFI if (!strncmp (buf,"efi" ,3 ))early_console_register (&early_efi_console, keep);
huh?
Thanks,
Ingo
Quoted 50 lines · Ingo Molnar
Quoted 47 lines · Mark Einon
Two static functions are only used if
CONFIG_PCIis defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static voidmem32_serial_out(unsigned long addr, int offset, int value)^ arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function] static unsigned int mem32_serial_in(unsigned long addr, int offset) ^Signed-off-by Mark Einon <[email protected]>---
v2 - Move code to another #ifdef instead of creating a new ifdef pair after comment by Borislav Petkov <[email protected]>.arch/x86/kernel/early_printk.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-)arch/x86/kernel/early_printk.c +0
-14@@ -95,20 +95,6 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ -static void mem32_serial_out (unsigned long addr,int offset,int value) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -writel (value, vaddr + offset); -} - -static unsigned int mem32_serial_in (unsigned long addr,int offset) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -return readl (vaddr + offset); -} -static unsigned int io_serial_in (unsigned long addr,int offset) {return inb (addr + offset);@@ -205,6 +191,20 @@ static __init void early_serial_init(char *s) }
Quoted 16 lines
Quoted 4 lines
arch/x86/kernel/early_printk.c +3
-0#ifdef CONFIG_PCI +static void mem32_serial_out (unsigned long addr,int offset,int value) +{ +uint32_t *vaddr = (uint32_t *)addr;arch/x86/kernel/early_printk.c static __init void early_serial_init(char *s) · line 206
Quoted 10 lines
arch/x86/kernel/early_printk.c +10
-0+/* shift implied by pointer type */ +writel (value, vaddr + offset); +} + +static unsigned int mem32_serial_in (unsigned long addr,int offset) +{ +uint32_t *vaddr = (uint32_t *)addr; +/* shift implied by pointer type */ +return readl (vaddr + offset); +}btw., while at it, this should use 'u32'.
Sure, I can change this.
Quoted 11 lines
Quoted 11 lines
arch/x86/kernel/early_printk.c +4
-0+/* * early_pci_serial_init() * @@ -375,6 +375,12 @@ static int __init setup_early_printk(char *buf)if (!strncmp (buf,"xen" ,3 ))early_console_register (&xenboot_console, keep);#endif +#ifdef CONFIG_EARLY_PRINTK_INTEL_MID +if (!strncmp (buf,"hsu" ,3 )) { +hsu_early_console_init (buf +3 );
Quoted 8 lines
arch/x86/kernel/early_printk.c static int __init setup_early_printk(char *buf) · line 386
Quoted 6 lines
arch/x86/kernel/early_printk.c +3
-0+ early_console_register(&early_hsu_console, keep); + } +#endif #ifdef CONFIG_EARLY_PRINTK_EFI if (!strncmp (buf,"efi" ,3 ))early_console_register (&early_efi_console, keep);huh?
Ah, my bad - looks like I patched the wrong branch before resending. I'll do a v3 with the other change above.
Mark
PATCH v3 1/1 x86, earlyprintk: Fix two 'defined but not used' compile warnings
In reply to Mark EinonTwo static functions are only used if CONFIG_PCI is defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static void mem32_serial_out(unsigned long addr, int offset, int value)
^
arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function]
static unsigned int mem32_serial_in(unsigned long addr, int offset)
^Also convert a few related instances of uintXX_t to kernel specific uXX defines.
---
v2 - Move code to another #ifdef instead of creating a new ifdef pair after comment by Borislav Petkov <[email protected]>.
v3 - Fixed commit errors from v2, changed some uintXX_t data types to equivalent uXX.
arch/x86/kernel/early_printk.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
arch/x86/kernel/early_printk.c +16 -16
@@ -95,20 +95,6 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ -static void mem32_serial_out (unsigned long addr,int offset,int value) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -writel (value, vaddr + offset); -} - -static unsigned int mem32_serial_in (unsigned long addr,int offset) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -return readl (vaddr + offset); -} -static unsigned int io_serial_in (unsigned long addr,int offset) {return inb (addr + offset);
@@ -205,6 +191,20 @@ static __init void early_serial_init(char *s) }#ifdef CONFIG_PCI +static void mem32_serial_out (unsigned long addr,int offset,int value) +{ +u32 *vaddr = (u32 *)addr; +/* shift implied by pointer type */ +writel (value, vaddr + offset); +} + +static unsigned int mem32_serial_in (unsigned long addr,int offset) +{ +u32 *vaddr = (u32 *)addr; +/* shift implied by pointer type */ +return readl (vaddr + offset); +} +/* * early_pci_serial_init() *
@@ -217,8 +217,8 @@ static __init void early_pci_serial_init(char *s)unsigned divisor;unsigned long baud =DEFAULT_BAUD ;u8 bus, slot, func; -uint32_t classcode, bar0; -uint16_t cmdreg; +u32 classcode, bar0; +u16 cmdreg;char *e;
Signature · 1 line
2.1.4
Quoted 13 lines · Mark Einon
Two static functions are only used if
CONFIG_PCIis defined,so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static voidmem32_serial_out(unsigned long addr, int offset, int value)^ arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function] static unsigned int mem32_serial_in(unsigned long addr, int offset) ^Also convert a few related instances of
uintXX_tto kernel specific uXX defines.Signed-off-by Mark Einon <[email protected]>
Quoted 8 lines
---
v2 - Move code to another #ifdef instead of creating a new ifdef pair after comment by Borislav Petkov <[email protected]>.v3 - Fixed commit errors from v2, changed some
uintXX_tdata types to equivalent uXX.arch/x86/kernel/early_printk.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
Applied, thanks.
Signature · 5 lines
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--tip-bot for Mark Einon
merge bot[tip:x86/cleanups] x86/earlyprintk: Put CONFIG_PCI-only functions under the #ifdef
In reply to Mark Einonx86/earlyprintk: Put CONFIG_PCI-only functions under the #ifdef
Commit-ID: 7f99f8b94c9355acdb14f1be28cb19aac741da68 Gitweb: http://git.kernel.org/tip/7f99f8b94c9355acdb14f1be28cb19aac741da68 Author: Mark Einon <[email protected]> AuthorDate: Wed, 1 Apr 2015 22:32:04 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Fri, 3 Apr 2015 15:21:56 +0200
x86/earlyprintk: Put CONFIG_PCI-only functions under the #ifdef
Two static functions are only used if CONFIG_PCI is defined, so only build them if this is the case. Fixes the build warnings:
arch/x86/kernel/early_printk.c:98:13: warning: ‘mem32_serial_out’ defined but not used [-Wunused-function]
static void mem32_serial_out(unsigned long addr, int offset, int value)
^
arch/x86/kernel/early_printk.c:105:21: warning: ‘mem32_serial_in’ defined but not used [-Wunused-function]
static unsigned int mem32_serial_in(unsigned long addr, int offset)
^Also convert a few related instances of uintXX_t to kernel specific uXX defines.
--- arch/x86/kernel/early_printk.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
arch/x86/kernel/early_printk.c +16 -16
@@ -95,20 +95,6 @@ static unsigned long early_serial_base = 0x3f8; /* ttyS0 */#define DLL 0/* Divisor Latch Low */ #define DLH 1/* Divisor latch High */ -static void mem32_serial_out (unsigned long addr,int offset,int value) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -writel (value, vaddr + offset); -} - -static unsigned int mem32_serial_in (unsigned long addr,int offset) -{ -uint32_t *vaddr = (uint32_t *)addr; -/* shift implied by pointer type */ -return readl (vaddr + offset); -} -static unsigned int io_serial_in (unsigned long addr,int offset) {return inb (addr + offset);
@@ -205,6 +191,20 @@ static __init void early_serial_init(char *s) }#ifdef CONFIG_PCI +static void mem32_serial_out (unsigned long addr,int offset,int value) +{ +u32 *vaddr = (u32 *)addr; +/* shift implied by pointer type */ +writel (value, vaddr + offset); +} + +static unsigned int mem32_serial_in (unsigned long addr,int offset) +{ +u32 *vaddr = (u32 *)addr; +/* shift implied by pointer type */ +return readl (vaddr + offset); +} +/* * early_pci_serial_init() *
@@ -217,8 +217,8 @@ static __init void early_pci_serial_init(char *s)unsigned divisor;unsigned long baud =DEFAULT_BAUD ;u8 bus, slot, func; -uint32_t classcode, bar0; -uint16_t cmdreg; +u32 classcode, bar0; +u16 cmdreg;char *e;