zd_addr_t is defined as
typedef u16 __nocast zd_addr_t;
The __nocast annotation forces us to use explicit casts for values of
this type. This is really useful as we have functions which take an
address and a value (e.g. register writes). It's very easy to get them
in the wrong order and have a non-obvious bug. With this mechanism,
sparse helps us avoid this.
The case with pointers may be a little unintuitive, but it's a small
price to pay for a bug that bit us hard once before...
The number of other places we have to cast is very small due to use of
the preprocessor. For example we have:
#define ZD_ADDR(base, offset) \
((zd_addr_t)(((base) & ADDR_BASE_MASK) | ((offset) & ADDR_OFFSET_MASK)))
#define CTL_REG(offset) ZD_ADDR(CR_BASE, offset) /* byte addressing */
Then we have a few hundred registers defined in terms of CTL_REG.
For similar reasons.
Daniel
-