Skip to contentSkip to conversation

Fix section mismatch warning.

PATCH In review Sanjeev Premi 3 participants 6 messages Nov 19, 2008 – Nov 21, 2008

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

PATCH 1/1 Fix section mismatch warning.

This warning is observed when building for OMAP3EVM with pm-20081106.

WARNING: vmlinux.o(.data+0x89d4): Section mismatch in reference from the variable omap3evm_twldata to the variable .init.data:generic3430_t2scripts_data The variable omap3evm_twldata references
the variable __initdata generic3430_t2scripts_data
If the reference is valid then annotate the
variable with __init* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console,

---
 arch/arm/mach-omap2/board-omap3evm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/board-omap3evm.c +1 -1
index a72772f..65e0bdc 100644
@@ -130,7 +130,7 @@ static struct twl4030_madc_platform_data omap3evm_madc_data = {
 	.irq_line	= 1,
 };
 
-static struct twl4030_platform_data omap3evm_twldata = {
+static struct twl4030_platform_data __initdata omap3evm_twldata = {
 	.irq_base	= TWL4030_IRQ_BASE,
 	.irq_end	= TWL4030_IRQ_END,
 
Signature · 1 line
1.5.6
#1 lore raw

I know that Beagle and Overo get the same warnings, so this isn't really a sufficient fix...

arch/arm/mach-omap2/board-omap3evm.c

Quoted 8 lines · Sanjeev Premi
arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -130,7 +130,7 @@ static struct twl4030_madc_platform_data omap3evm_madc_data = {
         .irq_line       = 1,
  };

arch/arm/mach-omap2/board-omap3evm.c +1 -1
-static struct twl4030_platform_data omap3evm_twldata = {
+static struct twl4030_platform_data __initdata omap3evm_twldata = {

... and that's incorrect in any case, since that data is used by probe() code that's doesn't sit in an init section.

I have the following in my patchset, currently disabled since it conflicts with other patches. And in any case, Beagle can't reboot with these "generic" scripts for some TBD reason.

- Dave

================= CUT HERE

---
 arch/arm/mach-omap2/board-omap3beagle.c       |    2 +-
 arch/arm/mach-omap2/board-omap3evm.c          |    2 +-
 arch/arm/mach-omap2/board-overo.c             |    2 +-
 arch/arm/mach-omap2/twl4030-generic-scripts.c |    3 +++
 arch/arm/mach-omap2/twl4030-generic-scripts.h |    5 +++++
 5 files changed, 11 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
@@ -188,7 +188,7 @@ static struct twl4030_platform_data beag
 	/* platform_data for children goes here */
 	.usb		= &beagle_usb_data,
 	.gpio		= &beagle_gpio_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
arch/arm/mach-omap2/board-omap3evm.c +1 -1
@@ -140,7 +140,7 @@ static struct twl4030_platform_data omap
 	.keypad		= &omap3evm_kp_data,
 	.madc		= &omap3evm_madc_data,
 	.usb		= &omap3evm_usb_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 	.gpio		= &omap3evm_gpio_data,
 };
 
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -162,7 +162,7 @@ static struct twl4030_platform_data over
 	.irq_end	= TWL4030_IRQ_END,
 	.gpio		= &overo_gpio_data,
 	.usb		= &overo_usb_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 };
 
 static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
arch/arm/mach-omap2/twl4030-generic-scripts.c +3 -0
@@ -23,6 +23,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#ifdef CONFIG_TWL4030_POWER
+
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/init.h>
@@ -76,3 +78,4 @@ struct twl4030_power_data generic3430_t2
 };
 
 
+#endif /* CONFIG_TWL4030_POWER */
arch/arm/mach-omap2/twl4030-generic-scripts.h +5 -0
@@ -3,6 +3,11 @@
 
 #include <linux/i2c/twl4030.h>
 
+#ifdef CONFIG_TWL4030_POWER
 extern struct twl4030_power_data generic3430_t2scripts_data;
+#define GENERIC3430_T2SCRIPTS_DATA &generic3430_t2scripts_data
+#else
+#define GENERIC3430_T2SCRIPTS_DATA NULL
+#endif /* CONFIG_TWL4030_POWER */
 
 #endif

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: David Brownell [mailto:[email protected]]
Sent: Thursday, November 20, 2008 5:56 AM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Fix section mismatch warning.

I know that Beagle and Overo get the same warnings, so this isn't really a sufficient fix...

Was trying to fix for EVM. Can extend to these boards once we have a fix.

Quoted 6 lines · Sanjeev Premi
Quoted 4 lines
arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -130,7 +130,7 @@ static struct twl4030_madc_platform_data 
 omap3evm_madc_data = {
Quoted 8 lines

arch/arm/mach-omap2/board-omap3evm.c

Quoted 5 lines
arch/arm/mach-omap2/board-omap3evm.c +0 -0
         .irq_line       = 1,
  };

arch/arm/mach-omap2/board-omap3evm.c +1 -1
-static struct twl4030_platform_data omap3evm_twldata = {
+static struct twl4030_platform_data __initdata omap3evm_twldata = {

... and that's incorrect in any case, since that data is used by probe() code that's doesn't sit in an init section.

Function probe() would be in __devinit. Changing __initdata to __devinit would be fine for compilation. Do you see any issues with it?

BTW, I could not locate the definition of platform_driver for twl4030 to verify if probe() is indeed in __devinit.

Quoted 77 lines

I have the following in my patchset, currently disabled since it conflicts with other patches. And in any case, Beagle can't reboot with these "generic" scripts for some TBD reason.

- Dave

================= CUT HERE

---
 arch/arm/mach-omap2/board-omap3beagle.c       |    2 +-
 arch/arm/mach-omap2/board-omap3evm.c          |    2 +-
 arch/arm/mach-omap2/board-overo.c             |    2 +-
 arch/arm/mach-omap2/twl4030-generic-scripts.c |    3 +++
 arch/arm/mach-omap2/twl4030-generic-scripts.h |    5 +++++
 5 files changed, 11 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/board-omap3beagle.c +1 -1
@@ -188,7 +188,7 @@ static struct twl4030_platform_data beag
 	/* platform_data for children goes here */
 	.usb		= &beagle_usb_data,
 	.gpio		= &beagle_gpio_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 };
 
 static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = {
arch/arm/mach-omap2/board-omap3evm.c +1 -1
@@ -140,7 +140,7 @@ static struct twl4030_platform_data omap
 	.keypad		= &omap3evm_kp_data,
 	.madc		= &omap3evm_madc_data,
 	.usb		= &omap3evm_usb_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 	.gpio		= &omap3evm_gpio_data,
 };
 
arch/arm/mach-omap2/board-overo.c +1 -1
@@ -162,7 +162,7 @@ static struct twl4030_platform_data over
 	.irq_end	= TWL4030_IRQ_END,
 	.gpio		= &overo_gpio_data,
 	.usb		= &overo_usb_data,
-	.power		= &generic3430_t2scripts_data,
+	.power		= GENERIC3430_T2SCRIPTS_DATA,
 };
 
 static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
arch/arm/mach-omap2/twl4030-generic-scripts.c +0 -0
@@ -23,6 +23,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  

02111-1307 USA
*/

arch/arm/mach-omap2/twl4030-generic-scripts.c +3 -0
+#ifdef CONFIG_TWL4030_POWER
+
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/init.h>
@@ -76,3 +78,4 @@ struct twl4030_power_data generic3430_t2  };
 
 
+#endif /* CONFIG_TWL4030_POWER */
arch/arm/mach-omap2/twl4030-generic-scripts.h +3 -0
@@ -3,6 +3,11 @@
 
 #include <linux/i2c/twl4030.h>
 
+#ifdef CONFIG_TWL4030_POWER
 extern struct twl4030_power_data generic3430_t2scripts_data;
+#define GENERIC3430_T2SCRIPTS_DATA &generic3430_t2scripts_data #else 
+#define GENERIC3430_T2SCRIPTS_DATA NULL #endif /* 

CONFIG_TWL4030_POWER
+*/

Quoted 4 lines

#endif

--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 8 lines · Sanjeev
Quoted 8 lines

-----Original Message-----
From: David Brownell [mailto:[email protected]]
Sent: Thursday, November 20, 2008 5:56 AM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Fix section mismatch warning.

Quoted 19 lines
Quoted 2 lines

I know that Beagle and Overo get the same warnings, so this isn't really a sufficient fix...

Was trying to fix for EVM. Can extend to these boards once we have a fix.

Quoted 14 lines · Sanjeev Premi

arch/arm/mach-omap2/board-omap3evm.c

Quoted 9 lines
arch/arm/mach-omap2/board-omap3evm.c +0 -0
@@ -130,7 +130,7 @@ static struct twl4030_madc_platform_data 
 omap3evm_madc_data = {
         .irq_line       = 1,
  };

arch/arm/mach-omap2/board-omap3evm.c +1 -1
-static struct twl4030_platform_data omap3evm_twldata = {
+static struct twl4030_platform_data __initdata omap3evm_twldata = {

... and that's incorrect in any case, since that data is used by probe() code that's doesn't sit in an init section.

__initdata_or_module would do the trick for static and dynamically linked modules. When building it statically, we'd get a bit of shrinkage, right ?

Quoted 2 lines

Function probe() would be in __devinit. Changing __initdata to __devinit would be fine for compilation. Do you see any issues with it?

doesn't make sense.

Quoted 2 lines

BTW, I could not locate the definition of platform_driver for twl4030 to verify if probe() is indeed in __devinit.

It's in drivers/base/platform.c

Signature · 5 lines
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 8 lines · Felipe Balbi
Quoted 5 lines
Quoted 5 lines

Review

Quoted 2 lines
(quoted diff) +1 -1
-static struct twl4030_platform_data omap3evm_twldata = {
+static struct twl4030_platform_data __initdata omap3evm_twldata = {

... and that's incorrect in any case, since that data is used by probe() code that's doesn't sit in an init section.

__initdata_or_module would do the trick for static and dynamically linked modules.

Not in this case. Recall there are several drivers who would all need to be using non-hotpluggable structures ... but since the root of their tree must be hotpluggable, they can't work that way.

Quoted 2 lines

When building it statically, we'd get a bit of
shrinkage, right ?

Can't work that way.

#5 lore raw
In reply to Premi, Sanjeev
Quoted 2 lines · Sanjeev

BTW, I could not locate the definition of platform_driver for twl4030 to verify if probe() is indeed in __devinit.

In this case, drivers/mfd/twl4030-power.c is what will use that data, and it's called from drivers/mfd/twl4030-core.c ... which is an I2C client.

I don't know of any cases when it's safe to have I2C drivers have their probe() use an __init or __devinit annotation.