From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ale.deltatee.com (ale.deltatee.com. [207.54.116.67]) by gmr-mx.google.com with ESMTPS id v40-v6si404326ote.5.2018.03.22.10.17.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Mar 2018 10:17:17 -0700 (PDT) From: Logan Gunthorpe Date: Thu, 22 Mar 2018 11:16:54 -0600 Message-Id: <20180322171703.4300-2-logang@deltatee.com> In-Reply-To: <20180322171703.4300-1-logang@deltatee.com> References: <20180322171703.4300-1-logang@deltatee.com> Subject: [PATCH v14 01/10] iomap: Use correct endian conversion function in mmio_writeXXbe To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-ntb@googlegroups.com, linux-crypto@vger.kernel.org, Greg Kroah-Hartman Cc: Arnd Bergmann , Andy Shevchenko , =?UTF-8?q?Horia=20Geant=C4=83?= , Logan Gunthorpe , Philippe Ombredanne , Thomas Gleixner , Kate Stewart List-ID: The semantics of the iowriteXXbe() functions are to write a value in CPU endianess to an IO register that is known by the caller to be in Big Endian. The mmio_writeXXbe() macro, which is called by iowriteXXbe(), should therefore use cpu_to_beXX() instead of beXX_to_cpu(). Seeing both beXX_to_cpu() and cpu_to_beXX() are both functionally implemented as either null operations or swabXX operations there was no noticable bug here. But it is confusing for both developers and code analysis tools alike. Signed-off-by: Logan Gunthorpe Reviewed-by: Luc Van Oostenryck Reviewed-by: Andy Shevchenko Cc: Philippe Ombredanne Cc: Thomas Gleixner Cc: Kate Stewart Cc: Greg Kroah-Hartman --- lib/iomap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/iomap.c b/lib/iomap.c index 541d926da95e..be120c13d6cc 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -106,8 +106,8 @@ EXPORT_SYMBOL(ioread32be); #endif #ifndef mmio_write16be -#define mmio_write16be(val,port) __raw_writew(be16_to_cpu(val),port) -#define mmio_write32be(val,port) __raw_writel(be32_to_cpu(val),port) +#define mmio_write16be(val,port) __raw_writew(cpu_to_be16(val),port) +#define mmio_write32be(val,port) __raw_writel(cpu_to_be32(val),port) #endif void iowrite8(u8 val, void __iomem *addr) -- 2.11.0