Patchwork arm/tegra: boards: more __init/__initdata annotations

login
register
mail settings
Submitter Olof Johansson
Date Dec. 20, 2011, 4:03 a.m.
Message ID <1324353802-31774-1-git-send-email-olof@lixom.net>
Download mbox | patch
Permalink /patch/132346/
State New, archived
Headers show

Comments

Olof Johansson - Dec. 20, 2011, 4:03 a.m.
Silence a bunch of section warnings, and mark some of the init functions as
__init.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 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(-)
Uwe Kleine-König - Dec. 20, 2011, 8:23 a.m.
On Mon, Dec 19, 2011 at 08:03:22PM -0800, Olof Johansson wrote:
> Silence a bunch of section warnings, and mark some of the init functions as
> __init.
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
>  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(-)
> 
> diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
> index 465808c..84cfbef 100644
> --- a/arch/arm/mach-tegra/board-harmony-pinmux.c
> +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
> @@ -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
Russell King - ARM Linux - Dec. 20, 2011, 8:26 a.m.
On Mon, Dec 19, 2011 at 08:03:22PM -0800, Olof Johansson wrote:
> Silence a bunch of section warnings, and mark some of the init functions as
> __init.
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>
> ---
>  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(-)
> 
> diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
> index 465808c..84cfbef 100644
> --- a/arch/arm/mach-tegra/board-harmony-pinmux.c
> +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
> @@ -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 '='.

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren - Dec. 20, 2011, 4:26 p.m.
Olof Johansson wrote at Monday, December 19, 2011 9:03 PM:
> 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.
Olof Johansson - Dec. 20, 2011, 5:05 p.m.
On Tue, Dec 20, 2011 at 8:26 AM, Stephen Warren <swarren@nvidia.com> wrote:
> Olof Johansson wrote at Monday, December 19, 2011 9:03 PM:
>> 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.

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


-Olof
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olof Johansson - Dec. 20, 2011, 5:06 p.m.
On Tue, Dec 20, 2011 at 12:26 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Mon, Dec 19, 2011 at 08:03:22PM -0800, Olof Johansson wrote:
>> Silence a bunch of section warnings, and mark some of the init functions as
>> __init.
>>
>> Signed-off-by: Olof Johansson <olof@lixom.net>
>> ---
>>  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(-)
>>
>> diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
>> index 465808c..84cfbef 100644
>> --- a/arch/arm/mach-tegra/board-harmony-pinmux.c
>> +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
>> @@ -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 '='.

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
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Olof Johansson - Dec. 20, 2011, 5:32 p.m.
On Tue, Dec 20, 2011 at 9:06 AM, Olof Johansson <olof@lixom.net> wrote:
> On Tue, Dec 20, 2011 at 12:26 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Mon, Dec 19, 2011 at 08:03:22PM -0800, Olof Johansson wrote:
>>> Silence a bunch of section warnings, and mark some of the init functions as
>>> __init.
[...]
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c
index 465808c..84cfbef 100644
--- a/arch/arm/mach-tegra/board-harmony-pinmux.c
+++ b/arch/arm/mach-tegra/board-harmony-pinmux.c
@@ -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);
 }
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index c775572..01997fa 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -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);
 }
diff --git a/arch/arm/mach-tegra/board-seaboard-pinmux.c b/arch/arm/mach-tegra/board-seaboard-pinmux.c
index ad63a89..40236e9 100644
--- a/arch/arm/mach-tegra/board-seaboard-pinmux.c
+++ b/arch/arm/mach-tegra/board-seaboard-pinmux.c
@@ -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);
 }
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index f7ded33..c85626c 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -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,