[parisc-linux] pdc_add_valid

Stan Sieler sieler@allegro.com
Fri, 5 Oct 2001 14:58:13 -0700 (PDT)


Re:

>         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:

Very good point.

Code should be readable first, and efficient second.

Routines that work the opposite of their name are just problems
waiting to happen.
 
> 	if (valid_io_addr (port+4)) {
vs:
> +       return (pdc_add_valid (addr) == PDC_OK);

The latter has the advantage that the reader knows it's a PDC
routine being called, not some kernel routine that could be done
who knows what.

Thus, I'd go for the latter, or change your "valid_io_addr" to
"pdc_valid_io_addr", to (a) be readable; and (b) convey the PDC info.

Stan (still can't believe HP-UX uses non-compatible "sprintf" in the kernel) Sieler