static immap_t __iomem *imap or immap_t *imap;
Arnd Bergmann
arnd at arndb.de
Tue Mar 6 23:44:00 EST 2007
On Tuesday 06 March 2007, DI BACCO ANTONIO - technolabs wrote:
> Why should I use
> static immap_t __iomem *imap;
> And not
> immap_t *imap;
> in a driver?
> when imap = ioremap_nocache()
>
> In particular I know that __iomem is useful to the compiler to avoid
> reordering and delaying io memory writes but what's the need for static
> in this case?
The '__iomem' is use to allow static checking with the 'sparse' tool,
you really should use that before submitting any code. At this point,
gcc itself doesn't care. ioremap_nocache() returns __iomem, so anything
you assign it to should also be __iomem.
The 'static' is what you should use for _any_ symbol that is private
to your driver in order to avoid namespace pollution, it has nothing
to do whatsoever with whether it is about an __iomem address or not.
Arnd <><
More information about the Linuxppc-embedded
mailing list