Skip to contentSkip to conversation

Cleanups for the mini2440 board

PATCH New Wolfram Sang 4 participants 13 messages Jul 7, 2011 – Jul 8, 2011

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

cover Cleanups for the mini2440 board

When compiling 3.0-rc6 for a mini2440, I noticed a few build warnings (some seem to have been there for years!). Give the platform a little love...

Regards,

Wolfram

Wolfram Sang (4):
arm: plat-s3c24xx: dma: don't use uninitialized variable
arm: plat-s3c24xx: dma: drop return codes in void function
arm: mach-s3c2440: dma: fix section mismatch
arm: mach-s3c2440: mini2440: fix section mismatch

 arch/arm/mach-s3c2440/dma.c           |    2 +-
 arch/arm/mach-s3c2440/mach-mini2440.c |    2 +-
 arch/arm/plat-s3c24xx/dma.c           |   12 +++---------
 3 files changed, 5 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/4 arm: plat-s3c24xx: dma: don't use uninitialized variable

Commit 8970ef47 (S3C24XX: Remove hardware specific registers from DMA calls) removed the parameter dcon in s3c2410_dma_config() and calculates it on its own. So the debug-output for the old parameter can go, too. Fixes:

arch/arm/plat-s3c24xx/dma.c: In function 's3c2410_dma_config':
arch/arm/plat-s3c24xx/dma.c:1030:2: warning: 'dcon' is used uninitialized in this function

---
 arch/arm/plat-s3c24xx/dma.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/plat-s3c24xx/dma.c +2 -6
index 2abf966..a5b3684 100644
@@ -1027,17 +1027,13 @@ int s3c2410_dma_config(unsigned int channel,
 	struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
 	unsigned int dcon;
 
-	pr_debug("%s: chan=%d, xfer_unit=%d, dcon=%08x\n",
-		 __func__, channel, xferunit, dcon);
+	pr_debug("%s: chan=%d, xfer_unit=%d\n", __func__, channel, xferunit);
 
 	if (chan == NULL)
 		return -EINVAL;
 
-	pr_debug("%s: Initial dcon is %08x\n", __func__, dcon);
-
 	dcon = chan->dcon & dma_sel.dcon_mask;
-
-	pr_debug("%s: New dcon is %08x\n", __func__, dcon);
+	pr_debug("%s: dcon is %08x\n", __func__, dcon);
 
 	switch (chan->req_ch) {
 	case DMACH_I2S_IN:
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 1/4 arm: plat-s3c24xx: dma: don't use uninitialized variable

Quoted 8 lines · Wolfram Sang

Commit 8970ef47 (S3C24XX: Remove hardware specific registers from DMA calls) removed the parameter dcon in s3c2410_dma_config() and calculates it on its own. So the debug-output for the old parameter can go, too. Fixes:

arch/arm/plat-s3c24xx/dma.c: In function 's3c2410_dma_config':
arch/arm/plat-s3c24xx/dma.c:1030:2: warning: 'dcon' is used uninitialized

in this

Quoted 14 lines

function

---
 arch/arm/plat-s3c24xx/dma.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/plat-s3c24xx/dma.c +0 -0
index 2abf966..a5b3684 100644

arch/arm/plat-s3c24xx/dma.c int s3c2410_dma_config(unsigned int channel, · line 1030

Quoted 6 lines
arch/arm/plat-s3c24xx/dma.c +1 -2
@@ -1027,17 +1027,13 @@ int s3c2410_dma_config(unsigned int channel,
 	struct s3c2410_dma_chan *chan = s3c_dma_lookup_channel(channel);
 	unsigned int dcon;
 
-	pr_debug("%s: chan=%d, xfer_unit=%d, dcon=%08x\n",
-		 __func__, channel, xferunit, dcon);
+	pr_debug("%s: chan=%d, xfer_unit=%d\n", __func__, channel,

xferunit);

Quoted 14 lines
arch/arm/plat-s3c24xx/dma.c +1 -5
 	if (chan == NULL)
 		return -EINVAL;
 
-	pr_debug("%s: Initial dcon is %08x\n", __func__, dcon);
-
 	dcon = chan->dcon & dma_sel.dcon_mask;
-
-	pr_debug("%s: New dcon is %08x\n", __func__, dcon);
+	pr_debug("%s: dcon is %08x\n", __func__, dcon);
 
 	switch (chan->req_ch) {
 	case DMACH_I2S_IN:
--
Quoted 1 line

1.7.5.4

OK, will apply.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#3 lore raw

PATCH 2/4 arm: plat-s3c24xx: dma: drop return codes in void function

In reply to Wolfram Sang

Commit bb072c3c (ARM / Samsung: Use struct syscore_ops for "core" power management) turned s3c2410_dma_resume_chan() from int to void. So, drop the actual return values, too. Fixes:

arch/arm/plat-s3c24xx/dma.c: In function 's3c2410_dma_resume_chan':
arch/arm/plat-s3c24xx/dma.c:1238:3: warning: 'return' with a value, in function returning void arch/arm/plat-s3c24xx/dma.c:1250:2: warning: 'return' with a value, in function returning void

Cc Rafael J. Wysocki <[email protected]>
Cc Kukjin Kim <[email protected]>
---
 arch/arm/plat-s3c24xx/dma.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-s3c24xx/dma.c +1 -3
index a5b3684..a79a8cc 100644
@@ -1231,7 +1231,7 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
 	/* restore channel's hardware configuration */
 
 	if (!cp->in_use)
-		return 0;
+		return;
 
 	printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
 
@@ -1242,8 +1242,6 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
 
 	if (cp->map != NULL)
 		dma_sel.select(cp, cp->map);
-
-	return 0;
 }
 
 static void s3c2410_dma_resume(void)
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 2/4 arm: plat-s3c24xx: dma: drop return codes in void function

Quoted 9 lines · Wolfram Sang

Commit bb072c3c (ARM / Samsung: Use struct syscore_ops for "core" power management) turned s3c2410_dma_resume_chan() from int to void. So, drop the actual return values, too. Fixes:

arch/arm/plat-s3c24xx/dma.c: In function 's3c2410_dma_resume_chan':
arch/arm/plat-s3c24xx/dma.c:1238:3: warning: 'return' with a value, in function returning void arch/arm/plat-s3c24xx/dma.c:1250:2: warning: 'return' with a value, in function returning void

Quoted 28 lines
Cc Kukjin Kim <[email protected]>
---
 arch/arm/plat-s3c24xx/dma.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-s3c24xx/dma.c +1 -3
index a5b3684..a79a8cc 100644
@@ -1231,7 +1231,7 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
 	/* restore channel's hardware configuration */
 
 	if (!cp->in_use)
-		return 0;
+		return;
 
 	printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
 
@@ -1242,8 +1242,6 @@ static void s3c2410_dma_resume_chan(struct s3c2410_dma_chan *cp)
 
 	if (cp->map != NULL)
 		dma_sel.select(cp, cp->map);
-
-	return 0;
 }
 
 static void s3c2410_dma_resume(void)
#5 lore raw

PATCH 2/4 arm: plat-s3c24xx: dma: drop return codes in void function

Quoted 8 lines · Rafael J. Wysocki
Quoted 6 lines · Wolfram Sang

Commit bb072c3c (ARM / Samsung: Use struct syscore_ops for "core" power management) turned s3c2410_dma_resume_chan() from int to void. So, drop the actual return values, too. Fixes:

arch/arm/plat-s3c24xx/dma.c: In function 's3c2410_dma_resume_chan':
arch/arm/plat-s3c24xx/dma.c:1238:3: warning: 'return' with a value, in

function

Quoted 2 lines

returning void

Quoted 1 line

arch/arm/plat-s3c24xx/dma.c:1250:2: warning: 'return' with a value, in

function

Quoted 6 lines

returning void

Quoted 2 lines

Will apply this into -fix tree for 3.0.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 30 lines

arch/arm/plat-s3c24xx/dma.c static void s3c2410_dma_resume_chan(struct

Quoted 10 lines
Cc Kukjin Kim <[email protected]>
---
 arch/arm/plat-s3c24xx/dma.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/plat-s3c24xx/dma.c +0 -0
index a5b3684..a79a8cc 100644
@@ -1231,7 +1231,7 @@ static void s3c2410_dma_resume_chan(struct

s3c2410_dma_chan *cp)

arch/arm/plat-s3c24xx/dma.c static void s3c2410_dma_resume_chan(struct

Quoted 9 lines
arch/arm/plat-s3c24xx/dma.c +1 -1
 	/* restore channel's hardware configuration */
 
 	if (!cp->in_use)
-		return 0;
+		return;
 
 	printk(KERN_INFO "dma%d: restoring configuration\n", cp->number);
 
@@ -1242,8 +1242,6 @@ static void s3c2410_dma_resume_chan(struct

s3c2410_dma_chan *cp)

Quoted 9 lines
arch/arm/plat-s3c24xx/dma.c +0 -2
 	if (cp->map != NULL)
 		dma_sel.select(cp, cp->map);
-
-	return 0;
 }
 
 static void s3c2410_dma_resume(void)
 
#6 lore raw

PATCH 3/4 arm: mach-s3c2440: dma: fix section mismatch

In reply to Wolfram Sang

If s3c2440_dma_add() and s3c2440_dma_init() are in __init, then the struct s3c2440_dma_driver they are using should be __initdata, too.

Fixes:

WARNING: vmlinux.o(.data+0x14ac): Section mismatch in reference from the variable s3c2440_dma_driver to the function .init.text:s3c2440_dma_add() The variable s3c2440_dma_driver references the function __init s3c2440_dma_add()

---
 arch/arm/mach-s3c2440/dma.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2440/dma.c +1 -1
index 3b0529f..f417959 100644
@@ -198,7 +198,7 @@ static int __init s3c2440_dma_add(struct sys_device *sysdev)
 	return s3c24xx_dma_init_map(&s3c2440_dma_sel);
 }
 
-static struct sysdev_driver s3c2440_dma_driver = {
+static struct sysdev_driver __initdata s3c2440_dma_driver = {
 	.add	= s3c2440_dma_add,
 };
 
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH 3/4 arm: mach-s3c2440: dma: fix section mismatch

Quoted 7 lines · Wolfram Sang

If s3c2440_dma_add() and s3c2440_dma_init() are in __init, then the struct s3c2440_dma_driver they are using should be __initdata, too.

Fixes:

WARNING: vmlinux.o(.data+0x14ac): Section mismatch in reference from the variable s3c2440_dma_driver to the function .init.text:s3c2440_dma_add() The variable s3c2440_dma_driver references the function __init s3c2440_dma_add()

No, this is soo wrong (and illustrates why its important to check before adding __init stuff.)

arch/arm/mach-s3c2440/dma.c static int __init s3c2440_dma_add(struct sys_device *sysdev) · line 203

Quoted 12 lines
arch/arm/mach-s3c2440/dma.c +1 -1
index 3b0529f..f417959 100644
@@ -198,7 +198,7 @@ static int __init s3c2440_dma_add(struct sys_device *sysdev)
 	return s3c24xx_dma_init_map(&s3c2440_dma_sel);
 }
 
-static struct sysdev_driver s3c2440_dma_driver = {
+static struct sysdev_driver __initdata s3c2440_dma_driver = {
 	.add	= s3c2440_dma_add,
 };

The code does this:

static int __init s3c2440_dma_init(void)

{
        return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_dma_driver);
}

So, this registers the s3c2440_dma_driver structure. Internally, sysdev_driver_register() does this:

                list_add_tail(&drv->entry, &cls->drivers);

which adds s3c2440_dma_driver to a list of sysdev drivers. Whenever a sysdev is added, the code does this:

                /* Notify class auxiliary drivers */
                list_for_each_entry(drv, &cls->drivers, entry) {
                        if (drv->add)
                                drv->add(sysdev);
                }

What do you think will happen when this list is walked, but your s3c2440_dma_driver structure has been discarded with the init section and replaced with random data?

#8 lore raw

PATCH 3/4 arm: mach-s3c2440: dma: fix section mismatch

Quoted 3 lines

What do you think will happen when this list is walked, but your s3c2440_dma_driver structure has been discarded with the init section and replaced with random data?

OOPS. That was not enough love, mea culpa.

Thanks!

Signature · 9 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20110707/e15a53cb/attachment.sig>
#9 lore raw

PATCH 4/4 arm: mach-s3c2440: mini2440: fix section mismatch

In reply to Wolfram Sang

If mini2440_init() is in __init, mini2440_parse_features() should also be in __init. Fixes:

(.text+0x9adc): Section mismatch in reference from the function mini2440_parse_features.clone.0() to the (unknown reference) .init.data:(unknown) The function mini2440_parse_features.clone.0() references the (unknown reference) __initdata (unknown).

Cc Michel Pollet <[email protected]>
Cc Kukjin Kim <[email protected]>
---
 arch/arm/mach-s3c2440/mach-mini2440.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-s3c2440/mach-mini2440.c +1 -1
index dd3120d..fc2dc0b 100644
@@ -552,7 +552,7 @@ struct mini2440_features_t {
 	struct platform_device *optional[8];
 };
 
-static void mini2440_parse_features(
+static void __init mini2440_parse_features(
 		struct mini2440_features_t * features,
 		const char * features_str )
 {
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 4/4 arm: mach-s3c2440: mini2440: fix section mismatch

Quoted 6 lines · Wolfram Sang

If mini2440_init() is in __init, mini2440_parse_features() should also be in __init. Fixes:

(.text+0x9adc): Section mismatch in reference from the function mini2440_parse_features.clone.0() to the (unknown reference)

.init.data:(unknown)

Quoted 1 line

The function mini2440_parse_features.clone.0() references the (unknown

reference)

Quoted 1 line

__initdata (unknown).

But I couldn't find above "Section mismatch" in my building with CONFIG_DEBUG_SECTION_MISMATCH=y.

Hmm...

Quoted 23 lines
Cc Michel Pollet <[email protected]>
Cc Kukjin Kim <[email protected]>
---
 arch/arm/mach-s3c2440/mach-mini2440.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s3c2440/mach-mini2440.c +0 -0

s3c2440/mach-mini2440.c
index dd3120d..fc2dc0b 100644

arch/arm/mach-s3c2440/mach-mini2440.c +1 -2
@@ -552,7 +552,7 @@ struct mini2440_features_t {
 	struct platform_device *optional[8];
 };
 
-static void mini2440_parse_features(
+static void __init mini2440_parse_features(
 		struct mini2440_features_t * features,
 		const char * features_str )
 {
--
Quoted 1 line

1.7.5.4

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#11 lore raw

PATCH 4/4 arm: mach-s3c2440: mini2440: fix section mismatch

Quoted 7 lines · Kukjin Kim
Quoted 6 lines · Wolfram Sang

If mini2440_init() is in __init, mini2440_parse_features() should also be in __init. Fixes:

(.text+0x9adc): Section mismatch in reference from the function mini2440_parse_features.clone.0() to the (unknown reference)

Quoted 7 lines

.init.data:(unknown)

Quoted 1 line

The function mini2440_parse_features.clone.0() references the (unknown

reference)

Quoted 1 line

__initdata (unknown).

But I couldn't find above "Section mismatch" in my building with CONFIG_DEBUG_SECTION_MISMATCH=y.

Your compiler may have inlined the function, so defeating the check.

static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {

and mini2440_parse_features() references this variable. Therefore either mini2440_parse_features() needs to be marked __init (it's only caller is from __init, so that seems sensible) or the __initdata markers on the referenced data need to be removed.

Adding __init looks like the right thing.

#12 lore raw

PATCH 4/4 arm: mach-s3c2440: mini2440: fix section mismatch

Quoted 19 lines · Russell King - ARM Linux
Quoted 7 lines · Kukjin Kim
Quoted 6 lines · Wolfram Sang

If mini2440_init() is in __init, mini2440_parse_features() should also be in __init. Fixes:

(.text+0x9adc): Section mismatch in reference from the function mini2440_parse_features.clone.0() to the (unknown reference)

Quoted 7 lines

.init.data:(unknown)

Quoted 1 line

The function mini2440_parse_features.clone.0() references the (unknown

reference)

Quoted 1 line

__initdata (unknown).

But I couldn't find above "Section mismatch" in my building with CONFIG_DEBUG_SECTION_MISMATCH=y.

Your compiler may have inlined the function, so defeating the check.

Quoted 8 lines

static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {

and mini2440_parse_features() references this variable. Therefore either mini2440_parse_features() needs to be marked __init (it's only caller is from __init, so that seems sensible) or the __initdata markers on the referenced data need to be removed.

Adding __init looks like the right thing.

OK, applied this into -fix.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.