Messages in this thread |  | | Date | Fri, 04 May 2001 13:07:37 +0200 | From | Abramo Bagnara <> | Subject | Re: 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)®s->bar); > > > > I don't see how one can find this valid compared to my preference of > just plain readl(®s->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 name)
i.e. foo = readl((unsigned long)®s->bar);
vs a wrong API that need a cast to be used correctly
i.e. rme9652->iobase = (unsigned long) ioremap(rme9652->port, RME9652_IO_EXTENT);
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 mailto:abramo@alsa-project.org
Opera Unica Phone: +39.546.656023 Via Emilia Interna, 140 48014 Castel Bolognese (RA) - Italy
ALSA project http://www.alsa-project.org It sounds good! - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |