* [PATCH 00/17] mark const init data with __initconst instead of __initdata
@ 2012-03-29 21:11 Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 08/17] mips: " Uwe Kleine-König
2012-03-30 9:59 ` [PATCH 00/17] " Uwe Kleine-König
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:11 UTC (permalink / raw)
To: linux-kernel, Andrew Morton
Cc: Alexey Dobriyan, Anatolij Gustschin, Andreas Koensgen,
Andrew Lunn, Andrew Victor, Arnd Bergmann, Barry Song,
Benjamin Herrenschmidt, Bryan Huntsman, cbe-oss-dev,
Christoph Lameter, Daniel Walker, David Brown, David Howells,
David S. Miller, David Woodhouse, davinci-linux-open-source,
Eric Miao, Fenghua Yu, Grant Likely, Guenter Roeck,
Haojian Zhuang, Henrique de Moraes Holschuh, ibm-acpi-devel,
Jean-Christophe Plagniol-Villard, Jean Delvare,
Jean-Paul Roubelat, Joerg Reuter, Josh Boyer, Kevin Hilman,
Klaus Kudielka, Kukjin Kim, Kumar Gala, Kyungmin Park,
Lennert Buytenhek, Linus Walleij, Linus Walleij, linux-arm-kernel,
linux-arm-msm, linux-hams, linux-ia64, linux-ide, linux-media,
linux-mips, linux-mm, linux-mtd, linux-omap, linuxppc-dev,
linux-samsung-soc, lm-sensors, Lucas De Marchi, Matthew Garrett,
Matt Porter, Mauro Carvalho Chehab, netdev, Nicolas Ferre,
Nicolas Pitre, Paul Mackerras, platform-driver-x86, Ralf Baechle,
Randy Dunlap, Russell King, Samuel Ortiz, Sascha Hauer,
Sekhar Nori, Shawn Guo, Tejun Heo, Tomasz Stanislawski,
Tony Lindgren, Tony Luck, Yoshinori Sato
Hello,
this series fixes a common error to use __initdata to mark const
variables. Most of the time this works well enough to go unnoticed
(though I wonder why the linker doesn't warn about that).
Just try adding something like
int something __initdata;
to one of the patched files and compile to see the error.
While touching these annotations I also corrected the position where it
was wrong to go between the variable name and the =.
Note this series is not compile tested.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 08/17] mips: mark const init data with __initconst instead of __initdata
2012-03-29 21:11 [PATCH 00/17] mark const init data with __initconst instead of __initdata Uwe Kleine-König
@ 2012-03-29 21:12 ` Uwe Kleine-König
2012-03-30 9:59 ` [PATCH 00/17] " Uwe Kleine-König
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:12 UTC (permalink / raw)
To: linux-kernel, Andrew Morton; +Cc: kernel, Ralf Baechle, linux-mips
As long as there is no other non-const variable marked __initdata in the
same compilation unit it doesn't hurt. If there were one however
compilation would fail with
error: $variablename causes a section type conflict
because a section containing const variables is marked read only and so
cannot contain non-const variables.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
arch/mips/bcm63xx/boards/board_bcm963xx.c | 2 +-
arch/mips/bcm63xx/dev-pcmcia.c | 4 ++--
arch/mips/mti-malta/malta-setup.c | 2 +-
arch/mips/pci/fixup-mpc30x.c | 4 ++--
arch/mips/powertv/asic/asic-calliope.c | 2 +-
arch/mips/powertv/asic/asic-cronus.c | 2 +-
arch/mips/powertv/asic/asic-gaia.c | 2 +-
arch/mips/powertv/asic/asic-zeus.c | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 2f1773f..a3fe14e 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -591,7 +591,7 @@ static struct board_info __initdata board_DWVS0 = {
/*
* all boards
*/
-static const struct board_info __initdata *bcm963xx_boards[] = {
+static const struct board_info *bcm963xx_boards[] __initconst = {
#ifdef CONFIG_BCM63XX_CPU_6338
&board_96338gw,
&board_96338w,
diff --git a/arch/mips/bcm63xx/dev-pcmcia.c b/arch/mips/bcm63xx/dev-pcmcia.c
index de4d917..a551bab 100644
--- a/arch/mips/bcm63xx/dev-pcmcia.c
+++ b/arch/mips/bcm63xx/dev-pcmcia.c
@@ -79,11 +79,11 @@ static int __init config_pcmcia_cs(unsigned int cs,
return ret;
}
-static const __initdata struct {
+static const struct {
unsigned int cs;
unsigned int base;
unsigned int size;
-} pcmcia_cs[3] = {
+} pcmcia_cs[3] __initconst = {
{
.cs = MPI_CS_PCMCIA_COMMON,
.base = BCM_PCMCIA_COMMON_BASE_PA,
diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index b7f37d4..2e28f65 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -111,7 +111,7 @@ static void __init pci_clock_check(void)
unsigned int __iomem *jmpr_p =
(unsigned int *) ioremap(MALTA_JMPRS_REG, sizeof(unsigned int));
int jmpr = (__raw_readl(jmpr_p) >> 2) & 0x07;
- static const int pciclocks[] __initdata = {
+ static const int pciclocks[] __initconst = {
33, 20, 25, 30, 12, 16, 37, 10
};
int pciclock = pciclocks[jmpr];
diff --git a/arch/mips/pci/fixup-mpc30x.c b/arch/mips/pci/fixup-mpc30x.c
index e08f49c..8e4f828 100644
--- a/arch/mips/pci/fixup-mpc30x.c
+++ b/arch/mips/pci/fixup-mpc30x.c
@@ -22,13 +22,13 @@
#include <asm/vr41xx/mpc30x.h>
-static const int internal_func_irqs[] __initdata = {
+static const int internal_func_irqs[] __initconst = {
VRC4173_CASCADE_IRQ,
VRC4173_AC97_IRQ,
VRC4173_USB_IRQ,
};
-static const int irq_tab_mpc30x[] __initdata = {
+static const int irq_tab_mpc30x[] __initconst = {
[12] = VRC4173_PCMCIA1_IRQ,
[13] = VRC4173_PCMCIA2_IRQ,
[29] = MQ200_IRQ,
diff --git a/arch/mips/powertv/asic/asic-calliope.c b/arch/mips/powertv/asic/asic-calliope.c
index 0a170e0..7773f3d 100644
--- a/arch/mips/powertv/asic/asic-calliope.c
+++ b/arch/mips/powertv/asic/asic-calliope.c
@@ -28,7 +28,7 @@
#define CALLIOPE_ADDR(x) (CALLIOPE_IO_BASE + (x))
-const struct register_map calliope_register_map __initdata = {
+const struct register_map calliope_register_map __initconst = {
.eic_slow0_strt_add = {.phys = CALLIOPE_ADDR(0x800000)},
.eic_cfg_bits = {.phys = CALLIOPE_ADDR(0x800038)},
.eic_ready_status = {.phys = CALLIOPE_ADDR(0x80004c)},
diff --git a/arch/mips/powertv/asic/asic-cronus.c b/arch/mips/powertv/asic/asic-cronus.c
index bbc0c12..da076db 100644
--- a/arch/mips/powertv/asic/asic-cronus.c
+++ b/arch/mips/powertv/asic/asic-cronus.c
@@ -28,7 +28,7 @@
#define CRONUS_ADDR(x) (CRONUS_IO_BASE + (x))
-const struct register_map cronus_register_map __initdata = {
+const struct register_map cronus_register_map __initconst = {
.eic_slow0_strt_add = {.phys = CRONUS_ADDR(0x000000)},
.eic_cfg_bits = {.phys = CRONUS_ADDR(0x000038)},
.eic_ready_status = {.phys = CRONUS_ADDR(0x00004C)},
diff --git a/arch/mips/powertv/asic/asic-gaia.c b/arch/mips/powertv/asic/asic-gaia.c
index 91dda68..47683b3 100644
--- a/arch/mips/powertv/asic/asic-gaia.c
+++ b/arch/mips/powertv/asic/asic-gaia.c
@@ -23,7 +23,7 @@
#include <linux/init.h>
#include <asm/mach-powertv/asic.h>
-const struct register_map gaia_register_map __initdata = {
+const struct register_map gaia_register_map __initconst = {
.eic_slow0_strt_add = {.phys = GAIA_IO_BASE + 0x000000},
.eic_cfg_bits = {.phys = GAIA_IO_BASE + 0x000038},
.eic_ready_status = {.phys = GAIA_IO_BASE + 0x00004C},
diff --git a/arch/mips/powertv/asic/asic-zeus.c b/arch/mips/powertv/asic/asic-zeus.c
index 4a05bb0..6ff4b10 100644
--- a/arch/mips/powertv/asic/asic-zeus.c
+++ b/arch/mips/powertv/asic/asic-zeus.c
@@ -28,7 +28,7 @@
#define ZEUS_ADDR(x) (ZEUS_IO_BASE + (x))
-const struct register_map zeus_register_map __initdata = {
+const struct register_map zeus_register_map __initconst = {
.eic_slow0_strt_add = {.phys = ZEUS_ADDR(0x000000)},
.eic_cfg_bits = {.phys = ZEUS_ADDR(0x000038)},
.eic_ready_status = {.phys = ZEUS_ADDR(0x00004c)},
--
1.7.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 00/17] mark const init data with __initconst instead of __initdata
2012-03-29 21:11 [PATCH 00/17] mark const init data with __initconst instead of __initdata Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 08/17] mips: " Uwe Kleine-König
@ 2012-03-30 9:59 ` Uwe Kleine-König
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2012-03-30 9:59 UTC (permalink / raw)
To: linux-kernel, Andrew Morton
Cc: Alexey Dobriyan, Anatolij Gustschin, Andreas Koensgen,
Andrew Lunn, Andrew Victor, Arnd Bergmann, Barry Song,
Benjamin Herrenschmidt, Bryan Huntsman, cbe-oss-dev,
Christoph Lameter, Daniel Walker, David Brown, David Howells,
David S. Miller, David Woodhouse, davinci-linux-open-source,
Eric Miao, Fenghua Yu, Grant Likely, Guenter Roeck,
Haojian Zhuang, Henrique de Moraes Holschuh, ibm-acpi-devel,
Jean-Christophe Plagniol-Villard, Jean Delvare,
Jean-Paul Roubelat, Joerg Reuter, Josh Boyer, Kevin Hilman,
Klaus Kudielka, Kukjin Kim, Kumar Gala, Kyungmin Park,
Lennert Buytenhek, Linus Walleij, Linus Walleij, linux-arm-kernel,
linux-arm-msm, linux-hams, linux-ia64, linux-ide, linux-media,
linux-mips, linux-mm, linux-mtd, linux-omap, linuxppc-dev,
linux-samsung-soc, lm-sensors, Lucas De Marchi, Matthew Garrett,
Matt Porter, Mauro Carvalho Chehab, netdev, Nicolas Ferre,
Nicolas Pitre, Paul Mackerras, platform-driver-x86, Ralf Baechle,
Randy Dunlap, Russell King, Samuel Ortiz, Sascha Hauer,
Sekhar Nori, Shawn Guo, Tejun Heo, Tomasz Stanislawski,
Tony Lindgren, Tony Luck, Yoshinori Sato
On Thu, Mar 29, 2012 at 11:11:31PM +0200, Uwe Kleine-König wrote:
> Hello,
>
> this series fixes a common error to use __initdata to mark const
> variables. Most of the time this works well enough to go unnoticed
> (though I wonder why the linker doesn't warn about that).
> Just try adding something like
>
> int something __initdata;
>
> to one of the patched files and compile to see the error.
>
> While touching these annotations I also corrected the position where it
> was wrong to go between the variable name and the =.
>
> Note this series is not compile tested.
After a question by Shawn Guo I noticed that my command to do the changes
was to lax and changed things that must not be changed (at least not
with further care). Affected are lines like:
static const char *at91_dt_board_compat[] __initconst = {
While at91_dt_board_compat[0] is const, at91_dt_board_compat is not.
I will send a fixed series later today.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-30 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29 21:11 [PATCH 00/17] mark const init data with __initconst instead of __initdata Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 08/17] mips: " Uwe Kleine-König
2012-03-30 9:59 ` [PATCH 00/17] " Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox