From patchwork Fri Dec 10 17:33:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 12670483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F90C433EF for ; Fri, 10 Dec 2021 17:40:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B4346B0085; Fri, 10 Dec 2021 12:33:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3BD306B0089; Fri, 10 Dec 2021 12:33:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1989E6B0088; Fri, 10 Dec 2021 12:33:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id F400D6B0087 for ; Fri, 10 Dec 2021 12:33:48 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B015689565 for ; Fri, 10 Dec 2021 17:33:38 +0000 (UTC) X-FDA: 78902581716.19.89D7189 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) by imf09.hostedemail.com (Postfix) with ESMTP id A016814000B for ; Fri, 10 Dec 2021 17:33:36 +0000 (UTC) Received: by mail-ot1-f44.google.com with SMTP id x43-20020a056830246b00b00570d09d34ebso10345396otr.2 for ; Fri, 10 Dec 2021 09:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z8DvdE8cQs/ahPWAnUud5n5yToq2pjtImEbhrWCSKj4=; b=A2U4egVLtJIpoFQ30tstUVGzUGtOmsoHZ0xs8fseV5579Sz4E00j5WbNj12yVBrh10 gBjWd+OSjLozqsC67VnD+TKT5lsMslmI9Dan2YNX0NvXY97ryAY1BHSC/uJesx1iBcpC Pd1bwFa6CQTZ3aeMIGkPxRo3I016VxH2gMgzU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z8DvdE8cQs/ahPWAnUud5n5yToq2pjtImEbhrWCSKj4=; b=z/ZBXWJw9ow4Glmq5UL8WGUG5cBUGu92c4YbH/p/fxYs8dBwkEdwhBT14iIrQqxOgD fAQThr9CmJC+opTbZ1JHYi8CPl0mU0TlUK0ykGmLdOZeCpaAq7bGXChf+Y5PWKgIu7+h 4sTX/miXuH4d0NfteBlNyUb5Bs5bAHFAjs7orHcT2Rx+DuC2Jxm9MFa0AsamEHcY+UVz jBPvH6ugmdV9txQnpX0aTbEVrekVjbODI6WA4hIfMDX2ZiDG9y/gaxLOfgNQJOPBFCLz /B/+pwltogbEIddRI2Rjwc4FnfFOiSw1pHSkT/8EUVzH3r81H/k1y6yyTDxFApDkqyA2 1NIw== X-Gm-Message-State: AOAM531+DRSj+f5eho9aZ2SYPJMbk4zh1DnZHxyStdLBBBNxfivu9ku1 HWv7z3GtlwY/20lbA78uVACE9Q== X-Google-Smtp-Source: ABdhPJw/EV9rFIsA/Y2l9EL9YhWZjVYVklXozZh2QN5jLKH28l9K6PLS2YIbrdvs6ptrFP99TR5idg== X-Received: by 2002:a05:6830:1216:: with SMTP id r22mr12680706otp.10.1639157617637; Fri, 10 Dec 2021 09:33:37 -0800 (PST) Received: from shuah-t480s.internal (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x4sm892224oiv.35.2021.12.10.09.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 09:33:37 -0800 (PST) From: Shuah Khan To: catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, keescook@chromium.org, mic@digikod.net, davem@davemloft.net, kuba@kernel.org, peterz@infradead.org, paulmck@kernel.org, boqun.feng@gmail.com, akpm@linux-foundation.org Cc: Shuah Khan , linux-kselftest@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 12/12] selftests/vm: remove ARRAY_SIZE define from individual tests Date: Fri, 10 Dec 2021 10:33:22 -0700 Message-Id: <18321f68b399cd2c2709131d6d6eb1d0f58e8b4f.1639156389.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-Stat-Signature: qdjxbz67bkwznd514h3umhigzijajhsc Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=google header.b=A2U4egVL; spf=pass (imf09.hostedemail.com: domain of skhan@linuxfoundation.org designates 209.85.210.44 as permitted sender) smtp.mailfrom=skhan@linuxfoundation.org; dmarc=pass (policy=none) header.from=linuxfoundation.org X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: A016814000B X-HE-Tag: 1639157616-517016 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000126, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: ARRAY_SIZE is defined in several selftests. Remove definitions from individual test files and include header file for the define instead. ARRAY_SIZE define is added in a separate patch to prepare for this change. Remove ARRAY_SIZE from vm tests and pickup the one defined in kselftest.h. Signed-off-by: Shuah Khan --- tools/testing/selftests/vm/mremap_test.c | 1 - tools/testing/selftests/vm/pkey-helpers.h | 3 ++- tools/testing/selftests/vm/va_128TBswitch.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/mremap_test.c b/tools/testing/selftests/vm/mremap_test.c index 0624d1bd71b5..7c0b0617b9f8 100644 --- a/tools/testing/selftests/vm/mremap_test.c +++ b/tools/testing/selftests/vm/mremap_test.c @@ -20,7 +20,6 @@ #define VALIDATION_DEFAULT_THRESHOLD 4 /* 4MB */ #define VALIDATION_NO_THRESHOLD 0 /* Verify the entire region */ -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define MIN(X, Y) ((X) < (Y) ? (X) : (Y)) struct config { diff --git a/tools/testing/selftests/vm/pkey-helpers.h b/tools/testing/selftests/vm/pkey-helpers.h index 622a85848f61..92f3be3dd8e5 100644 --- a/tools/testing/selftests/vm/pkey-helpers.h +++ b/tools/testing/selftests/vm/pkey-helpers.h @@ -13,6 +13,8 @@ #include #include +#include "../kselftest.h" + /* Define some kernel-like types */ #define u8 __u8 #define u16 __u16 @@ -175,7 +177,6 @@ static inline void __pkey_write_allow(int pkey, int do_allow_write) dprintf4("pkey_reg now: %016llx\n", read_pkey_reg()); } -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) #define ALIGN_UP(x, align_to) (((x) + ((align_to)-1)) & ~((align_to)-1)) #define ALIGN_DOWN(x, align_to) ((x) & ~((align_to)-1)) #define ALIGN_PTR_UP(p, ptr_align_to) \ diff --git a/tools/testing/selftests/vm/va_128TBswitch.c b/tools/testing/selftests/vm/va_128TBswitch.c index 83acdff26a13..da6ec3b53ea8 100644 --- a/tools/testing/selftests/vm/va_128TBswitch.c +++ b/tools/testing/selftests/vm/va_128TBswitch.c @@ -9,7 +9,7 @@ #include #include -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) +#include "../kselftest.h" #ifdef __powerpc64__ #define PAGE_SIZE (64 << 10)