> For _true_ cleanliness, it should probably be something like
>
> typedef struct {
> unsigned long base;
> } io_base_t;
>
> /*
> * The ISA legacy region 640kB-1M is always mapped,
> * here's the base
> */
> extern io_base_t isa_io_base;
>
> extern io_base_t ioremap(unsigned long addr, unsigned long len);
> extern unsigned char readb(io_base_t base, unsigned int offset);
> ...
>
> but while I'd potentially like to see that I also wonder about just the
> pain of doing the conversion.
I vote for it; it would help avoiding a number of bugs. For example
on the i386 the definition of
#define __io_virt(x) ((void *)(PAGE_OFFSET | (unsigned long)(x)))
#define __io_phys(x) ((unsigned long)(x) & ~PAGE_OFFSET)
make wrong constructs which effectivly do things like
__io_virt(__io_virt(addr)) or __io_phys(__io_phys(addr)) work. They're
obviously wrong. If above definition's could be changed to something
like:
#define __io_virt(x) ((void *)(PAGE_OFFSET + (unsigned long)(x)))
#define __io_phys(x) ((unsigned long)(x) - PAGE_OFFSET)
such broken could at least wouldn't work anymore. It's also a less
intrusive change than your suggestion as it should only break broken
drivers. Nevertheless I like your above suggestion - even if it'd be
a pain.
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/