[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0806040811350.3473@woody.linux-foundation.org>
Date: Wed, 4 Jun 2008 08:31:58 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Haavard Skinnemoen <haavard.skinnemoen@...el.com>
cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
benh@...nel.crashing.org, Matthew Wilcox <matthew@....cx>,
David Miller <davem@...emloft.net>, linux-arch@...r.kernel.org,
scottwood@...escale.com, linuxppc-dev@...abs.org,
alan@...rguk.ukuu.org.uk, linux-kernel@...r.kernel.org,
tpiepho@...escale.com
Subject: Re: MMIO and gcc re-ordering issue
On Mon, 2 Jun 2008, Haavard Skinnemoen wrote:
>
> > So what happened to the old idea of putting the accessor function pointers
> > in the device/bus structure?
>
> Don't know. I think it sounds like overkill to replace a simple load or
> store with an indirect function call.
Indeed. *Especially* as the driver in practice tends to always know which
one it is statically.
Yes, sometimes the same RTL may end up being used behind two differnt
buses, and with some broken byte-conversion hardware in the middle, but
that's pretty damn rare in the end. It happens, but it happens mostly with
the odd broken kind of embedded setups where somebody took a standard part
and then did something _strange_ to it - and in the process they may well
have introduced other issues as well.
I suspect you find this kind of thing mostly with things like stupid
integrated IDE controllers, and things like byte order tends to be the
_least_ of the issues (specialized register accesses with odd offsets etc
will happen).
So most of the time the byte order is simply decided by the hardware
itself (and LE is the common one, due to ISA/PCI). Sometimes you can set
it dynamically (at which point it's irrelevant - just pick the one you
want).
So I definitely argue against complex IO accessor functions with things
like dynamic support for byte order depending on bus. 99.9% of all
hardware simply do not need them, and the small percentage that might need
it will need special drivers anyway, so they might as well do the
complexity on their own rather than make everybody else care.
See for example the input driver for the i8042 chip: not only do those
things sometimes need native order (probably exactly because it's
integrated on a chip over some special "native bus", or just wired up to
be big-endian on a BE platform by some moron), but you'll also find that
they just need odd accesses anyway exactly because it's oddly wired up
(eg it's some special serial protocol that emulates ISA accesses).
So having some "byte-order correcting function" still wouldn't make any
sense, because it's not just about byte order.
Will that mean that you might occasionally have a "normal" driver and an
"odd" driver that actually drives what is basically the same HW block,
just wired up differently? Sure. But that's still a smaller price to pay
than it would be to try to make everything be "generic" when there is no
point to it.
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists