Re: IO, ANSI vs GCC structs

2 messages, 2 authors, 2003-07-25 · open the first message on its own page

Re: IO, ANSI vs GCC structs

From: Kent Borg <hidden>
Date: 2003-07-25 17:47:34

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);


?


Thanks,

-kb

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

Re: IO, ANSI vs GCC structs

From: Paul Mackerras <hidden>
Date: 2003-07-25 21:45:56

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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help