From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755450AbcK1UFC (ORCPT ); Mon, 28 Nov 2016 15:05:02 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:52462 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754990AbcK1T4o (ORCPT ); Mon, 28 Nov 2016 14:56:44 -0500 x-originating-ip: 72.167.245.219 From: Matthew Wilcox To: linux-kernel@vger.kernel.org, Andrew Morton , Konstantin Khlebnikov , Ross Zwisler Cc: Matthew Wilcox , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, "Kirill A . Shutemov" Subject: [PATCH v3 02/33] tools: Add WARN_ON_ONCE Date: Mon, 28 Nov 2016 13:50:40 -0800 Message-Id: <1480369871-5271-37-git-send-email-mawilcox@linuxonhyperv.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> References: <1480369871-5271-1-git-send-email-mawilcox@linuxonhyperv.com> X-CMAE-Envelope: MS4wfEPIPgdpaMk+7QtiVYs958MhPLzdk5g5DBPz5ldnhDJLByU08okGG1+6880unHSUoeP2iocuDGM+V9od1Jlkr+SdUuaGwd6G4fPpmSTLYNo9cXmLR5rM UQSXRcojYWpDfJ7YmgwSKEw0xEuCo5mx/Qylmj2MeOlmCicaucerDOWuGZSwz4L5K5zzJ1lIwPVuGBddnTutgBR/lPbto7I6IlWtkqMx4hzKXyFaSBU+croC GPF14/IIZw1TMx2m7wycPnTc7em4V08PrdOD77T0reB8LDfQ/IyfKPMO/lFBIdh8+H40YSeLrA96wfrrA6ku5Bd6WRn6nCglqmhKIqNWVSn9nZs7A28eL5bg VnZxaKQZ459ZXar2YkgID4az9M/CeggncTDywwsMvIXh7s0Dj59srw7LEUJNcggg7woUCLYub6tCjGpzTfD4j4tWV+e88OfowiFdfU8tdUKbR7pz1qo= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox The radix tree uses its own buggy WARN_ON_ONCE. Replace it with the definition from asm-generic/bug.h Signed-off-by: Matthew Wilcox --- tools/include/asm/bug.h | 11 +++++++++++ tools/testing/radix-tree/Makefile | 2 +- tools/testing/radix-tree/linux/bug.h | 2 +- tools/testing/radix-tree/linux/types.h | 2 -- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/include/asm/bug.h b/tools/include/asm/bug.h index 9e5f484..beda1a8 100644 --- a/tools/include/asm/bug.h +++ b/tools/include/asm/bug.h @@ -12,6 +12,17 @@ unlikely(__ret_warn_on); \ }) +#define WARN_ON_ONCE(condition) ({ \ + static int __warned; \ + int __ret_warn_once = !!(condition); \ + \ + if (unlikely(__ret_warn_once && !__warned)) { \ + __warned = true; \ + WARN_ON(1); \ + } \ + unlikely(__ret_warn_once); \ +}) + #define WARN_ONCE(condition, format...) ({ \ static int __warned; \ int __ret_warn_once = !!(condition); \ diff --git a/tools/testing/radix-tree/Makefile b/tools/testing/radix-tree/Makefile index f2e07f2..3c338dc 100644 --- a/tools/testing/radix-tree/Makefile +++ b/tools/testing/radix-tree/Makefile @@ -1,5 +1,5 @@ -CFLAGS += -I. -g -O2 -Wall -D_LGPL_SOURCE +CFLAGS += -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE LDFLAGS += -lpthread -lurcu TARGETS = main OFILES = main.o radix-tree.o linux.o test.o tag_check.o find_next_bit.o \ diff --git a/tools/testing/radix-tree/linux/bug.h b/tools/testing/radix-tree/linux/bug.h index ccbe444..23b8ed5 100644 --- a/tools/testing/radix-tree/linux/bug.h +++ b/tools/testing/radix-tree/linux/bug.h @@ -1 +1 @@ -#define WARN_ON_ONCE(x) assert(x) +#include "asm/bug.h" diff --git a/tools/testing/radix-tree/linux/types.h b/tools/testing/radix-tree/linux/types.h index faa0b6f..8491d89 100644 --- a/tools/testing/radix-tree/linux/types.h +++ b/tools/testing/radix-tree/linux/types.h @@ -6,8 +6,6 @@ #define __rcu #define __read_mostly -#define BITS_PER_LONG (sizeof(long) * 8) - static inline void INIT_LIST_HEAD(struct list_head *list) { list->next = list; -- 2.10.2