[PATCH 6/6] [POWERPC] make struct property's value a void *

David Miller davem at davemloft.net
Thu Apr 5 05:21:29 EST 2007


From: Segher Boessenkool <segher at kernel.crashing.org>
Date: Wed, 4 Apr 2007 13:11:43 +0200

> >> Why?  It should logically be an u8 * (and nothing
> >> should ever cast it to anything else, accessor
> >> functions should be used instead to get 32-bit ints
> >> from it, etc.)
> >
> > Ummm, no.
> >
> > There are structures there, and other types of objects.
> 
> There are arrays of bytes there, with no guarantee of
> any further alignment.

On PowerPC misaligned data doesn't generate exceptions, the chip works
it out transparently.  It's not very slow at it even, and these paths
accessing this stuff aren't performance critical anyways.

On sparc everything is aligned.  I know, I've been accessing OFW data
structures for more than 10 years and I haven't gotten one unaligned
trap on sparc yet.

> So just do an of_decode_int() and its cousins -- platforms
> that are trying to guarantee alignment, or that can handle
> unaligned memory accesses, can just define these as direct
> accesses; everyone else should use the read-by-byte sequences.

No, that's just stupid.  Peppering simple accesses to properties
with these wrappers is just going to make the code uglier for
no tangible gain whatsoever.

There is no reason to make a mountain out of a mole hill wrt. this
stuff.

And besides what Stephen is doing is just extending existing
practice, he isn't changing how any of this stuff is already
used.  So this discussion should not get in the way of his
patches getting installed.



More information about the Linuxppc-dev mailing list