IO, ANSI vs GCC structs

Paul Mackerras paulus at samba.org
Sat Jul 26 07:45:56 EST 2003


Kent Borg writes:

> How important is it to the kernel coding style that hardware be
> accessed through a structure?  Is it acceptable to do:
>
>   #define MYHW  (MY_MBAR+42)
>
>   ...
>
>   out_be32(MYHW, 0xco1df00d);

Hmmm.  You should be using a value returned from ioremap() (or
equivalent) rather than a hard-coded constant.  Yes I know that people
set up 1-1 mappings with io_block_mapping and then do out_be32 to
hard-coded constant addresses but that is deprecated.

My preference is to define the offsets for individual registers as
constants rather than using a structure.

Paul.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list