Re: Problems with -rc5 afterall on Dreamcast

From: Satyam Sharma
Date: Sat Jun 23 2007 - 09:31:59 EST


Hi Adrian,

On 6/23/07, Adrian McMenamin <adrian@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Previously it had compiled and built cleanly, but when I added in the
sound driver I got this:

MODPOST vmlinux
WARNING: arch/sh/boards/dreamcast/built-in.o(.data+0x0): Section
mismatch: reference to .init.text: (between 'mv_dreamcast' and
'systemasic_int')

Ok, this one looks to have come from
2c7834a6f15fe6c50ed4766f1bb6f9183b9e2740

Basically, when !SH_GENERIC && !SH_UNKNOWN,
__initmv == (nothing), so the machine vectors will go to .data section.

But all the corresponding .mv_setup members of the sh_machine_vector
are setup to point to functions that are marked __init unconditionally,
which causes these reference warnings. Marking the corresponding
.mv_setup functions as __initmv too would silence these (bogus)
warnings, but Paul must confirm if this is desirable and correct
(basically can it make sense to put *functions* into the .machvec.init
section too)?

Similar cases in:
-> arch/sh/boards/dreamcast/setup.c:dreamcast_setup()
-> arch/sh/boards/hp6xx/setup.c:hp6xx_setup()
-> arch/sh/boards/landisk/setup.c:landisk_setup()
-> arch/sh/boards/mpc1211/setup.c:mpc1211_setup()
-> arch/sh/boards/renesas/hs7751rvoip/setup.c:hs7751rvoip_setup()
-> arch/sh/boards/renesas/r7780rp/setup.c:highlander_setup()
-> arch/sh/boards/renesas/rts7751r2d/setup.c:rts7751r2d_setup()
-> arch/sh/boards/se/7343/setup.c:sh7343se_setup()
-> arch/sh/boards/se/770x/setup.c:smsc_setup()
-> arch/sh/boards/se/7722/setup.c:se7722_setup()
-> arch/sh/boards/se/7780/setup.c:se7780_setup()
-> arch/sh/boards/sh03/setup.c:sh03_setup()
-> arch/sh/boards/snapgear/setup.c:snapgear_setup()
-> arch/sh/boards/superh/microdev/setup.c:microdev_setup()

[ I didn't find these changes in Paul's latest sh-2.6(.22) tree,
but looks like the 2.6.23 dev tree is getting rid of ALIAS_MV.
But I suspect the (__initmv when !GENERIC && !UNKNOWN) .data ->
.init.text (__init) references being warned about here would still exist
there. ]

Janitorial patch attached resolves these bogus warnings by marking
the functions as __initmv too, but if this is wrong, feel free to NAK
it (and also suggest the correct solution :-)

---

sh_machine_vector structs in arch/sh/boards/ are marked __initmv
so that they go to the .machvec.init section (during setup_arch, all
but one would be discarded away) when SH_GENERIC || SH_UNKNOWN.

However, when !SH_GENERIC && !SH_UNKNOWN, __initmv is not
defined so these machine vector structures go to the .data section.

The .mv_setup member points to the setup function that is only ever
called during boot time, and hence the corresponding functions are
marked __init. But this causes modpost to (bogusly) warn about the
.data -> .init.text references during kernel build, thusly:

MODPOST vmlinux
WARNING: arch/sh/boards/dreamcast/built-in.o(.data+0x0): Section
mismatch: reference to .init.text: (between 'mv_dreamcast' and
'systemasic_int')

So, mark the setup functions as __initmv too, to get rid of these
bogus warnings.

Signed-off-by: Satyam Sharma <satyam.sharma@xxxxxxxxx>

---

arch/sh/boards/dreamcast/setup.c | 2 +-
arch/sh/boards/hp6xx/setup.c | 2 +-
arch/sh/boards/landisk/setup.c | 2 +-
arch/sh/boards/mpc1211/setup.c | 2 +-
arch/sh/boards/renesas/hs7751rvoip/setup.c | 2 +-
arch/sh/boards/renesas/r7780rp/setup.c | 2 +-
arch/sh/boards/renesas/rts7751r2d/setup.c | 2 +-
arch/sh/boards/se/7343/setup.c | 2 +-
arch/sh/boards/se/770x/setup.c | 4 ++--
arch/sh/boards/se/7722/setup.c | 2 +-
arch/sh/boards/se/7780/setup.c | 2 +-
arch/sh/boards/sh03/setup.c | 2 +-
arch/sh/boards/snapgear/setup.c | 2 +-
arch/sh/boards/superh/microdev/setup.c | 2 +-
14 files changed, 15 insertions(+), 15 deletions(-)
diff -ruNp c/arch/sh/boards/dreamcast/setup.c d/arch/sh/boards/dreamcast/setup.c
--- c/arch/sh/boards/dreamcast/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/dreamcast/setup.c 2007-06-23 18:35:28.000000000 +0530
@@ -36,7 +36,7 @@ extern int systemasic_irq_demux(int);
void *dreamcast_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
int dreamcast_consistent_free(struct device *, size_t, void *, dma_addr_t);

-static void __init dreamcast_setup(char **cmdline_p)
+static void __initmv dreamcast_setup(char **cmdline_p)
{
int i;

diff -ruNp c/arch/sh/boards/hp6xx/setup.c d/arch/sh/boards/hp6xx/setup.c
--- c/arch/sh/boards/hp6xx/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/hp6xx/setup.c 2007-06-23 18:36:13.000000000 +0530
@@ -55,7 +55,7 @@ static int __init hp6xx_devices_setup(vo
return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices));
}

-static void __init hp6xx_setup(char **cmdline_p)
+static void __initmv hp6xx_setup(char **cmdline_p)
{
u8 v8;
u16 v;
diff -ruNp c/arch/sh/boards/landisk/setup.c d/arch/sh/boards/landisk/setup.c
--- c/arch/sh/boards/landisk/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/landisk/setup.c 2007-06-23 18:36:57.000000000 +0530
@@ -85,7 +85,7 @@ static int __init landisk_devices_setup(

__initcall(landisk_devices_setup);

-static void __init landisk_setup(char **cmdline_p)
+static void __initmv landisk_setup(char **cmdline_p)
{
/* LED ON */
ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
diff -ruNp c/arch/sh/boards/mpc1211/setup.c d/arch/sh/boards/mpc1211/setup.c
--- c/arch/sh/boards/mpc1211/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/mpc1211/setup.c 2007-06-23 18:37:26.000000000 +0530
@@ -311,7 +311,7 @@ __initcall(mpc1211_devices_setup);
/* arch/sh/boards/mpc1211/rtc.c */
void mpc1211_time_init(void);

-static void __init mpc1211_setup(char **cmdline_p)
+static void __initmv mpc1211_setup(char **cmdline_p)
{
unsigned char spd_buf[128];

diff -ruNp c/arch/sh/boards/renesas/hs7751rvoip/setup.c d/arch/sh/boards/renesas/hs7751rvoip/setup.c
--- c/arch/sh/boards/renesas/hs7751rvoip/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/renesas/hs7751rvoip/setup.c 2007-06-23 18:37:48.000000000 +0530
@@ -79,7 +79,7 @@ static int __init hs7751rvoip_cf_init(vo
/*
* Initialize the board
*/
-static void __init hs7751rvoip_setup(char **cmdline_p)
+static void __initmv hs7751rvoip_setup(char **cmdline_p)
{
device_initcall(hs7751rvoip_cf_init);

diff -ruNp c/arch/sh/boards/renesas/r7780rp/setup.c d/arch/sh/boards/renesas/r7780rp/setup.c
--- c/arch/sh/boards/renesas/r7780rp/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/renesas/r7780rp/setup.c 2007-06-23 18:38:12.000000000 +0530
@@ -128,7 +128,7 @@ static void r7780rp_power_off(void)
/*
* Initialize the board
*/
-static void __init highlander_setup(char **cmdline_p)
+static void __initmv highlander_setup(char **cmdline_p)
{
u16 ver = ctrl_inw(PA_VERREG);
int i;
diff -ruNp c/arch/sh/boards/renesas/rts7751r2d/setup.c d/arch/sh/boards/renesas/rts7751r2d/setup.c
--- c/arch/sh/boards/renesas/rts7751r2d/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/renesas/rts7751r2d/setup.c 2007-06-23 18:38:34.000000000 +0530
@@ -158,7 +158,7 @@ static void rts7751r2d_power_off(void)
/*
* Initialize the board
*/
-static void __init rts7751r2d_setup(char **cmdline_p)
+static void __initmv rts7751r2d_setup(char **cmdline_p)
{
u16 ver = ctrl_inw(PA_VERREG);

diff -ruNp c/arch/sh/boards/se/7343/setup.c d/arch/sh/boards/se/7343/setup.c
--- c/arch/sh/boards/se/7343/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/se/7343/setup.c 2007-06-23 18:39:02.000000000 +0530
@@ -56,7 +56,7 @@ static int __init sh7343se_devices_setup
ARRAY_SIZE(sh7343se_platform_devices));
}

-static void __init sh7343se_setup(char **cmdline_p)
+static void __initmv sh7343se_setup(char **cmdline_p)
{
device_initcall(sh7343se_devices_setup);
}
diff -ruNp c/arch/sh/boards/se/770x/setup.c d/arch/sh/boards/se/770x/setup.c
--- c/arch/sh/boards/se/770x/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/se/770x/setup.c 2007-06-23 18:39:46.000000000 +0530
@@ -18,14 +18,14 @@ void init_se_IRQ(void);
/*
* Configure the Super I/O chip
*/
-static void __init smsc_config(int index, int data)
+static void __initmv smsc_config(int index, int data)
{
outb_p(index, INDEX_PORT);
outb_p(data, DATA_PORT);
}

/* XXX: Another candidate for a more generic cchip machine vector */
-static void __init smsc_setup(char **cmdline_p)
+static void __initmv smsc_setup(char **cmdline_p)
{
outb_p(CONFIG_ENTER, CONFIG_PORT);
outb_p(CONFIG_ENTER, CONFIG_PORT);
diff -ruNp c/arch/sh/boards/se/7722/setup.c d/arch/sh/boards/se/7722/setup.c
--- c/arch/sh/boards/se/7722/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/se/7722/setup.c 2007-06-23 18:40:15.000000000 +0530
@@ -101,7 +101,7 @@ static int __init se7722_devices_setup(v
}
device_initcall(se7722_devices_setup);

-static void __init se7722_setup(char **cmdline_p)
+static void __initmv se7722_setup(char **cmdline_p)
{
ctrl_outw(0x010D, FPGA_OUT); /* FPGA */

diff -ruNp c/arch/sh/boards/se/7780/setup.c d/arch/sh/boards/se/7780/setup.c
--- c/arch/sh/boards/se/7780/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/se/7780/setup.c 2007-06-23 18:40:36.000000000 +0530
@@ -78,7 +78,7 @@ device_initcall(se7780_devices_setup);
#define GPIO_PMSELR 0xFFEA0080
#define GPIO_PECR 0xFFEA0008

-static void __init se7780_setup(char **cmdline_p)
+static void __initmv se7780_setup(char **cmdline_p)
{
/* "SH-Linux" on LED Display */
ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
diff -ruNp c/arch/sh/boards/sh03/setup.c d/arch/sh/boards/sh03/setup.c
--- c/arch/sh/boards/sh03/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/sh03/setup.c 2007-06-23 18:41:55.000000000 +0530
@@ -44,7 +44,7 @@ static void __iomem *sh03_ioport_map(uns
/* arch/sh/boards/sh03/rtc.c */
void sh03_time_init(void);

-static void __init sh03_setup(char **cmdline_p)
+static void __initmv sh03_setup(char **cmdline_p)
{
board_time_init = sh03_time_init;
}
diff -ruNp c/arch/sh/boards/snapgear/setup.c d/arch/sh/boards/snapgear/setup.c
--- c/arch/sh/boards/snapgear/setup.c 2007-04-26 08:38:32.000000000 +0530
+++ d/arch/sh/boards/snapgear/setup.c 2007-06-23 18:42:41.000000000 +0530
@@ -88,7 +88,7 @@ static void __init init_snapgear_IRQ(voi
/*
* Initialize the board
*/
-static void __init snapgear_setup(char **cmdline_p)
+static void __initmv snapgear_setup(char **cmdline_p)
{
board_time_init = secureedge5410_rtc_init;
}
diff -ruNp c/arch/sh/boards/superh/microdev/setup.c d/arch/sh/boards/superh/microdev/setup.c
--- c/arch/sh/boards/superh/microdev/setup.c 2007-06-20 17:55:36.000000000 +0530
+++ d/arch/sh/boards/superh/microdev/setup.c 2007-06-23 18:43:51.000000000 +0530
@@ -355,7 +355,7 @@ static int __init smsc_superio_setup(voi
return 0;
}

-static void __init microdev_setup(char **cmdline_p)
+static void __initmv microdev_setup(char **cmdline_p)
{
int * const fpgaRevisionRegister = (int*)(MICRODEV_FPGA_GP_BASE + 0x8ul);
const int fpgaRevision = *fpgaRevisionRegister;