X86 platform drivers
 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 16/17] drivers/x86: " 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

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/  |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 16/17] drivers/x86: 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; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-29 21:12 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: kernel, Matthew Garrett, Henrique de Moraes Holschuh,
	platform-driver-x86, ibm-acpi-devel

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: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: platform-driver-x86@vger.kernel.org
Cc: ibm-acpi-devel@lists.sourceforge.net
---
 drivers/platform/x86/dell-laptop.c   |    2 +-
 drivers/platform/x86/thinkpad_acpi.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index a05fc9c..882bfa4 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -94,7 +94,7 @@ static struct rfkill *wifi_rfkill;
 static struct rfkill *bluetooth_rfkill;
 static struct rfkill *wwan_rfkill;
 
-static const struct dmi_system_id __initdata dell_device_table[] = {
+static const struct dmi_system_id dell_device_table[] __initconst = {
 	{
 		.ident = "Dell laptop",
 		.matches = {
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index d68c000..dc1900c 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -522,7 +522,7 @@ static acpi_handle ec_handle;
 
 #define TPACPI_HANDLE(object, parent, paths...)			\
 	static acpi_handle  object##_handle;			\
-	static const acpi_handle *object##_parent __initdata =	\
+	static const acpi_handle *object##_parent __initconst =	\
 						&parent##_handle; \
 	static char *object##_paths[] __initdata = { paths }
 
-- 
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 16/17] drivers/x86: " 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: 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 <gran>

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 16/17] drivers/x86: " 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
  2012-03-30 20:05   ` [PATCH v2 14/15] drivers/x86: " Uwe Kleine-König
  2 siblings, 1 reply; 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

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/  |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH v2 14/15] drivers/x86: mark const init data with __initconst instead of __initdata
  2012-03-30 20:03 ` [PATCH v2 00/15] " Uwe Kleine-König
@ 2012-03-30 20:05   ` Uwe Kleine-König
  0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2012-03-30 20:05 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: kernel, Matthew Garrett, Henrique de Moraes Holschuh,
	platform-driver-x86, ibm-acpi-devel

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: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
Cc: platform-driver-x86@vger.kernel.org
Cc: ibm-acpi-devel@lists.sourceforge.net
---
changes since (implict) v1:
 - drop wrong changes to drivers/platform/x86/thinkpad_acpi.c

 drivers/platform/x86/dell-laptop.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index a05fc9c..882bfa4 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -94,7 +94,7 @@ static struct rfkill *wifi_rfkill;
 static struct rfkill *bluetooth_rfkill;
 static struct rfkill *wwan_rfkill;
 
-static const struct dmi_system_id __initdata dell_device_table[] = {
+static const struct dmi_system_id dell_device_table[] __initconst = {
 	{
 		.ident = "Dell laptop",
 		.matches = {
-- 
1.7.9.5

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

end of thread, other threads:[~2012-03-30 20:05 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 16/17] drivers/x86: " 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
2012-03-30 20:05   ` [PATCH v2 14/15] drivers/x86: " 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