Re: Probable endianess problem in TLAN driver

David S. Miller (davem@redhat.com)
Sat, 9 Jun 2001 15:38:45 -0700 (PDT)


Adrian Cox writes:
> > +#if defined(__powerpc__)
> > +#define inw(addr) le32_to_cpu(inw(addr))
> > +#define inl(addr) le32_to_cpu(inl(addr))
> > +#define outw(val, addr) outw(cpu_to_le32(val), addr)
> > +#define outl(val, addr) outl(cpu_to_le32(val), addr)
> > +#endif
>
> On ppc the inw, inl, outw, and outl functions already byteswap, so by
> adding the extra byteswap you're now passing unswapped data to the chip.

Yes, and this is true for every architecture.

All of {in,out}{b,w,l}() and {read/write}{b,w,l}() swap to/from
bus endianness for you.

Later,
David S. Miller
davem@redhat.com
-
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/