Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753636AbdGNJbS (ORCPT ); Fri, 14 Jul 2017 05:31:18 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:59663 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbdGNJbQ (ORCPT ); Fri, 14 Jul 2017 05:31:16 -0400 From: Arnd Bergmann To: linux-kernel@vger.kernel.org, Len Brown Cc: Greg Kroah-Hartman , Linus Torvalds , Tejun Heo , Guenter Roeck , linux-ide@vger.kernel.org, linux-media@vger.kernel.org, akpm@linux-foundation.org, dri-devel@lists.freedesktop.org, Arnd Bergmann 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1257 Lines: 36 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)) -- 2.9.0