Messages in this thread | | | From | Bartlomiej Zolnierkiewicz <> | Subject | Re: [PATCH] powerpc/8xx: tqm8xx: fix incorrect placement of __initdata tag | Date | Mon, 30 Sep 2013 17:05:51 +0200 |
| |
On Monday, September 30, 2013 03:20:29 PM David Laight wrote: > > __initdata tag should be placed between the variable name and equal > > sign for the variable to be placed in the intended .init.data section. > ... > > -static struct __initdata cpm_pin tqm8xx_pins[] = { > > +static struct cpm_pin tqm8xx_pins[] __initdata = { > > As far as gcc is concerned it can go almost anywhere before the '=', > even before the 'static'. > Splitting 'struct cpm_pin' does seem an odd choice.
It is not only an odd choice, it just doesn't work as it should in the practice (as tested with gcc-4.6.3 from Ubuntu 12.04).
> The Linux coding standards might suggest a location. > I'd have thought that either before or after the 'static' would be best > (ie as a storage class qualifier).
The majority of the kernel code uses __initdata before equal sign and the __initdata documentation in <linux/init.h> recommends such usage:
" * For initialized data: * You should insert __initdata or __initconst between the variable name * and equal sign followed by value, e.g.: * * static int init_variable __initdata = 0; * static const char linux_logo[] __initconst = { 0x32, 0x36, ... }; "
Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics
| |