linux-mtd.lists.infradead.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 15/17] mtd: " Uwe Kleine-König
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:11 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Andrew Lunn, Christoph Lameter, linux-mips, Tony Lindgren,
	Benjamin Herrenschmidt, Linus Walleij, Matt Porter, Nicolas Ferre,
	Matthew Garrett, platform-driver-x86, Grant Likely,
	ibm-acpi-devel, Randy Dunlap, linux-mtd, Sekhar Nori,
	Daniel Walker, lm-sensors, Klaus Kudielka, Guenter Roeck,
	Kevin Hilman, linux-ia64, Kukjin Kim, Russell King, Samuel Ortiz,
	Yoshinori Sato, Kumar Gala, Lennert Buytenhek, Kyungmin Park,
	David Brown, Anatolij Gustschin, Jean-Christophe Plagniol-Villard,
	Alexey Dobriyan, Joerg Reuter, linux-media, cbe-oss-dev,
	Fenghua Yu, Arnd Bergmann, Tony Luck, Lucas De Marchi,
	linux-arm-msm, Andreas Koensgen, Henrique de Moraes Holschuh,
	Haojian Zhuang, Mauro Carvalho Chehab, Tejun Heo,
	linux-samsung-soc, linux-mm, Barry Song, linux-hams, linux-omap,
	Andrew Victor, linux-arm-kernel, David Howells,
	davinci-linux-open-source, Jean-Paul Roubelat, Eric Miao,
	Linus Walleij, linux-ide, linuxppc-dev, Nicolas Pitre,
	Ralf Baechle, Tomasz Stanislawski, Bryan Huntsman, Sascha Hauer,
	netdev, Jean Delvare, Paul Mackerras, Josh Boyer, Shawn Guo,
	David Woodhouse, David S. Miller

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] 5+ messages in thread

* [PATCH 15/17] mtd: 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-04-13 15:43   ` Artem Bityutskiy
  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, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:12 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton; +Cc: linux-mtd, David Woodhouse, kernel

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: David Woodhouse <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/maps/wr_sbc82xx_flash.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c
index aa7e0cb..4f6bf60 100644
--- a/drivers/mtd/maps/wr_sbc82xx_flash.c
+++ b/drivers/mtd/maps/wr_sbc82xx_flash.c
@@ -59,7 +59,7 @@ static struct mtd_partition bigflash_parts[] = {
 	}
 };
 
-static const char *part_probes[] __initdata = {"cmdlinepart", "RedBoot", NULL};
+static const char *part_probes[] __initconst = {"cmdlinepart", "RedBoot", NULL};
 
 #define init_sbc82xx_one_flash(map, br, or)			\
 do {								\
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 5+ 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 15/17] mtd: " 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; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-30  9:59 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Andrew Lunn, Christoph Lameter, linux-mips, Tony Lindgren,
	Benjamin Herrenschmidt, Linus Walleij, Matt Porter, Nicolas Ferre,
	Matthew Garrett, platform-driver-x86, Grant Likely,
	ibm-acpi-devel, Randy Dunlap, linux-mtd, Sekhar Nori,
	Daniel Walker, lm-sensors, Klaus Kudielka, Guenter Roeck,
	Kevin Hilman, linux-ia64, Kukjin Kim, Russell King, Samuel Ortiz,
	Yoshinori Sato, Kumar Gala, Lennert Buytenhek, Kyungmin Park,
	David Brown, Anatolij Gustschin, Jean-Christophe Plagniol-Villard,
	Alexey Dobriyan, Joerg Reuter, linux-media, cbe-oss-dev,
	Fenghua Yu, Arnd Bergmann, Tony Luck, Lucas De Marchi,
	linux-arm-msm, Andreas Koensgen, Henrique de Moraes Holschuh,
	Haojian Zhuang, Mauro Carvalho Chehab, Tejun Heo,
	linux-samsung-soc, linux-mm, Barry Song, linux-hams, linux-omap,
	Andrew Victor, linux-arm-kernel, David Howells,
	davinci-linux-open-source, Jean-Paul Roubelat, Eric Miao,
	Linus Walleij, linux-ide, linuxppc-dev, Nicolas Pitre,
	Ralf Baechle, Tomasz Stanislawski, Bryan Huntsman, Sascha Hauer,
	netdev, Jean Delvare, Paul Mackerras, Josh Boyer, Shawn Guo,
	David Woodhouse, David S. Miller

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] 5+ 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 15/17] mtd: " 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; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-30 20:03 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Andrew Lunn, Christoph Lameter, linux-mips, Tony Lindgren,
	Benjamin Herrenschmidt, Linus Walleij, Matt Porter, Nicolas Ferre,
	Matthew Garrett, platform-driver-x86, Grant Likely,
	ibm-acpi-devel, Randy Dunlap, linux-mtd, Sekhar Nori,
	Daniel Walker, lm-sensors, Klaus Kudielka, Guenter Roeck,
	Kevin Hilman, linux-ia64, Kukjin Kim, Russell King, Samuel Ortiz,
	Yoshinori Sato, Kumar Gala, Lennert Buytenhek, Kyungmin Park,
	David Brown, Anatolij Gustschin, Jean-Christophe Plagniol-Villard,
	Alexey Dobriyan, Joerg Reuter, linux-media, cbe-oss-dev,
	Fenghua Yu, Arnd Bergmann, Tony Luck, Lucas De Marchi,
	linux-arm-msm, Andreas Koensgen, Henrique de Moraes Holschuh,
	Haojian Zhuang, Mauro Carvalho Chehab, Tejun Heo,
	linux-samsung-soc, linux-mm, Barry Song, linux-hams, linux-omap,
	Andrew Victor, linux-arm-kernel, David Howells,
	davinci-linux-open-source, Jean-Paul Roubelat, Eric Miao,
	Linus Walleij, linux-ide, linuxppc-dev, Nicolas Pitre,
	Ralf Baechle, Tomasz Stanislawski, Bryan Huntsman, Sascha Hauer,
	netdev, Jean Delvare, Paul Mackerras, Josh Boyer, Shawn Guo,
	David Woodhouse, David S. Miller

Hello,

On Thu, Mar 29, 2012 at 11:11:31PM +0200, Uwe Kleine-Kö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-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH 15/17] mtd: mark const init data with __initconst instead of __initdata
  2012-03-29 21:12 ` [PATCH 15/17] mtd: " Uwe Kleine-König
@ 2012-04-13 15:43   ` Artem Bityutskiy
  0 siblings, 0 replies; 5+ messages in thread
From: Artem Bityutskiy @ 2012-04-13 15:43 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: linux-mtd, Andrew Morton, David Woodhouse, linux-kernel, kernel

[-- Attachment #1: Type: text/plain, Size: 373 bytes --]

On Thu, 2012-03-29 at 23:12 +0200, Uwe Kleine-König wrote:
> 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
> 

Pushed to l2-mtd.git, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-04-13 15:40 UTC | newest]

Thread overview: 5+ 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 15/17] mtd: " Uwe Kleine-König
2012-04-13 15:43   ` Artem Bityutskiy
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).