On Wed, Sep 08, 2010 at 09:54:41AM -0700, Alison Chaiken wrote:
> *Question*: the statement
>
> struct pci_device_id network_driver_pci_table[]{};
>
> defines network_driver_pci_table as an array of structs of type
> pci_device_id. What is the extra qualifier __devinitdata doing
> after the
>
> struct pci_device_id network_driver_pci_table[]
>
> declaration?
__devinitdata is a preprocessor macro that will place the storage of the
supported device PCI ID table in a specific section for special
treatment. Is some configurations it will expand to the gcc-specific:
__section(.devinit.data)
attribute, which instructs the compiler to place it in the .devinit.data
section of the binary.
> I don't understand how this is legal C.
Using the __section() attribute As far as I know it is not technically
legal C, but is an extension supported by gcc (and possibly others)
which the kernel uses heavily.
> We can't just go on and on with an arbitrary number of qualifiers, can
> we? And init.h says
>
> #ifdef CONFIG_HOTPLUG
> #define __devinitdata
>
> So we're putting a compiler flag in a struct definition??
In this case, with your kernel configured with CONFIG_HOTPLUG, its not
useful to place the ID table in a separate section, so the preprocessor
will expand the __devinitdata token to an empty string.
Hope this helps.
--
- joshc
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ