linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [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 01/17] percpu: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ 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-Ki? 1/2 nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 01/17] percpu: 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
  2012-03-30 20:03 ` [PATCH v2 00/15] " Uwe Kleine-König
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:12 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: kernel, Christoph Lameter, Tejun Heo, linux-mm

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-KA?nig <u.kleine-koenig@pengutronix.de>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-mm@kvack.org
---
 mm/percpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/percpu.c b/mm/percpu.c
index f47af91..5e812f5 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1370,7 +1370,7 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,
 
 #ifdef CONFIG_SMP
 
-const char *pcpu_fc_names[PCPU_FC_NR] __initdata = {
+const char *pcpu_fc_names[PCPU_FC_NR] __initconst = {
 	[PCPU_FC_AUTO]	= "auto",
 	[PCPU_FC_EMBED]	= "embed",
 	[PCPU_FC_PAGE]	= "page",
-- 
1.7.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ 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 01/17] percpu: " Uwe Kleine-König
@ 2012-03-30  9:59 ` Uwe Kleine-König
  2012-03-30 20:03 ` [PATCH v2 00/15] " Uwe Kleine-König
  2 siblings, 0 replies; 4+ 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-Ki? 1/2 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-Ki? 1/2 nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 00/15] 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 01/17] percpu: " Uwe Kleine-König
  2012-03-30  9:59 ` [PATCH 00/17] " Uwe Kleine-König
@ 2012-03-30 20:03 ` Uwe Kleine-König
  2 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2012-03-30 20:03 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,

On Thu, Mar 29, 2012 at 11:11:31PM +0200, Uwe Kleine-Ki? 1/2 nig wrote:
> 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.
I now dropped the wrong annotations. So two patches became obsolete
(mtd and percpu). Note that I also dropped fixing the position of
__initdata if changing it to __initconst was wrong. (I think if
__initdata is placed before the variable name it doesn't have any
effect.)

I didn't promote the Acks I got because all acked changes changed in v2.

For the details changed in each patch see the changelogs in the
respective patch mails that I follow up to this mail.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-Ki? 1/2 nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-30 20:04 UTC | newest]

Thread overview: 4+ 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 01/17] percpu: " Uwe Kleine-König
2012-03-30  9:59 ` [PATCH 00/17] " Uwe Kleine-König
2012-03-30 20:03 ` [PATCH v2 00/15] " 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;
as well as URLs for NNTP newsgroup(s).