On Thu, Feb 7, 2013 at 8:23 AM, Michal Simek <mon...@monstr.eu> wrote: >>> #define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr)) >>> #define iowrite16(v, addr) writew((v), (addr)) >>> #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) >>> >>> static inline void __raw_writew(u16 b, volatile void __iomem *addr) >>> { >>> *(volatile u16 __force *) addr = b; >>> } >>> >>> How is this suppose to work on Big Endian? >>> be16_to_cpu(v) is (v) >>> and >>> __cpu_to_le16(b) is swab16(v) >> >> Yes. > > But on native BE system ( I expect that v is in big endian) > iowrite16be(v, addr) should be just *(volatile u16 __force *) addr = > v; not *(volatile u16 __force *) addr = swab16(v);
>>> What I would expect is >>> #define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr) >> >> Indeed, it should be "__cpu_to_be16(v)" instead of "be16_to_cpu(v)". > > What do you mean by that? Bummer, I missed that current iowrite16be() uses (the little endian) iowrite16(), not _raw_writew(), and thought the only difference between the original and your version was the endianness conversion macro. Yes, #define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr) should be correct. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/