[PATCH] Abstract calls to in/out with IN/OUT macros

keithp keithp at keithp.com
Sun Nov 1 12:29:03 PST 2009

Excerpts from Matt Turner's message of Sun Nov 01 11:01:20 -0800 2009:
> This will allow us to include sys/io.h and use libc's in/out when
> available.

That's a fine goal, but given the ambiguity between Linux and BSD on
the outb argument ordering, I've got some suggestions

>  #    ifdef linux
> -/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
> -/* note that the appropriate setup via "ioperm" needs to be done */
> -/*  *before* any inx/outx is done. */
> +#     include <sys/io.h>
> +#     define OUTB(port, val) outb((val), (port))
> +#     define OUTW(port, val) outw((val), (port))
> +#     define OUTL(port, val) outl((val), (port))

Please use inline functions instead of macros. Also, please make it
obvious that these macros belong to X.org and are not brought from
some other package. Further, it would be nice to have them
self-documenting as far as argument order somehow, perhaps

static inline void xorg_outb_port_val(uint16_t port, uint8_t val)

(suggestions welcome here, I just want to make people aware of any
ordering change here).

What isn't clear is how this affects the current API; ideally, we'd
make all existing drivers using whatever old names they've got
continue to compile, but with warnings so that developers will know
what to do to fix them.

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20091101/1a165d3e/attachment.pgp 

More information about the xorg-devel mailing list