Messages in this thread | | | Date | Thu, 19 Aug 1999 11:12:12 -0700 (PDT) | From | Linus Torvalds <> | Subject | Re: What is the right type to store virtual address ? |
| |
On Thu, 19 Aug 1999, Petr Vandrovec wrote: > > if we are talking about endianess, I have one related small > question: in variable of which type I should store return > value from ioremap() ?
It shouldn't much matter for the simple reason that the only thing you can do with the return value from ioremap() is to pass it in to read[bwl]() and friends, and they (for historical reasons) accept both a pointer and a integer.
So you might as well toss a coin - it has to be something you can do arithmetic on because I want people to be able to just say "base+offset", but again "unsigned long" and "void *" are equivalent on gcc in that regard. If it wasn't for the arithmetic issue I'd just make it a special type altogether to make the compiler warn about misuses.
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.
Linus
- 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/
| |