diff mbox series

[v2] ARM: mark prepare_page_table as __init

Message ID 20210512090047.2069033-1-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v2] ARM: mark prepare_page_table as __init | expand

Commit Message

Arnd Bergmann May 12, 2021, 9 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

In some configurations when building with gcc-11, prepare_page_table
does not get inline, which causes a build time warning for a section
mismatch:

WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown)
The function prepare_page_table() references
the (unknown reference) __initdata (unknown).
This is often because prepare_page_table lacks a __initdata
annotation or the annotation of (unknown) is wrong.

Mark the function as __init to avoid the warning regardless of the
inlining, and remove the 'inline' keyword. The compiler is
free to ignore the 'inline' here and it doesn't result in better
object code or more readable source.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v2: remove 'inline', as suggested by Russell and Ard
---
 arch/arm/mm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ard Biesheuvel May 12, 2021, 12:37 p.m. UTC | #1
On Wed, 12 May 2021 at 11:01, Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> In some configurations when building with gcc-11, prepare_page_table
> does not get inline, which causes a build time warning for a section
> mismatch:
>
> WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown)
> The function prepare_page_table() references
> the (unknown reference) __initdata (unknown).
> This is often because prepare_page_table lacks a __initdata
> annotation or the annotation of (unknown) is wrong.
>
> Mark the function as __init to avoid the warning regardless of the
> inlining, and remove the 'inline' keyword. The compiler is
> free to ignore the 'inline' here and it doesn't result in better
> object code or more readable source.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
> v2: remove 'inline', as suggested by Russell and Ard
> ---
>  arch/arm/mm/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index 051f4f82414b..40a1fa5ec93b 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -1246,7 +1246,7 @@ void __init adjust_lowmem_bounds(void)
>         memblock_set_current_limit(memblock_limit);
>  }
>
> -static inline void prepare_page_table(void)
> +static __init void prepare_page_table(void)
>  {
>         unsigned long addr;
>         phys_addr_t end;
> --
> 2.29.2
>
Linus Walleij May 19, 2021, 11:47 p.m. UTC | #2
On Wed, May 12, 2021 at 11:01 AM Arnd Bergmann <arnd@kernel.org> wrote:

> From: Arnd Bergmann <arnd@arndb.de>
>
> In some configurations when building with gcc-11, prepare_page_table
> does not get inline, which causes a build time warning for a section
> mismatch:
>
> WARNING: modpost: vmlinux.o(.text.unlikely+0xce8): Section mismatch in reference from the function prepare_page_table() to the (unknown reference) .init.data:(unknown)
> The function prepare_page_table() references
> the (unknown reference) __initdata (unknown).
> This is often because prepare_page_table lacks a __initdata
> annotation or the annotation of (unknown) is wrong.
>
> Mark the function as __init to avoid the warning regardless of the
> inlining, and remove the 'inline' keyword. The compiler is
> free to ignore the 'inline' here and it doesn't result in better
> object code or more readable source.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> v2: remove 'inline', as suggested by Russell and Ard

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 051f4f82414b..40a1fa5ec93b 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1246,7 +1246,7 @@  void __init adjust_lowmem_bounds(void)
 	memblock_set_current_limit(memblock_limit);
 }
 
-static inline void prepare_page_table(void)
+static __init void prepare_page_table(void)
 {
 	unsigned long addr;
 	phys_addr_t end;