mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00

Clean up the existing export namespace code along the same lines of
commit 33def8498f
("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
111 lines
2.6 KiB
C
111 lines
2.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* KUnit tests for channel helper functions
|
|
*
|
|
* Copyright (C) 2024 Intel Corporation
|
|
*/
|
|
#include <net/mac80211.h>
|
|
#include "../mvm.h"
|
|
#include <kunit/test.h>
|
|
|
|
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
|
|
|
|
static const struct acs_average_db_case {
|
|
const char *desc;
|
|
u8 neg_dbm[22];
|
|
s8 result;
|
|
} acs_average_db_cases[] = {
|
|
{
|
|
.desc = "Smallest possible value, all filled",
|
|
.neg_dbm = {
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128
|
|
},
|
|
.result = -128,
|
|
},
|
|
{
|
|
.desc = "Biggest possible value, all filled",
|
|
.neg_dbm = {
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0, 0,
|
|
},
|
|
.result = 0,
|
|
},
|
|
{
|
|
.desc = "Smallest possible value, partial filled",
|
|
.neg_dbm = {
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
0xff, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff,
|
|
},
|
|
.result = -128,
|
|
},
|
|
{
|
|
.desc = "Biggest possible value, partial filled",
|
|
.neg_dbm = {
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
0xff, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff, 0xff, 0xff, 0xff,
|
|
0xff, 0xff,
|
|
},
|
|
.result = 0,
|
|
},
|
|
{
|
|
.desc = "Adding -80dBm to -75dBm until it is still rounded to -79dBm",
|
|
.neg_dbm = {
|
|
75, 80, 80, 80, 80, 80, 80, 80, 80, 80,
|
|
80, 80, 80, 80, 80, 80, 80, 0xff, 0xff, 0xff,
|
|
0xff, 0xff,
|
|
},
|
|
.result = -79,
|
|
},
|
|
{
|
|
.desc = "Adding -80dBm to -75dBm until it is just rounded to -80dBm",
|
|
.neg_dbm = {
|
|
75, 80, 80, 80, 80, 80, 80, 80, 80, 80,
|
|
80, 80, 80, 80, 80, 80, 80, 80, 0xff, 0xff,
|
|
0xff, 0xff,
|
|
},
|
|
.result = -80,
|
|
},
|
|
};
|
|
|
|
KUNIT_ARRAY_PARAM_DESC(acs_average_db, acs_average_db_cases, desc)
|
|
|
|
static void test_acs_average_db(struct kunit *test)
|
|
{
|
|
const struct acs_average_db_case *params = test->param_value;
|
|
struct iwl_umac_scan_channel_survey_notif notif;
|
|
int i;
|
|
|
|
/* Test the values in the given order */
|
|
for (i = 0; i < ARRAY_SIZE(params->neg_dbm); i++)
|
|
notif.noise[i] = params->neg_dbm[i];
|
|
KUNIT_ASSERT_EQ(test,
|
|
iwl_mvm_average_dbm_values(¬if),
|
|
params->result);
|
|
|
|
/* Test in reverse order */
|
|
for (i = 0; i < ARRAY_SIZE(params->neg_dbm); i++)
|
|
notif.noise[ARRAY_SIZE(params->neg_dbm) - i - 1] =
|
|
params->neg_dbm[i];
|
|
KUNIT_ASSERT_EQ(test,
|
|
iwl_mvm_average_dbm_values(¬if),
|
|
params->result);
|
|
}
|
|
|
|
static struct kunit_case acs_average_db_case[] = {
|
|
KUNIT_CASE_PARAM(test_acs_average_db, acs_average_db_gen_params),
|
|
{}
|
|
};
|
|
|
|
static struct kunit_suite acs_average_db = {
|
|
.name = "iwlmvm-acs-average-db",
|
|
.test_cases = acs_average_db_case,
|
|
};
|
|
|
|
kunit_test_suite(acs_average_db);
|