Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp883171lqo; Fri, 17 May 2024 04:47:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBXzmqc/r705l5XNS8nRShrdKYMIHasJQuqvrSgPYQfHxfm65Q2XkLEMymWBF+Mom+LGU5SZtdtIRhcAMhppNwB98MoZf+pdVMUrcgdA== X-Google-Smtp-Source: AGHT+IENdQul9iSjbQJieSmfl5qP1AYXhjmM9cnrYPcOoQtC/HALrycJfRO9DNRyRRqA+fB+b4l2 X-Received: by 2002:a17:906:4899:b0:a5a:5634:a83a with SMTP id a640c23a62f3a-a5a5634a8abmr1106421366b.17.1715946470668; Fri, 17 May 2024 04:47:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715946470; cv=pass; d=google.com; s=arc-20160816; b=Dc3ZmVmG5HzyE1zuH8R0cay+lHGyj3/mTg6N8ts40XaxfDqGvst+x/jDcgX4vgfwWT bcQ5eoYmF+rdkLeikZven/esulg4oQl9wxhYEyb6LljUfieL0xDE8sFoYB5i/ehUEQTT j6PtaVUm8jtxha8qIE1Wvbi6SeoKgIS0GUUdVi+bejTYA4PvC6Pof4tTAsxG2z08VSLj YZ7pg53io7QbymgDj3rnPdXYH8m9hmjglIY9uEJAt2klHZinh/B/qgWfJFS8ZYCqIXlh +m4J8qdsd1UFb2YSjG+s4lRTIBHPjVor58IddGUJoVSgx0R7k+pTq9BeVyAZpYJlA5H0 DtZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ObJMmQBVz24I0x97OBX1HHcpzzpoz4740upihojreO0=; fh=5oIqPXof74fQesyArv3QYpek6D6+k8LK+7qTkJN/NYk=; b=kh7o+x/EhE+7K5AHojygYbOiSl0XVxANgy3da9CvhxT6/65KPQzdBUT88xfsCnr+cc 32RcHR2V7XvMxb56fBVea5xMm7IoqUaaCN91SotAaH2dyNlcdRkUe8wg5Wti5P+wz9mE 55SKDEizhV2gPZyM/xrxyoyhrjbl5xuJswUOK8kcbLbp9D3o9iBrf7Hwh/2/RZ/W1pdn uQKzdKls1JVcslB4vzUad5/V/2xL3yCpAZWwVJeRZUw/kRgJQVdKIudj9BErAaJuBx8W Q6pwNtOB34ubjiUqyjYd3YcvLduKRRrrZzPNuOjY+dMvoHpItuoFHGTKaYs/i/15xXKA 86jQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWuJnC7j; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182065-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182065-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17945e24si973852866b.139.2024.05.17.04.47.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 04:47:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182065-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FWuJnC7j; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-182065-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182065-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 363E41F24A67 for ; Fri, 17 May 2024 11:47:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD2B445037; Fri, 17 May 2024 11:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FWuJnC7j" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA67F41A91; Fri, 17 May 2024 11:47:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715946434; cv=none; b=DZ0BVe1IlWjd/zukW0YqSptfXXIuSKJ9McRtYyoaE7RKGyCI11g4aE/qjRYUhFo96tZWypRKt0d34O3H5ZpR6l74M3hRRYOU3A74iWvuHlRrMojSt9SIKzbIFOJX2nSgsLnDtHrlrxc7F3VJVgsmBrxVueKkrCwVlnNmL/zVoAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715946434; c=relaxed/simple; bh=IZoCG+gnWyPzPIvcxdkZJK9rpMSStUGz9XrJiHOZlhw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Zj4PEuB3JW1smYpzHI44fcWARa92Ws0BozyW7NP8s1ZyIvWArtrooAiRaH+oyJUixBaPfqtGkm3Avhf5xf2a/gxGp3+66iajMhkCBtCgLt53ECz+Os+GJ/d/m4kILR19u45LuKDN57kbsHicCuerPtKzCbMIluKk/b+8fV/WpTY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FWuJnC7j; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89202C2BD11; Fri, 17 May 2024 11:47:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715946434; bh=IZoCG+gnWyPzPIvcxdkZJK9rpMSStUGz9XrJiHOZlhw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWuJnC7jiNv++1D6rN000005VO9+94SQRgIX+HBbnYyi6VUxkNQZGBIIWA+k07T++ pTlw4IimeEtA7OOHaVshlGUkLDOuxBP5eoCEfX1YPZKAZQdKRa4rqbW0Bl/a+W/guw 7DYwCrWA2bdSZdhfNIgbAOscOlORVqPmRhLktaVvrPZyBMqtsjqT9Op3VlGLKx4rX1 ul3dAO4nf5nqyQwQBIAcKfr9bTXAoME8O/+CPZf9uM49zHEdfkjKsNtQuvOSEKRbfW vTQw5GQiUc3fcdhsVwb+rsgF1K+Wq0rdl3YucoyX2XEmYlHgbpJVO7HNJfQULSvjVv BVtAZQH6+8PVA== From: Masahiro Yamada To: Kees Cook , Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Alexandre Belloni , Benjamin Tissoires , Christian Borntraeger , Claudio Imbrenda , David Hildenbrand , Janosch Frank , Jiri Kosina , Shuah Khan , bpf@vger.kernel.org, kvm@vger.kernel.org, linux-input@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH 1/2] selftests: harness: remove unneeded __constructor_order_last() Date: Fri, 17 May 2024 20:45:05 +0900 Message-Id: <20240517114506.1259203-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240517114506.1259203-1-masahiroy@kernel.org> References: <20240517114506.1259203-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit __constructor_order_last() is unneeded. If __constructor_order_last() is not called on reverse-order systems, __constructor_order will remain 0 instead of being set to _CONSTRUCTOR_ORDER_BACKWARD (= -1). __LIST_APPEND() will still take the 'else' branch, so there is no difference in the behavior. Signed-off-by: Masahiro Yamada --- .../selftests/drivers/s390x/uvdevice/test_uvdevice.c | 6 ------ tools/testing/selftests/hid/hid_bpf.c | 6 ------ tools/testing/selftests/kselftest_harness.h | 10 +--------- tools/testing/selftests/rtc/rtctest.c | 7 ------- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c b/tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c index ea0cdc37b44f..7ee7492138c6 100644 --- a/tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c +++ b/tools/testing/selftests/drivers/s390x/uvdevice/test_uvdevice.c @@ -257,12 +257,6 @@ TEST_F(attest_fixture, att_inval_addr) att_inval_addr_test(&self->uvio_attest.meas_addr, _metadata, self); } -static void __attribute__((constructor)) __constructor_order_last(void) -{ - if (!__constructor_order) - __constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; -} - int main(int argc, char **argv) { int fd = open(UV_PATH, O_ACCMODE); diff --git a/tools/testing/selftests/hid/hid_bpf.c b/tools/testing/selftests/hid/hid_bpf.c index 2cf96f818f25..f47feef2aced 100644 --- a/tools/testing/selftests/hid/hid_bpf.c +++ b/tools/testing/selftests/hid/hid_bpf.c @@ -853,12 +853,6 @@ static int libbpf_print_fn(enum libbpf_print_level level, return 0; } -static void __attribute__((constructor)) __constructor_order_last(void) -{ - if (!__constructor_order) - __constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; -} - int main(int argc, char **argv) { /* Use libbpf 1.0 API mode */ diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index ba3ddeda24bf..60c1cf5b0f0d 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -444,12 +444,6 @@ * Use once to append a main() to the test file. */ #define TEST_HARNESS_MAIN \ - static void __attribute__((constructor)) \ - __constructor_order_last(void) \ - { \ - if (!__constructor_order) \ - __constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; \ - } \ int main(int argc, char **argv) { \ return test_harness_run(argc, argv); \ } @@ -846,7 +840,6 @@ static struct __fixture_metadata *__fixture_list = &_fixture_global; static int __constructor_order; #define _CONSTRUCTOR_ORDER_FORWARD 1 -#define _CONSTRUCTOR_ORDER_BACKWARD -1 static inline void __register_fixture(struct __fixture_metadata *f) { @@ -1272,8 +1265,7 @@ static int test_harness_run(int argc, char **argv) static void __attribute__((constructor)) __constructor_order_first(void) { - if (!__constructor_order) - __constructor_order = _CONSTRUCTOR_ORDER_FORWARD; + __constructor_order = _CONSTRUCTOR_ORDER_FORWARD; } #endif /* __KSELFTEST_HARNESS_H */ diff --git a/tools/testing/selftests/rtc/rtctest.c b/tools/testing/selftests/rtc/rtctest.c index 63ce02d1d5cc..9647b14b47c5 100644 --- a/tools/testing/selftests/rtc/rtctest.c +++ b/tools/testing/selftests/rtc/rtctest.c @@ -410,13 +410,6 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) { ASSERT_EQ(new, secs); } -static void __attribute__((constructor)) -__constructor_order_last(void) -{ - if (!__constructor_order) - __constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; -} - int main(int argc, char **argv) { switch (argc) { -- 2.40.1