Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428768 > unrolled thread

[PATCH] ARM: tegra: remove board_init_funcs array

Started byArnd Bergmann <arnd@arndb.de>
First post2016-06-22 14:50 +0200
Last post2016-06-22 15:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ARM: tegra: remove board_init_funcs array Arnd Bergmann <arnd@arndb.de> - 2016-06-22 14:50 +0200
    Re: [PATCH] ARM: tegra: remove board_init_funcs array Thierry Reding <thierry.reding@gmail.com> - 2016-06-22 15:10 +0200
      Re: [PATCH] ARM: tegra: remove board_init_funcs array Arnd Bergmann <arnd@arndb.de> - 2016-06-22 15:10 +0200
        Re: [PATCH] ARM: tegra: remove board_init_funcs array Thierry Reding <thierry.reding@gmail.com> - 2016-06-22 15:40 +0200

#1428768 — [PATCH] ARM: tegra: remove board_init_funcs array

FromArnd Bergmann <arnd@arndb.de>
Date2016-06-22 14:50 +0200
Subject[PATCH] ARM: tegra: remove board_init_funcs array
Message-ID<rMPLr-3pV-15@gated-at.bofh.it>
In a configuration that enables CONFIG_UBSAN_SANITIZE_ALL, I am getting
a section mismatch warning for tegra20:

WARNING: arch/arm/mach-tegra/built-in.o(.data+0x6e0): Section mismatch in reference from the variable board_init_funcs to the function .init.text:paz00_init()

The array is no longer useful here since there is only one entry,
so we can simply call the function directly after checking
of_machine_is_compatible(). This fixes the section mismatch
and is easier to read.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-tegra/tegra.c | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c
index 2378fa560a21..42d7ee9658fa 100644
--- a/arch/arm/mach-tegra/tegra.c
+++ b/arch/arm/mach-tegra/tegra.c
@@ -118,32 +118,14 @@ out:
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
 }
 
-static void __init paz00_init(void)
-{
-	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
-		tegra_paz00_wifikill_init();
-}
-
-static struct {
-	char *machine;
-	void (*init)(void);
-} board_init_funcs[] = {
-	{ "compal,paz00", paz00_init },
-};
-
 static void __init tegra_dt_init_late(void)
 {
-	int i;
-
 	tegra_init_suspend();
 	tegra_cpuidle_init();
 
-	for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
-		if (of_machine_is_compatible(board_init_funcs[i].machine)) {
-			board_init_funcs[i].init();
-			break;
-		}
-	}
+	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) &&
+	    of_machine_is_compatible("compal,paz00"))
+		tegra_paz00_wifikill_init();
 }
 
 static const char * const tegra_dt_board_compat[] = {
-- 
2.9.0

[toc] | [next] | [standalone]


#1428774

FromThierry Reding <thierry.reding@gmail.com>
Date2016-06-22 15:10 +0200
Message-ID<rMQ4N-3U5-1@gated-at.bofh.it>
In reply to#1428768

[Multipart message — attachments visible in raw view] — view raw

On Wed, Jun 22, 2016 at 02:39:41PM +0200, Arnd Bergmann wrote:
> In a configuration that enables CONFIG_UBSAN_SANITIZE_ALL, I am getting
> a section mismatch warning for tegra20:
> 
> WARNING: arch/arm/mach-tegra/built-in.o(.data+0x6e0): Section mismatch in reference from the variable board_init_funcs to the function .init.text:paz00_init()
> 
> The array is no longer useful here since there is only one entry,
> so we can simply call the function directly after checking
> of_machine_is_compatible(). This fixes the section mismatch
> and is easier to read.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/arm/mach-tegra/tegra.c | 24 +++---------------------
>  1 file changed, 3 insertions(+), 21 deletions(-)

Shouldn't these section mismatches show up with default builds? I
haven't seen any when building Tegra configurations.

I'm going to apply this patch because I think it's useful, but it sure
would be nice to know why I need to enable this new UBSAN stuff to get
these warnings now.

Thierry

[toc] | [prev] | [next] | [standalone]


#1428776

FromArnd Bergmann <arnd@arndb.de>
Date2016-06-22 15:10 +0200
Message-ID<rMQ4N-3U5-3@gated-at.bofh.it>
In reply to#1428774
On Wednesday, June 22, 2016 2:50:13 PM CEST Thierry Reding wrote:
> 
> Not enough information to check signature validity.
> On Wed, Jun 22, 2016 at 02:39:41PM +0200, Arnd Bergmann wrote:
> > In a configuration that enables CONFIG_UBSAN_SANITIZE_ALL, I am getting
> > a section mismatch warning for tegra20:
> > 
> > WARNING: arch/arm/mach-tegra/built-in.o(.data+0x6e0): Section mismatch in reference from the variable board_init_funcs to the function .init.text:paz00_init()
> > 
> > The array is no longer useful here since there is only one entry,
> > so we can simply call the function directly after checking
> > of_machine_is_compatible(). This fixes the section mismatch
> > and is easier to read.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> >  arch/arm/mach-tegra/tegra.c | 24 +++---------------------
> >  1 file changed, 3 insertions(+), 21 deletions(-)
> 
> Shouldn't these section mismatches show up with default builds? I
> haven't seen any when building Tegra configurations.
> 
> I'm going to apply this patch because I think it's useful, but it sure
> would be nice to know why I need to enable this new UBSAN stuff to get
> these warnings now.

It depends on the how aggressive the inlining works. Without UBSAN,
gcc seems to completely optimze away the loop and just the function
directly, which it can do because 'board_init_funcs' is static.

I assume that the UBSAN object overflow check has the effect of
not dropping the symbol so it can check the size.

	Arnd

[toc] | [prev] | [next] | [standalone]


#1428797

FromThierry Reding <thierry.reding@gmail.com>
Date2016-06-22 15:40 +0200
Message-ID<rMQxQ-44t-17@gated-at.bofh.it>
In reply to#1428776

[Multipart message — attachments visible in raw view] — view raw

On Wed, Jun 22, 2016 at 03:05:35PM +0200, Arnd Bergmann wrote:
> On Wednesday, June 22, 2016 2:50:13 PM CEST Thierry Reding wrote:
> > 
> > Not enough information to check signature validity.
> > On Wed, Jun 22, 2016 at 02:39:41PM +0200, Arnd Bergmann wrote:
> > > In a configuration that enables CONFIG_UBSAN_SANITIZE_ALL, I am getting
> > > a section mismatch warning for tegra20:
> > > 
> > > WARNING: arch/arm/mach-tegra/built-in.o(.data+0x6e0): Section mismatch in reference from the variable board_init_funcs to the function .init.text:paz00_init()
> > > 
> > > The array is no longer useful here since there is only one entry,
> > > so we can simply call the function directly after checking
> > > of_machine_is_compatible(). This fixes the section mismatch
> > > and is easier to read.
> > > 
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > ---
> > >  arch/arm/mach-tegra/tegra.c | 24 +++---------------------
> > >  1 file changed, 3 insertions(+), 21 deletions(-)
> > 
> > Shouldn't these section mismatches show up with default builds? I
> > haven't seen any when building Tegra configurations.
> > 
> > I'm going to apply this patch because I think it's useful, but it sure
> > would be nice to know why I need to enable this new UBSAN stuff to get
> > these warnings now.
> 
> It depends on the how aggressive the inlining works. Without UBSAN,
> gcc seems to completely optimze away the loop and just the function
> directly, which it can do because 'board_init_funcs' is static.
> 
> I assume that the UBSAN object overflow check has the effect of
> not dropping the symbol so it can check the size.

Ah, I see. Thanks.

Thierry

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web