Re: Probable endianess problem in TLAN driver

From: David S. Miller (davem@redhat.com)
Date: Sat Jun 09 2001 - 17:38:45 EST


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/



This archive was generated by hypermail 2b29 : Fri Jun 15 2001 - 21:00:11 EST