lkml.org 
[lkml]   [2012]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 05/15] hwmon: mark const init data with __initconst instead of __initdata
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.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-03-31 05:59    [W:0.036 / U:0.944 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site