mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Peter Teoh <htmldeveloper@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Incompatibility of "const" and __xxxinitdata?
Date: Sat, 2 Feb 2008 19:48:25 +0100	[thread overview]
Message-ID: <20080202184825.GE25399@uranus.ravnborg.org> (raw)
In-Reply-To: <804dabb00802020720p2684dd1eyc29d1e1410407e08@mail.gmail.com>

On Sat, Feb 02, 2008 at 11:20:44PM +0800, Peter Teoh wrote:
> In include/linux/init.h, it is documented that all __xxxinitdata
> declaration must not have constant, as show below:
> 
>  *
>  * static int init_variable __initdata = 0;
>  * static char linux_logo[] __initdata = { 0x32, 0x36, ... };
>  *
>  * Don't forget to initialize data not at file scope, i.e. within a function,
>  * as gcc otherwise puts the data into the bss section and not into the init
>  * section.
>  *
>  * Also note, that this data cannot be "const".
>  */
> 
> In this same init.h is also documented the preferred way of
> typecasting the variable with __initdata.
> 
> But searching through the source codes, I have found many instances of:
> 
> 1.   constant occuring in the __xxxinitdata pattern, and
> 2.   non-conformance of the variable declaration according to the
> codingstyle recommended.

Only very recently we had a tag to annotate const data in addition
to the __initdata tag.
The reason for two tags are that gcc does not allow to mix const
and non-const data in the same section.

So in the cases you list below there are most certainly no other
__initdata annotations or at least not to non-const data.

If you go forward and fix up this stuff do so in adequate steps.
So you for example do not mix net drivers with usb drivers
in the same patch.

And if fix it up then use the recommended style for the
annotation.
Improved documentation in init.h is also welcome!

	Sam

      parent reply	other threads:[~2008-02-02 18:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-02 15:20 Peter Teoh
2008-02-02 16:07 ` Frans Pop
2008-02-02 18:48 ` Sam Ravnborg [this message]

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=20080202184825.GE25399@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=htmldeveloper@gmail.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®