Received: by 10.213.65.68 with SMTP id h4csp473933imn; Fri, 16 Mar 2018 08:51:18 -0700 (PDT) X-Google-Smtp-Source: AG47ELseqknauoUZyVgCIctVrcokibDOa8ziRuS8Az5LSXsSok8y70pChdp/GERdK0JUUdZMCRuh X-Received: by 2002:a17:902:7290:: with SMTP id d16-v6mr2635936pll.31.1521215478738; Fri, 16 Mar 2018 08:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521215478; cv=none; d=google.com; s=arc-20160816; b=RbcnVton2wqvK1Fd0SqzO2Xiw7E0X7oZyND1KeSKKPbBOq1VwpsiUEAT1hveVlzpD/ N/rz67trjs1qlCPJiRKNjJXXgjrZp8baW/f/c8ynndseAJAwDupVQkCWKMl8eGDtkuFy mWBI8NeCFgs1xOl+/uRIOCrEVW27V3SluNFqmkWctHhfExCUODRWvNDhVNoMoQBerWms ihS1LAzffHsM4FSQPneLXxvIZzDQFKSbtPfiAznm+MmzKntP+ddknW4w1Prb+Xxn7pDD i5xJxhFqOXAk2PK0vP0QLTzygbRUNd8SA5mvMaqF4kyw6IYfLfkOeEUrxG8Mk53ABBCX 2k7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=vPIYhx/iapWgjMkks4tmy5yuHZy5fgHBuNRlMj9FX/Y=; b=vF5+jdRT49OXKyzpyVpN20Y/Leahm3bvPwv4sTXDaiKljlDcsn9vFFFq2xTyQ5KUMH AWbaM3JFM/yFrxgwuaNAbuWaIGwBnpapVsQUNUNe2uM1Se+aK+ZY4McMQ7BFtqEncUf3 kaPu59OXBT/51cWpneNUcbGbofdejYxOfL2Y4dW4l2JSQpLlpl40Qia7BcyHZeu/sKUA /t3V9Ej0rA6U2r/jjBPUmv00SUKil61E4u7VahAsrciTz5WO3IBp1LuSCrwAuwEmcwmV ovOzkBcVv4+n1efqebSHHG8gyKdWNP8rBWzSibubxVGb/U9nhx+YYAxzzjRTENyRe5W5 G+6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32-v6si6566357pld.591.2018.03.16.08.51.04; Fri, 16 Mar 2018 08:51:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753881AbeCPPtJ (ORCPT + 99 others); Fri, 16 Mar 2018 11:49:09 -0400 Received: from ale.deltatee.com ([207.54.116.67]:54486 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933735AbeCPPtA (ORCPT ); Fri, 16 Mar 2018 11:49:00 -0400 Received: from cgy1-donard.priv.deltatee.com ([172.16.1.31]) by ale.deltatee.com with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ewrbF-0003pS-ID; Fri, 16 Mar 2018 09:48:58 -0600 Received: from gunthorp by cgy1-donard.priv.deltatee.com with local (Exim 4.89) (envelope-from ) id 1ewrbE-0003Rt-Ej; Fri, 16 Mar 2018 09:48:56 -0600 From: Logan Gunthorpe 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 , Thomas Gleixner , Philippe Ombredanne , Kate Stewart Date: Fri, 16 Mar 2018 09:48:44 -0600 Message-Id: <20180316154852.13206-2-logang@deltatee.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180316154852.13206-1-logang@deltatee.com> References: <20180316154852.13206-1-logang@deltatee.com> X-SA-Exim-Connect-IP: 172.16.1.31 X-SA-Exim-Rcpt-To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-crypto@vger.kernel.org, arnd@arndb.de, andy.shevchenko@gmail.com, horia.geanta@nxp.com, logang@deltatee.com, tglx@linutronix.de, pombredanne@nexb.com, gregkh@linuxfoundation.org, kstewart@linuxfoundation.org X-SA-Exim-Mail-From: gunthorp@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-6.7 required=5.0 tests=ALL_TRUSTED,BAYES_00, MYRULES_NO_TEXT,T_RP_MATCHES_RCVD autolearn=no autolearn_force=no version=3.4.1 Subject: [PATCH v12 1/9] iomap: Fix sparse endian check warnings X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Warnings of the form: lib/iomap.c:84:9: warning: cast to restricted __be16 Are found when running sparse checker with: make C=2 CF=-D__CHECK_ENDIAN__ This patch casts them with __force to suppress the warnings. Also, it looks like the wrong conversion function was used in the mmio_writeXXbe macros: 'val' is a cpu value to be written to a big endian register. Therefore cpu_to_beXX should have been used instead of beXX_to_cpu. Both are equivalent, functionally, but have different meanings. So there was no real bug just confusion for people reading the code and the sparse endian check. Signed-off-by: Logan Gunthorpe Cc: Thomas Gleixner Cc: Greg Kroah-Hartman Cc: Philippe Ombredanne Cc: Kate Stewart --- lib/iomap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/iomap.c b/lib/iomap.c index 541d926da95e..a05d9fa21794 100644 --- a/lib/iomap.c +++ b/lib/iomap.c @@ -65,8 +65,8 @@ static void bad_io_access(unsigned long port, const char *access) #endif #ifndef mmio_read16be -#define mmio_read16be(addr) be16_to_cpu(__raw_readw(addr)) -#define mmio_read32be(addr) be32_to_cpu(__raw_readl(addr)) +#define mmio_read16be(addr) be16_to_cpu((__be16 __force)__raw_readw(addr)) +#define mmio_read32be(addr) be32_to_cpu((__be32 __force)__raw_readl(addr)) #endif unsigned int ioread8(void __iomem *addr) @@ -106,8 +106,10 @@ 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((u16 __force)cpu_to_be16(val), port) +#define mmio_write32be(val, port) \ + __raw_writel((u32 __force)cpu_to_be32(val), port) #endif void iowrite8(u8 val, void __iomem *addr) -- 2.11.0