From patchwork Fri Jul 14 09:30:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9840319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BFCE6602BD for ; Fri, 14 Jul 2017 09:31:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0A1E28777 for ; Fri, 14 Jul 2017 09:31:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A57E22878C; Fri, 14 Jul 2017 09:31:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4900628777 for ; Fri, 14 Jul 2017 09:31:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A3846E7AC; Fri, 14 Jul 2017 09:31:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.135]) by gabe.freedesktop.org (Postfix) with ESMTPS id 18E7C6E7AC for ; Fri, 14 Jul 2017 09:31:09 +0000 (UTC) Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lgc09-1e220j1ULl-00nuxO; Fri, 14 Jul 2017 11:30:24 +0200 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH 09/14] SFI: fix tautological-compare warning Date: Fri, 14 Jul 2017 11:30:12 +0200 Message-Id: <20170714093021.1341005-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170714092540.1217397-1-arnd@arndb.de> References: <20170714092540.1217397-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K0:hd1nKn8Ni74HjCk1caFaj/ZCREhsjc/sH301HkaxXRLP1WjuJwr pE7pPlwNHp9VPbq83b8af8y15hpKMzLw/KLn3eSM+Su3Xnr0BxFvJkKJA/2uUPSKZy1L2Aa I8PjFJNt3I8VHpnFwC2f7C54M5QNUMZ5tv1Sda1p7ff27bO4/4pwJVAwgR7hqPDwNaEdE5e 9X1vJ0+3ojsSa/6H7x3KA== X-UI-Out-Filterresults: notjunk:1; V01:K0:wpDrTwKjQqA=:1MRVRkbnSch/neTC2YjGze 35osCz5S77ILh0ZqEZXKnye7xEujvroIQMOJJDsBhrNXttXwaQeqNBDkfx8kN1vVX3QSsQ87u YTnAEzp7W1wXsntHOgf48EWNUr9XGrjnR1GyhfXMFoG825hP1OJtf91RR3eJHVLJ2A0uEdovp 2NY9oI5rJdArt3x3p2sDk9sOrozQeIDXcXQWDFJnLJLOXofvw9usse2HvCVzO5a0EwDAHM6fi PnbL4frirqnsFgUeMKEpnz4h6xcLlyh2fGiXoaBqPZ1xW1a+tupo1SLjxa5Qql8WnXuZUNVa4 22kvhD7eEW3jAvMFsNaYsDtFYzOhPgU4XWnlaML473rv0LwdVIhCchFnT9pC9grg9ZKFJJXua BiP9BX1+Sa51+eZ0Egtug0pY9Lxp5tPhwRTrMYkiF4bUDOguExgHHtYxIvfm7K/y3+z9NpS6N nvnADUWNlMrQtR9asU0bSwgWtAJqJG9VpaOtc9QwicpqYbWmcuea9vQssR1J/IBs4V90TCkTf zA+OHKGp84UwU6tY3MsD5wpBk1r8KdnUbL9vDTHYMLlNJLs0/sS56rjpSgmihkGW0PyfXGeyO kNh+RQFxPnK4e5Ht+Cg4p/KssCf+QFjgNmrU2jOXa3PBuOMEUUVAlKs8G0+5F8mWLhE2RVNJp 10csQTTc3dxh1a54s7saJvA9ASByWpds2MiKlNXGV/BvNhwPO8leUivbdhpF/K2rlThEVTUo1 E6xEyiQtuuxPHd1x0QQMoW3yyXmlVK//iWVSCFHEhTiBhqTrYNtJw9a2D/g= Cc: Arnd Bergmann , Greg Kroah-Hartman , dri-devel@lists.freedesktop.org, linux-ide@vger.kernel.org, Tejun Heo , akpm@linux-foundation.org, Linus Torvalds , Guenter Roeck , linux-media@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP With ccache in combination with gcc-6, we get a harmless warning for the sfi subsystem, as ccache only sees the preprocessed source: drivers/sfi/sfi_core.c: In function ‘sfi_map_table’: drivers/sfi/sfi_core.c:175:53: error: self-comparison always evaluates to true [-Werror=tautological-compare] Using an inline function to do the comparison tells the compiler what is going on even for preprocessed files, and avoids the warning. Signed-off-by: Arnd Bergmann --- drivers/sfi/sfi_core.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/sfi/sfi_core.c b/drivers/sfi/sfi_core.c index 296db7a69c27..a8f2313a2613 100644 --- a/drivers/sfi/sfi_core.c +++ b/drivers/sfi/sfi_core.c @@ -71,9 +71,12 @@ #include "sfi_core.h" -#define ON_SAME_PAGE(addr1, addr2) \ - (((unsigned long)(addr1) & PAGE_MASK) == \ - ((unsigned long)(addr2) & PAGE_MASK)) +static inline bool on_same_page(unsigned long addr1, unsigned long addr2) +{ + return (addr1 & PAGE_MASK) == (addr2 & PAGE_MASK); +} + +#define ON_SAME_PAGE(addr1, addr2) on_same_page((unsigned long)addr1, (unsigned long)addr2) #define TABLE_ON_PAGE(page, table, size) (ON_SAME_PAGE(page, table) && \ ON_SAME_PAGE(page, table + size))