All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Jean Delvare <khali@linux-fr.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [PATCH v2 05/15] hwmon: mark const init data with __initconst instead of __initdata
Date: Sat, 31 Mar 2012 16:09:24 +0200	[thread overview]
Message-ID: <20120331140924.GW15647@pengutronix.de> (raw)
In-Reply-To: <20120331035442.GA23851@ericsson.com>

Hello Guenter,

On Fri, Mar 30, 2012 at 08:54:42PM -0700, Guenter Roeck wrote:
> On Fri, Mar 30, 2012 at 04:04:55PM -0400, 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
> > 
> > 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: Jean Delvare <khali@linux-fr.org>
> > Cc: Guenter Roeck <guenter.roeck@ericsson.com>
> > Cc: lm-sensors@lm-sensors.org
> > ---
> > changes since (implicit) v1:
> >  - drop wrong changes to drivers/hwmon/w83627hf.c
> > 
> >  drivers/hwmon/w83627ehf.c |   18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
> > index a25350c..54922ed 100644
> > --- a/drivers/hwmon/w83627ehf.c
> > +++ b/drivers/hwmon/w83627ehf.c
> > @@ -2619,15 +2619,15 @@ static struct platform_driver w83627ehf_driver = {
> >  static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
> >  				 struct w83627ehf_sio_data *sio_data)
> >  {
> > -	static const char __initdata sio_name_W83627EHF[] = "W83627EHF";
> > -	static const char __initdata sio_name_W83627EHG[] = "W83627EHG";
> > -	static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
> > -	static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P";
> > -	static const char __initdata sio_name_W83627UHG[] = "W83627UHG";
> > -	static const char __initdata sio_name_W83667HG[] = "W83667HG";
> > -	static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B";
> > -	static const char __initdata sio_name_NCT6775[] = "NCT6775F";
> > -	static const char __initdata sio_name_NCT6776[] = "NCT6776F";
> > +	static const char sio_name_W83627EHF[] __initconst = "W83627EHF";
> > +	static const char sio_name_W83627EHG[] __initconst = "W83627EHG";
> > +	static const char sio_name_W83627DHG[] __initconst = "W83627DHG";
> > +	static const char sio_name_W83627DHG_P[] __initconst = "W83627DHG-P";
> > +	static const char sio_name_W83627UHG[] __initconst = "W83627UHG";
> > +	static const char sio_name_W83667HG[] __initconst = "W83667HG";
> > +	static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B";
> > +	static const char sio_name_NCT6775[] __initconst = "NCT6775F";
> > +	static const char sio_name_NCT6776[] __initconst = "NCT6776F";
> >  
> Applied.
> 
> Just wondering: Why not the following ?
> 
> > +	static const char __initconst sio_name_NCT6776[] = "NCT6776F";
> 
> It does not make a difference in the generated code, and appears to be
> less confusing, at least to me.
hmm, I thought it does, maybe it's compiler dependant?! At least
gcc-4.4.info tells:

	An attribute specifier list may appear immediately before the
	comma, `=' or semicolon terminating the declaration of an
	identifier other than a function definition.

and include/linux/init.h has:

	You should insert __initdata between the variable name and equal
	sign followed by value [...].

I seem to remember that placing the attribute at the wrong place for a
function made gcc ignore it (or apply it so something unintended).

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	Jean Delvare <khali@linux-fr.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH v2 05/15] hwmon: mark const init data with __initconst instead of __initdata
Date: Sat, 31 Mar 2012 14:09:24 +0000	[thread overview]
Message-ID: <20120331140924.GW15647@pengutronix.de> (raw)
In-Reply-To: <20120331035442.GA23851@ericsson.com>

Hello Guenter,

On Fri, Mar 30, 2012 at 08:54:42PM -0700, Guenter Roeck wrote:
> On Fri, Mar 30, 2012 at 04:04:55PM -0400, 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
> > 
> > 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: Jean Delvare <khali@linux-fr.org>
> > Cc: Guenter Roeck <guenter.roeck@ericsson.com>
> > Cc: lm-sensors@lm-sensors.org
> > ---
> > changes since (implicit) v1:
> >  - drop wrong changes to drivers/hwmon/w83627hf.c
> > 
> >  drivers/hwmon/w83627ehf.c |   18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
> > index a25350c..54922ed 100644
> > --- a/drivers/hwmon/w83627ehf.c
> > +++ b/drivers/hwmon/w83627ehf.c
> > @@ -2619,15 +2619,15 @@ static struct platform_driver w83627ehf_driver = {
> >  static int __init w83627ehf_find(int sioaddr, unsigned short *addr,
> >  				 struct w83627ehf_sio_data *sio_data)
> >  {
> > -	static const char __initdata sio_name_W83627EHF[] = "W83627EHF";
> > -	static const char __initdata sio_name_W83627EHG[] = "W83627EHG";
> > -	static const char __initdata sio_name_W83627DHG[] = "W83627DHG";
> > -	static const char __initdata sio_name_W83627DHG_P[] = "W83627DHG-P";
> > -	static const char __initdata sio_name_W83627UHG[] = "W83627UHG";
> > -	static const char __initdata sio_name_W83667HG[] = "W83667HG";
> > -	static const char __initdata sio_name_W83667HG_B[] = "W83667HG-B";
> > -	static const char __initdata sio_name_NCT6775[] = "NCT6775F";
> > -	static const char __initdata sio_name_NCT6776[] = "NCT6776F";
> > +	static const char sio_name_W83627EHF[] __initconst = "W83627EHF";
> > +	static const char sio_name_W83627EHG[] __initconst = "W83627EHG";
> > +	static const char sio_name_W83627DHG[] __initconst = "W83627DHG";
> > +	static const char sio_name_W83627DHG_P[] __initconst = "W83627DHG-P";
> > +	static const char sio_name_W83627UHG[] __initconst = "W83627UHG";
> > +	static const char sio_name_W83667HG[] __initconst = "W83667HG";
> > +	static const char sio_name_W83667HG_B[] __initconst = "W83667HG-B";
> > +	static const char sio_name_NCT6775[] __initconst = "NCT6775F";
> > +	static const char sio_name_NCT6776[] __initconst = "NCT6776F";
> >  
> Applied.
> 
> Just wondering: Why not the following ?
> 
> > +	static const char __initconst sio_name_NCT6776[] = "NCT6776F";
> 
> It does not make a difference in the generated code, and appears to be
> less confusing, at least to me.
hmm, I thought it does, maybe it's compiler dependant?! At least
gcc-4.4.info tells:

	An attribute specifier list may appear immediately before the
	comma, `=' or semicolon terminating the declaration of an
	identifier other than a function definition.

and include/linux/init.h has:

	You should insert __initdata between the variable name and equal
	sign followed by value [...].

I seem to remember that placing the attribute at the wrong place for a
function made gcc ignore it (or apply it so something unintended).

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

  reply	other threads:[~2012-03-31 14:09 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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:11 ` [lm-sensors] " Uwe Kleine-König
2012-03-29 21:11 ` Uwe Kleine-König
2012-03-29 21:11 ` Uwe Kleine-König
2012-03-29 21:11 ` Uwe Kleine-König
2012-03-29 21:11 ` Uwe Kleine-König
2012-03-29 21:11 ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 01/17] percpu: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 02/17] pinctrl: " Uwe Kleine-König
2012-04-03 20:28   ` Linus Walleij
2012-03-29 21:12 ` [PATCH 03/17] ARM: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 22:31   ` David Brown
2012-03-29 22:31     ` David Brown
2012-03-29 22:31     ` David Brown
2012-03-30  4:34   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:34     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  4:34     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-30  6:11   ` Shawn Guo
2012-03-30  6:11     ` Shawn Guo
2012-03-30  6:11     ` Shawn Guo
2012-03-30  9:50     ` Uwe Kleine-König
2012-03-30  9:50       ` Uwe Kleine-König
2012-03-30  9:50       ` Uwe Kleine-König
2012-03-30 11:25       ` Shawn Guo
2012-03-30 11:25         ` Shawn Guo
2012-03-30 11:25         ` Shawn Guo
2012-03-30 16:11   ` Tony Lindgren
2012-03-30 16:11     ` Tony Lindgren
2012-03-30 16:11     ` Tony Lindgren
2012-03-29 21:12 ` [PATCH 04/17] FRV: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 05/17] net: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 06/17] hwmon: " Uwe Kleine-König
2012-03-29 21:12   ` [lm-sensors] " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 07/17] mfd: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 08/17] mips: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 09/17] h8300: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 10/17] ia64: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 11/17] powerpc: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 12/17] gpio/samsung: " Uwe Kleine-König
2012-04-03 20:29   ` Linus Walleij
2012-03-29 21:12 ` [PATCH 13/17] ide: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 14/17] media/video/s5p-tv: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 15/17] mtd: " Uwe Kleine-König
2012-03-29 21:12   ` Uwe Kleine-König
2012-04-13 15:43   ` Artem Bityutskiy
2012-04-13 15:43     ` Artem Bityutskiy
2012-03-29 21:12 ` [PATCH 16/17] drivers/x86: " Uwe Kleine-König
2012-03-29 21:12 ` [PATCH 17/17] kstrtox: " Uwe Kleine-König
2012-03-30  9:59 ` [PATCH 00/17] " Uwe Kleine-König
2012-03-30  9:59   ` [lm-sensors] " Uwe Kleine-König
2012-03-30  9:59   ` Uwe Kleine-König
2012-03-30  9:59   ` Uwe Kleine-König
2012-03-30  9:59   ` Uwe Kleine-König
2012-03-30  9:59   ` Uwe Kleine-König
2012-03-30  9:59   ` Uwe Kleine-König
2012-03-30 11:37   ` Andreas Schwab
2012-03-30 18:19     ` Uwe Kleine-König
2012-03-30 20:03 ` [PATCH v2 00/15] " Uwe Kleine-König
2012-03-30 20:03   ` [lm-sensors] " Uwe Kleine-König
2012-03-30 20:03   ` Uwe Kleine-König
2012-03-30 20:03   ` Uwe Kleine-König
2012-03-30 20:03   ` Uwe Kleine-König
2012-03-30 20:03   ` Uwe Kleine-König
2012-03-30 20:04   ` [PATCH v2 01/15] pinctrl: " Uwe Kleine-König
2012-04-03 20:47     ` Linus Walleij
2012-03-30 20:04   ` [PATCH v2 02/15] ARM: " Uwe Kleine-König
2012-03-30 20:04     ` Uwe Kleine-König
2012-03-30 20:04     ` Uwe Kleine-König
2012-04-11 11:34     ` Sekhar Nori
2012-04-11 11:34       ` Sekhar Nori
2012-04-11 11:34       ` Sekhar Nori
2012-03-30 20:04   ` [PATCH v2 03/15] FRV: " Uwe Kleine-König
2012-03-30 20:04   ` [PATCH v2 04/15] net: " Uwe Kleine-König
2012-03-30 20:04     ` Uwe Kleine-König
2012-03-30 20:04     ` Uwe Kleine-König
2012-03-30 20:04   ` [PATCH v2 05/15] hwmon: " Uwe Kleine-König
2012-03-30 20:04     ` [lm-sensors] " Uwe Kleine-König
2012-03-31  3:54     ` Guenter Roeck
2012-03-31  3:54       ` [lm-sensors] " Guenter Roeck
2012-03-31 14:09       ` Uwe Kleine-König [this message]
2012-03-31 14:09         ` Uwe Kleine-König
2012-03-31 20:14         ` Guenter Roeck
2012-03-31 20:14           ` [lm-sensors] " Guenter Roeck
2012-03-30 20:04   ` [PATCH v2 06/15] mfd: " Uwe Kleine-König
2012-04-16 10:30     ` Samuel Ortiz
2012-03-30 20:04   ` [PATCH v2 07/15] mips: " Uwe Kleine-König
2012-03-30 20:04   ` [PATCH v2 08/15] h8300: " Uwe Kleine-König
2012-03-30 20:04   ` [PATCH v2 09/15] ia64: " Uwe Kleine-König
2012-03-30 20:04     ` Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 10/15] powerpc: " Uwe Kleine-König
2012-03-30 20:05     ` Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 11/15] gpio/samsung: " Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 12/15] ide: " Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 13/15] media/video/s5p-tv: " Uwe Kleine-König
2012-03-30 20:05     ` Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 14/15] drivers/x86: " Uwe Kleine-König
2012-03-30 20:05   ` [PATCH v2 15/15] kstrtox: " Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120331140924.GW15647@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=guenter.roeck@ericsson.com \
    --cc=kernel@pengutronix.de \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.