From: Abramo Bagnara <abramo@alsa-project.org>
To: "David S. Miller" <davem@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Linux Kernel Development <linux-kernel@vger.kernel.org>
Subject: Re: unsigned long ioremap()?
Date: Fri, 04 May 2001 13:07:37 +0200 [thread overview]
Message-ID: <3AF28D79.4BC0D1BE@alsa-project.org> (raw)
In-Reply-To: <3AF10E80.63727970@alsa-project.org> <Pine.LNX.4.05.10105030852330.9438-100000@callisto.of.borg> <15089.979.650927.634060@pizda.ninka.net> <11718.988883128@redhat.com> <3AF12B94.60083603@alsa-project.org> <15089.63036.52229.489681@pizda.ninka.net> <3AF25700.19889930@alsa-project.org> <15090.23187.739430.925103@pizda.ninka.net>
"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!
next prev parent reply other threads:[~2001-05-04 11:08 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-03 6:55 unsigned long ioremap()? Geert Uytterhoeven
2001-05-03 7:08 ` David S. Miller
2001-05-03 7:18 ` Jeff Garzik
2001-05-03 7:29 ` C.Praveen
2001-05-03 7:46 ` Jonathan Lundell
2001-05-03 7:57 ` Geert Uytterhoeven
2001-05-03 7:53 ` Abramo Bagnara
2001-05-03 8:08 ` Jeff Garzik
2001-05-03 8:26 ` Geert Uytterhoeven
2001-05-03 8:39 ` Abramo Bagnara
2001-05-03 8:44 ` Jeff Garzik
2001-05-03 8:53 ` Abramo Bagnara
2001-05-03 9:45 ` David Woodhouse
2001-05-03 9:57 ` Abramo Bagnara
2001-05-04 0:22 ` David S. Miller
2001-05-04 7:15 ` Abramo Bagnara
2001-05-04 7:30 ` David S. Miller
2001-05-04 11:07 ` Abramo Bagnara [this message]
2001-05-04 13:53 ` Jonathan Lundell
2001-05-13 14:00 ` Jes Sorensen
2001-05-13 14:38 ` Abramo Bagnara
2001-05-03 10:02 ` David Woodhouse
2001-05-03 7:33 ` Jonathan Lundell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3AF28D79.4BC0D1BE@alsa-project.org \
--to=abramo@alsa-project.org \
--cc=davem@redhat.com \
--cc=dwmw2@infradead.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.