Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp13556pxb; Wed, 25 Aug 2021 18:29:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhta2lSQ5NoaXAYm1HSKVImkBxriIrPXJVYEqEjTzXbdaTCtoK310PEYOw29cBNcsHZHes X-Received: by 2002:a02:7312:: with SMTP id y18mr1188345jab.129.1629941390324; Wed, 25 Aug 2021 18:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629941390; cv=none; d=google.com; s=arc-20160816; b=LcUEZrIiYTFizkeLQ4u71tpBuSiiebdnbo0vGodvtboVh+Yx/kp4NgwspzcAhXwDG5 3dtB+jrUtDAVMq8ZxjRiLm3n+0BAUUkx8eY9ukqk++kYc07bdJ1Zvt7bHCKsJJYb3w5a QoPOCvyBB1xzcFUXXNmKRRdNQWW2SIQRAGAJ8EH2MkA2tVCiKLtDvnIbhnbAcle2RGxs 2WA2tzy9Ch3tTTYXLkmixJHnm4euzOqwb9gVQfINLJJAl1qHeDxcS8JKONJYWc0/ah4U ktglklE1wy6bxhPC8eBocXjPBq7RY0XyhS9C0UiGnX/yx8jtTztGXXhYQZBX2j7nuuvd LIRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hDuUPantBA5RaLY4chr+boj+alaUK90TOLcT8GmDFog=; b=UiF9CgKpEwJjTuOkE341SvTi9QzD6diH8EEASOGmru2ZDKyF4UgTLQDut7BISKHgP2 aRiKi9K33IYq/P+gmEGY1Wuo5jJ8DXL7rpfDTHfWC3VFVGnkGheuVKff4hc+6Lz/tArd WDmloVqmTn4AfyhqHPrcW2On6sSu67nXTJQ/530jyLzrLYseibr7c7GDfzbSBF0AokZi Ng/caIdvMVPp9Hq2Yx0AM8pdtbjGj3+If6LqI+LZnWMRgyb3mIrNL/qf5nZI4xuoTGxo wjC9mnvo9z2SmsEwHgd4nEx1PaxKEASo4hintuuXMFTEGVsx1haNHFnA4I7mhrKcSpA1 zwiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@usp.br header.s=usp-google header.b=xUDBsaZh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=usp.br Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si1390149jan.43.2021.08.25.18.29.39; Wed, 25 Aug 2021 18:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@usp.br header.s=usp-google header.b=xUDBsaZh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=usp.br Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236931AbhHZB1c (ORCPT + 99 others); Wed, 25 Aug 2021 21:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236861AbhHZB13 (ORCPT ); Wed, 25 Aug 2021 21:27:29 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 427B6C061757 for ; Wed, 25 Aug 2021 18:26:43 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id bk29so1606859qkb.8 for ; Wed, 25 Aug 2021 18:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hDuUPantBA5RaLY4chr+boj+alaUK90TOLcT8GmDFog=; b=xUDBsaZhosklBFsDMllxdJ1Q26GXuAW0BjjO05dH7OLOQ+RGuXZZ/EVLO8aUiDtRPr aaKGrjzokz6zBfJzWr8GXkX0ztaQwn51TQ5o6Tkx/D6xCmsfOgvHYlIXAm5tGQbbD52u 7dfBn3OOgA0Q8AYGaoy25OSC5YELbHCTXr1DBnseakkBcWFL4A9Is9PaUBMbLePupTlQ Au8uNHPI3pVZJzCeqwlF8MUXRrdDxwMIOJkYdYW0Nm12YOg+w8G8kOyy6u8O0NNKd5Bn K2lyZpXmBpYYyMSjcNlCzNh/bo4AgubB+gqcXl44q1MzPNHYBbqJAZer1E/f8V2gi13q hM9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hDuUPantBA5RaLY4chr+boj+alaUK90TOLcT8GmDFog=; b=iUAqkIAlnBPZQAaaXyomaq8DYO8QDIIXgnZsnApDkDgO5hAy3FL2PjdxaQPo8XfByt oGT5UjQ0e8yPYUIjWOmXJEJPM0qgQcuzDEbB0GaLTpnWAI5mQ1bsnesMvZq+fZ4K05UF ms1f/B17imYe5Kf4g5Cmeon+tlD83kL6EiVpq8KFpQkNumly6OX5wxFIVyHq0yVNxJ9i 9+6caS7QUevP0q35xdHOZsS3SwnvTqUoPEBAhyj6BsVR+TbdkJq1fBqBNLlLb8HlaHp9 ZlazRo9GvT5zSUcPHcxMDLcyf+Y8F8exn+LQjO9XrTNtRXZwzWTX7rCtgA3deVU5673l CBlA== X-Gm-Message-State: AOAM531zTY/mABjj7gHOq8f+NojpUNK6+dGE78h2MEnDmyPeuS2XZd0P vos/AxtVUbbn+CcGmYldu99ehQ== X-Received: by 2002:a37:2f47:: with SMTP id v68mr1485643qkh.190.1629941202408; Wed, 25 Aug 2021 18:26:42 -0700 (PDT) Received: from aehse.localdomain (177-209-76-11.user3p.veloxzone.com.br. [177.209.76.11]) by smtp.gmail.com with ESMTPSA id p123sm1375053qke.94.2021.08.25.18.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 18:26:42 -0700 (PDT) From: Isabella Basso To: linux@sciencehorizons.net, geert@linux-m68k.org Cc: ferreiraenzoa@gmail.com, augusto.duraes33@gmail.com, brendanhiggins@google.com, dlatypov@google.com, davidgow@google.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, ~lkcamp/patches@lists.sr.ht, rodrigosiqueiramelo@gmail.com, Isabella Basso Subject: [PATCH 2/6] test_hash.c: move common definitions to top of file Date: Wed, 25 Aug 2021 22:26:22 -0300 Message-Id: <20210826012626.1163705-3-isabellabdoamaral@usp.br> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210826012626.1163705-1-isabellabdoamaral@usp.br> References: <20210826012626.1163705-1-isabellabdoamaral@usp.br> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Keep function signatures minimal by making common definitions static. This does not change any behavior. Signed-off-by: Isabella Basso --- lib/test_hash.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/test_hash.c b/lib/test_hash.c index d4b0cfdb0377..8bcc645a7294 100644 --- a/lib/test_hash.c +++ b/lib/test_hash.c @@ -23,6 +23,11 @@ #include #include +#define SIZE 256 /* Run time is cubic in SIZE */ + +static u32 string_or; /* stores or-ed string output */ +static u32 hash_or[2][33] = { { 0, } }; /* stores or-ed hash output */ + /* 32-bit XORSHIFT generator. Seed must not be zero. */ static u32 __init __attribute_const__ xorshift(u32 seed) @@ -66,7 +71,7 @@ fill_buf(char *buf, size_t len, u32 seed) * recompile and re-test the module without rebooting. */ static bool __init -test_int_hash(unsigned long long h64, u32 hash_or[2][33]) +test_int_hash(unsigned long long h64) { int k; u32 h0 = (u32)h64, h1, h2; @@ -123,17 +128,15 @@ test_int_hash(unsigned long long h64, u32 hash_or[2][33]) return true; } -#define SIZE 256 /* Run time is cubic in SIZE */ - static int __init test_hash_init(void) { char buf[SIZE+1]; - u32 string_or = 0, hash_or[2][33] = { { 0, } }; unsigned tests = 0; unsigned long long h64 = 0; int i, j; + string_or = 0; fill_buf(buf, SIZE, 1); /* Test every possible non-empty substring in the buffer. */ @@ -161,7 +164,7 @@ test_hash_init(void) string_or |= h0; h64 = h64 << 32 | h0; /* For use with hash_64 */ - if (!test_int_hash(h64, hash_or)) + if (!test_int_hash(h64)) return -EINVAL; tests++; } /* i */ -- 2.33.0