[parisc-linux] pdc_add_valid

Matthew Wilcox willy@debian.org
Fri, 5 Oct 2001 17:22:22 +0100


The pdc_add_valid function really annoys me.  Or maybe it's just how
it's used:

        if (!pdc_add_valid( (void *)(port+4))) {

Which says to me `if this address is not valid' -- the opposite of what it
does.  It could be rewritten as:

	if (pdc_add_valid((void *)(port+4)) == PDC_OK) {

but this takes more effort.  In my tree, I've added valid_io_addr which
does what it says on the tin:

	if (valid_io_addr(port+4)) {

For the moment, I've put it in <asm/io.h>, since it is for I/O addresses.

+int valid_io_addr(unsigned long addr)
+{
+       return (pdc_add_valid(addr) == PDC_OK);
+}

But maybe we should replace pdc_add_valid with valid_io_addr?  Or a
different function?  Suggestions appreciated.

-- 
Revolutions do not require corporate support.