mbox series

[00/20] x86: address -Wmissing-prototype warnings

Message ID 20230516193549.544673-1-arnd@kernel.org
Headers show
Series x86: address -Wmissing-prototype warnings | expand

Message

Arnd Bergmann May 16, 2023, 7:35 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

This addresses all x86 specific prototype warnings. The majority of the
patches should be straightforward, either adding an #include statement
to get the right header, or ensuring that an unused global function is
left out of the build when the prototype is hidden.

The ones that are a bit awkward are those that just add a prototype to
shut up the warning, but the prototypes are never used for calling the
function because the only caller is in assembler code. I tried to come up
with other ways to shut up the compiler using the asmlinkage annotation,
but with no success.

All of the warnings have to be addressed in some form before the warning
can be enabled by default.

    Arnd

Link: https://people.kernel.org/arnd/missing-prototype-warnings-in-the-kernel


Arnd Bergmann (20):
  x86: move prepare_ftrace_return prototype to header
  x86: ce4100: Mark local functions as 'static'
  x86: apic: hide unused safe_smp_processor_id on UP
  x86: avoid unneeded __div64_32 function definition
  x86: head: add dummy prototype for mk_early_pgtbl_32
  x86: math-emu: include asm/fpu/regset.h
  x86: doublefault: avoid missing-prototype warnings
  x86: highmem: include asm/numa.h for set_highmem_pages_init
  x86: platform_quirks: include linux/pnp.h for arch_pnpbios_disabled
  x86: xen: add missing prototypes
  x86: entry: add  do_SYSENTER_32() prototype
  x86: qspinlock-paravirt: fix mising-prototype warnings
  x86: hibernate: declare global functions in suspend.h
  x86: fbdev: include asm/fb.h as needed
  x86: mce: add copy_mc_fragile_handle_tail prototype
  x86: vdso: include vdso/processor.h
  x86: usercopy: include arch_wb_cache_pmem declaration
  x86: ioremap: add early_memremap_pgprot_adjust prototype
  x86: purgatory: include header for warn() declaration
  x86: olpc: avoid missing-prototype warnings

 arch/x86/boot/compressed/error.c          |  2 +-
 arch/x86/boot/compressed/error.h          |  2 +-
 arch/x86/entry/vdso/vgetcpu.c             |  1 +
 arch/x86/include/asm/div64.h              |  2 ++
 arch/x86/include/asm/doublefault.h        |  4 ++++
 arch/x86/include/asm/ftrace.h             |  3 +++
 arch/x86/include/asm/mce.h                |  3 +++
 arch/x86/include/asm/qspinlock_paravirt.h |  2 ++
 arch/x86/include/asm/syscall.h            |  6 ++++--
 arch/x86/kernel/apic/ipi.c                |  2 ++
 arch/x86/kernel/doublefault_32.c          |  1 +
 arch/x86/kernel/ftrace.c                  |  3 ---
 arch/x86/kernel/head32.c                  |  1 +
 arch/x86/kernel/paravirt.c                |  2 ++
 arch/x86/kernel/platform-quirks.c         |  1 +
 arch/x86/lib/usercopy_64.c                |  1 +
 arch/x86/math-emu/fpu_entry.c             |  1 +
 arch/x86/mm/highmem_32.c                  |  1 +
 arch/x86/pci/ce4100.c                     |  4 ++--
 arch/x86/platform/olpc/olpc_dt.c          |  2 +-
 arch/x86/purgatory/purgatory.c            |  1 +
 arch/x86/video/fbdev.c                    |  1 +
 arch/x86/xen/efi.c                        |  2 ++
 arch/x86/xen/smp.h                        |  3 +++
 arch/x86/xen/xen-ops.h                    | 14 ++++++++++++++
 include/linux/io.h                        |  5 +++++
 include/linux/olpc-ec.h                   |  2 ++
 include/linux/suspend.h                   |  4 ++++
 include/xen/xen.h                         |  3 +++
 kernel/locking/qspinlock_paravirt.h       | 20 ++++++++++----------
 kernel/power/power.h                      |  5 -----
 mm/internal.h                             |  6 ------
 32 files changed, 79 insertions(+), 31 deletions(-)

Comments

Dave Hansen May 18, 2023, 5:31 p.m. UTC | #1
On 5/16/23 12:35, Arnd Bergmann wrote:
> The ones that are a bit awkward are those that just add a prototype to
> shut up the warning, but the prototypes are never used for calling the
> function because the only caller is in assembler code. I tried to come up
> with other ways to shut up the compiler using the asmlinkage annotation,
> but with no success.

I went looking for the same thing.  It's too bad gcc doesn't have an
__attribute__ for it.
Dave Hansen May 18, 2023, 9:56 p.m. UTC | #2
On 5/16/23 12:35, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This addresses all x86 specific prototype warnings. The majority of the
> patches should be straightforward, either adding an #include statement
> to get the right header, or ensuring that an unused global function is
> left out of the build when the prototype is hidden.
> 
> The ones that are a bit awkward are those that just add a prototype to
> shut up the warning, but the prototypes are never used for calling the
> function because the only caller is in assembler code. I tried to come up
> with other ways to shut up the compiler using the asmlinkage annotation,
> but with no success.
> 
> All of the warnings have to be addressed in some form before the warning
> can be enabled by default.

I picked up the ones that were blatantly obvious, but left out 03, 04,
10, 12 and 19 for the moment.

BTW, I think the i386 allyesconfig is getting pretty lightly tested
these days.  I think you and I hit the same mlx4 __bad_copy_from()
compile issue.
Andy Shevchenko May 19, 2023, 9:51 a.m. UTC | #3
On Fri, May 19, 2023 at 12:56 AM Dave Hansen <dave.hansen@intel.com> wrote:
> On 5/16/23 12:35, Arnd Bergmann wrote:

> I picked up the ones that were blatantly obvious, but left out 03, 04,
> 10, 12 and 19 for the moment.

Btw, there is series that went unnoticed

https://lore.kernel.org/all/20211119110017.48510-1-andriy.shevchenko@linux.intel.com/

I dunno why.
Arnd Bergmann May 19, 2023, 12:09 p.m. UTC | #4
On Thu, May 18, 2023, at 23:56, Dave Hansen wrote:
> On 5/16/23 12:35, Arnd Bergmann wrote:
>> 
>> All of the warnings have to be addressed in some form before the warning
>> can be enabled by default.
>
> I picked up the ones that were blatantly obvious, but left out 03, 04,
> 10, 12 and 19 for the moment.

Ok, thanks!

I've already sent a fixed version of patch 10, let me know if you
need anything else for the other ones.

> BTW, I think the i386 allyesconfig is getting pretty lightly tested
> these days.  I think you and I hit the same mlx4 __bad_copy_from()
> compile issue.

I did all my testing on randconfig builds, so I probably caught a lot
of the more obscure corner cases, but it doesn't always hit everything
that is in allyesconfig/allmodconfig.

       Arnd