[lkml]   [2001]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: unsigned long ioremap()?
"David S. Miller" wrote:
> Abramo Bagnara writes:
> > it's perfectly fine to have:
> >
> > regs = (struct reg *) ioremap(addr, size);
> > foo = readl((unsigned long)&regs->bar);
> >
> I don't see how one can find this valid compared to my preference of
> just plain readl(&regs->bar); You're telling me it's nicer to have the
> butt ugly cast there which serves no purpose?

It's right API a bit misused (to allow your request to use fields by

i.e. foo = readl((unsigned long)&regs->bar);

vs a wrong API that need a cast to be used correctly

i.e. rme9652->iobase = (unsigned long) ioremap(rme9652->port,

Taken in account that the main point is to not have fake pointers here
and there, my choice would be obvious.

> One could argue btw that structure offsets are less error prone to
> code than register offset defines out the wazoo.

offset defines are never correct on some architecture while being
incorrect on some other, that's the whole point: a wrong #define is
likely squashed during the very first phase of driver development.

Abramo Bagnara

Opera Unica Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy

ALSA project
It sounds good!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:52    [W:0.122 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site