Skip to contentSkip to conversation

arm/tegra: boards: more __init/__initdata annotations

PATCH New Olof Johansson 4 participants 7 messages Dec 20, 2011

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

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

Silence a bunch of section warnings, and mark some of the init functions as __init.

---
 arch/arm/mach-tegra/board-harmony-pinmux.c   |    8 ++++----
 arch/arm/mach-tegra/board-paz00-pinmux.c     |    8 ++++----
 arch/arm/mach-tegra/board-seaboard-pinmux.c  |   16 ++++++++--------
 arch/arm/mach-tegra/board-trimslice-pinmux.c |    4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +4 -4
index 465808c..84cfbef 100644
@@ -25,7 +25,7 @@
 #include "board-harmony.h"
 #include "board-pinmux.h"
 
-static struct tegra_pingroup_config harmony_pinmux[] = {
+static __initdata struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_ATA,   TEGRA_MUX_IDE,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 	{TEGRA_PINGROUP_ATB,   TEGRA_MUX_SDIO4,         TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 	{TEGRA_PINGROUP_ATC,   TEGRA_MUX_NAND,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
@@ -144,7 +144,7 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 };
 
-static struct tegra_gpio_table gpio_table[] = {
+static __initdata struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD2_CD,		.enable = true	},
 	{ .gpio = TEGRA_GPIO_SD2_WP,		.enable = true	},
 	{ .gpio = TEGRA_GPIO_SD2_POWER,		.enable = true	},
@@ -157,14 +157,14 @@ static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_EXT_MIC_EN,	.enable = true	},
 };
 
-static struct tegra_board_pinmux_conf conf = {
+static __initdata struct tegra_board_pinmux_conf conf = {
 	.pgs = harmony_pinmux,
 	.pg_count = ARRAY_SIZE(harmony_pinmux),
 	.gpios = gpio_table,
 	.gpio_count = ARRAY_SIZE(gpio_table),
 };
 
-void harmony_pinmux_init(void)
+void __init harmony_pinmux_init(void)
 {
 	tegra_board_pinmux_init(&conf, NULL);
 }
arch/arm/mach-tegra/board-paz00-pinmux.c +4 -4
index c775572..01997fa 100644
@@ -25,7 +25,7 @@
 #include "board-paz00.h"
 #include "board-pinmux.h"
 
-static struct tegra_pingroup_config paz00_pinmux[] = {
+static __initdata struct tegra_pingroup_config paz00_pinmux[] = {
 	{TEGRA_PINGROUP_ATA,   TEGRA_MUX_GMI,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 	{TEGRA_PINGROUP_ATB,   TEGRA_MUX_SDIO4,         TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 	{TEGRA_PINGROUP_ATC,   TEGRA_MUX_GMI,           TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
@@ -144,7 +144,7 @@ static struct tegra_pingroup_config paz00_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
 };
 
-static struct tegra_gpio_table gpio_table[] = {
+static __initdata struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD1_CD,	.enable = true },
 	{ .gpio = TEGRA_GPIO_SD1_WP,	.enable = true },
 	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
@@ -154,14 +154,14 @@ static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TEGRA_WIFI_LED,	.enable = true },
 };
 
-static struct tegra_board_pinmux_conf conf = {
+static __initdata struct tegra_board_pinmux_conf conf = {
 	.pgs = paz00_pinmux,
 	.pg_count = ARRAY_SIZE(paz00_pinmux),
 	.gpios = gpio_table,
 	.gpio_count = ARRAY_SIZE(gpio_table),
 };
 
-void paz00_pinmux_init(void)
+void __init paz00_pinmux_init(void)
 {
 	tegra_board_pinmux_init(&conf, NULL);
 }
arch/arm/mach-tegra/board-seaboard-pinmux.c +8 -8
index ad63a89..40236e9 100644
@@ -179,14 +179,14 @@ static __initdata struct tegra_pingroup_config ventana_pinmux[] = {
 	{TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL,    TEGRA_TRI_TRISTATE},
 };
 
-static struct tegra_gpio_table common_gpio_table[] = {
+static __initdata struct tegra_gpio_table common_gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_SD2_CD,		.enable = true },
 	{ .gpio = TEGRA_GPIO_SD2_WP,		.enable = true },
 	{ .gpio = TEGRA_GPIO_SD2_POWER,		.enable = true },
 	{ .gpio = TEGRA_GPIO_CDC_IRQ,		.enable = true },
 };
 
-static struct tegra_gpio_table seaboard_gpio_table[] = {
+static __initdata struct tegra_gpio_table seaboard_gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_LIDSWITCH,		.enable = true },
 	{ .gpio = TEGRA_GPIO_POWERKEY,		.enable = true },
 	{ .gpio = TEGRA_GPIO_HP_DET,		.enable = true },
@@ -194,7 +194,7 @@ static struct tegra_gpio_table seaboard_gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_USB1,		.enable = true },
 };
 
-static struct tegra_gpio_table ventana_gpio_table[] = {
+static __initdata struct tegra_gpio_table ventana_gpio_table[] = {
 	/* hp_det */
 	{ .gpio = TEGRA_GPIO_PW2,		.enable = true },
 	/* int_mic_en */
@@ -203,14 +203,14 @@ static struct tegra_gpio_table ventana_gpio_table[] = {
 	{ .gpio = TEGRA_GPIO_PX1,		.enable = true },
 };
 
-static struct tegra_board_pinmux_conf common_conf = {
+static __initdata struct tegra_board_pinmux_conf common_conf = {
 	.pgs = common_pinmux,
 	.pg_count = ARRAY_SIZE(common_pinmux),
 	.gpios = common_gpio_table,
 	.gpio_count = ARRAY_SIZE(common_gpio_table),
 };
 
-static struct tegra_board_pinmux_conf seaboard_conf = {
+static __initdata struct tegra_board_pinmux_conf seaboard_conf = {
 	.pgs = seaboard_pinmux,
 	.pg_count = ARRAY_SIZE(seaboard_pinmux),
 	.drives = seaboard_drive_pinmux,
@@ -219,19 +219,19 @@ static struct tegra_board_pinmux_conf seaboard_conf = {
 	.gpio_count = ARRAY_SIZE(seaboard_gpio_table),
 };
 
-static struct tegra_board_pinmux_conf ventana_conf = {
+static __initdata struct tegra_board_pinmux_conf ventana_conf = {
 	.pgs = ventana_pinmux,
 	.pg_count = ARRAY_SIZE(ventana_pinmux),
 	.gpios = ventana_gpio_table,
 	.gpio_count = ARRAY_SIZE(ventana_gpio_table),
 };
 
-void seaboard_pinmux_init(void)
+void __init seaboard_pinmux_init(void)
 {
 	tegra_board_pinmux_init(&common_conf, &seaboard_conf);
 }
 
-void ventana_pinmux_init(void)
+void __init ventana_pinmux_init(void)
 {
 	tegra_board_pinmux_init(&common_conf, &ventana_conf);
 }
arch/arm/mach-tegra/board-trimslice-pinmux.c +2 -2
index f7ded33..c85626c 100644
@@ -144,7 +144,7 @@ static __initdata struct tegra_pingroup_config trimslice_pinmux[] = {
 	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,      TEGRA_TRI_NORMAL},
 };
 
-static struct tegra_gpio_table gpio_table[] = {
+static __initdata struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TRIMSLICE_GPIO_SD4_CD, .enable = true	}, /* mmc4 cd */
 	{ .gpio = TRIMSLICE_GPIO_SD4_WP, .enable = true	}, /* mmc4 wp */
 
@@ -152,7 +152,7 @@ static struct tegra_gpio_table gpio_table[] = {
 	{ .gpio = TRIMSLICE_GPIO_USB2_RST,  .enable = true }, /* USB2 PHY rst */
 };
 
-static struct tegra_board_pinmux_conf conf = {
+static __initdata struct tegra_board_pinmux_conf conf = {
 	.pgs = trimslice_pinmux,
 	.pg_count = ARRAY_SIZE(trimslice_pinmux),
 	.gpios = gpio_table,
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

Quoted 16 lines · Olof Johansson

Silence a bunch of section warnings, and mark some of the init functions as __init.

---
 arch/arm/mach-tegra/board-harmony-pinmux.c   |    8 ++++----
 arch/arm/mach-tegra/board-paz00-pinmux.c     |    8 ++++----
 arch/arm/mach-tegra/board-seaboard-pinmux.c  |   16 ++++++++--------
 arch/arm/mach-tegra/board-trimslice-pinmux.c |    4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +0 -0
index 465808c..84cfbef 100644

arch/arm/mach-tegra/board-harmony-pinmux.c line 28

Quoted 5 lines
arch/arm/mach-tegra/board-harmony-pinmux.c +1 -1
@@ -25,7 +25,7 @@
 #include "board-harmony.h"
 #include "board-pinmux.h"
 
-static struct tegra_pingroup_config harmony_pinmux[] = {
+static __initdata struct tegra_pingroup_config harmony_pinmux[] = {

The correct syntax is:

	static struct tegra_pingroup_config harmony_pinmux[] __initdata = {

that is, __initdata has to be at the end.

I havn't looked, but it might be possible to mark these as const, too (and then use __initconst instead of __initdata).

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

In reply to Olof Johansson
Quoted 16 lines · Olof Johansson

Silence a bunch of section warnings, and mark some of the init functions as __init.

---
 arch/arm/mach-tegra/board-harmony-pinmux.c   |    8 ++++----
 arch/arm/mach-tegra/board-paz00-pinmux.c     |    8 ++++----
 arch/arm/mach-tegra/board-seaboard-pinmux.c  |   16 ++++++++--------
 arch/arm/mach-tegra/board-trimslice-pinmux.c |    4 ++--
 4 files changed, 18 insertions(+), 18 deletions(-)
arch/arm/mach-tegra/board-harmony-pinmux.c +0 -0
index 465808c..84cfbef 100644

arch/arm/mach-tegra/board-harmony-pinmux.c line 28

Quoted 5 lines
arch/arm/mach-tegra/board-harmony-pinmux.c +1 -1
@@ -25,7 +25,7 @@
 #include "board-harmony.h"
 #include "board-pinmux.h"
 
-static struct tegra_pingroup_config harmony_pinmux[] = {
+static __initdata struct tegra_pingroup_config harmony_pinmux[] = {

__initdata goes at the end of the declaration - just before the '='.

#3 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

Quoted 20 lines · Russell King - ARM Linux
Quoted 19 lines · Olof Johansson

Silence a bunch of section warnings, and mark some of the init functions as __init.

---

?arch/arm/mach-tegra/board-harmony-pinmux.c ? | ? ?8 ++++----
?arch/arm/mach-tegra/board-paz00-pinmux.c ? ? | ? ?8 ++++----
?arch/arm/mach-tegra/board-seaboard-pinmux.c ?| ? 16 ++++++++--------
?arch/arm/mach-tegra/board-trimslice-pinmux.c | ? ?4 ++--

?4 files changed, 18 insertions(+), 18 deletions(-)

arch/arm/mach-tegra/board-harmony-pinmux.c +0 -0
index 465808c..84cfbef 100644
@@ -25,7 +25,7 @@

?#include "board-harmony.h"
?#include "board-pinmux.h"

Quoted 4 lines

arch/arm/mach-tegra/board-harmony-pinmux.c line 28

Quoted 2 lines
arch/arm/mach-tegra/board-harmony-pinmux.c +1 -1
-static struct tegra_pingroup_config harmony_pinmux[] = {
+static __initdata struct tegra_pingroup_config harmony_pinmux[] = {

__initdata goes at the end of the declaration - just before the '='.

Thanks for pointing it out -- looks like a couple of other instances use the wrong location as well (probably added by me in the past). I'll respin the patch, and fix up those cases as well.

-Olof

#4 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

Quoted 5 lines · Olof Johansson
Quoted 3 lines · Russell King - ARM Linux
Quoted 2 lines · Olof Johansson

Silence a bunch of section warnings, and mark some of the init functions as __init.

[...]

Quoted 3 lines

Thanks for pointing it out -- looks like a couple of other instances use the wrong location as well (probably added by me in the past). I'll respin the patch, and fix up those cases as well.

Actually, after some brief discussion on IRC, I'll go the other way
instead: These tables are all moving to devicetree in the next release or so, and it's uncertain what functions should (long-term) be __init and not. For now, I'll just remove __initdata from the seaboard pinmux tables. Sending separate patch for that.

-Olof

#5 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

In reply to Olof Johansson

Olof Johansson wrote at Monday, December 19, 2011 9:03 PM:

Quoted 2 lines

Silence a bunch of section warnings, and mark some of the init functions as __init.

Is it correct to mark these as __init?

With my recent patch "arm/tegra: Use bus notifiers to trigger pinmux setup", this data all gets used at pinmux/GPIO device probe time. Still, I suppose that does all get triggered by tegra_dt_init() which is __init, so if a device is guaranteed to probe as soon as a device registration and driver exist for it, then everything you've marked as __init really is guaranteed to be used then.

Signature · 1 line
nvpublic
#6 lore raw

PATCH 1/1 arm/tegra: boards: more __init/__initdata annotations

Quoted 4 lines · Stephen Warren

Olof Johansson wrote at Monday, December 19, 2011 9:03 PM:

Quoted 2 lines

Silence a bunch of section warnings, and mark some of the init functions as __init.

Quoted 8 lines

Is it correct to mark these as __init?

With my recent patch "arm/tegra: Use bus notifiers to trigger pinmux setup", this data all gets used at pinmux/GPIO device probe time. Still, I suppose that does all get triggered by tegra_dt_init() which is __init, so if a device is guaranteed to probe as soon as a device registration and driver exist for it, then everything you've marked as __init really is guaranteed to be used then.

Ah, good point. I'll leave the functions alone until the new interface settles down.

-Olof