linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com,
	brendanhiggins@google.com, broonie@kernel.org,
	davidgow@google.com, linux-mm@kvack.org,
	matti.vaittinen@fi.rohmeurope.com, mm-commits@vger.kernel.org,
	skhan@linuxfoundation.org, torvalds@linux-foundation.org,
	vitor@massaru.org
Subject: [patch 20/95] lib/bits_kunit: follow new file name convention for KUnit tests
Date: Tue, 15 Dec 2020 20:43:24 -0800	[thread overview]
Message-ID: <20201216044324.Xm_UvIHLC%akpm@linux-foundation.org> (raw)
In-Reply-To: <20201215204156.f05ec694b907845bcfab5c44@linux-foundation.org>

From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: lib/bits_kunit: follow new file name convention for KUnit tests

Follow new file name convention for the KUnit tests.  Since we have
lib/*test*.c in a few variations, use 'kunit' suffix to distinguish usual
test cases with KUnit-based ones.

Link: https://lkml.kernel.org/r/20201112180732.75589-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Brendan Higgins <brendanhiggins@google.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Vitor Massaru Iha <vitor@massaru.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/Makefile     |    2 
 lib/bits_kunit.c |   75 ++++
 lib/list-test.c  |  748 ---------------------------------------------
 lib/list_kunit.c |  748 +++++++++++++++++++++++++++++++++++++++++++++
 lib/test_bits.c  |   75 ----
 5 files changed, 824 insertions(+), 824 deletions(-)

--- /dev/null
+++ a/lib/bits_kunit.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test cases for functions and macros in bits.h
+ */
+
+#include <kunit/test.h>
+#include <linux/bits.h>
+
+
+static void genmask_test(struct kunit *test)
+{
+	KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0));
+	KUNIT_EXPECT_EQ(test, 3ul, GENMASK(1, 0));
+	KUNIT_EXPECT_EQ(test, 6ul, GENMASK(2, 1));
+	KUNIT_EXPECT_EQ(test, 0xFFFFFFFFul, GENMASK(31, 0));
+
+#ifdef TEST_GENMASK_FAILURES
+	/* these should fail compilation */
+	GENMASK(0, 1);
+	GENMASK(0, 10);
+	GENMASK(9, 10);
+#endif
+
+
+}
+
+static void genmask_ull_test(struct kunit *test)
+{
+	KUNIT_EXPECT_EQ(test, 1ull, GENMASK_ULL(0, 0));
+	KUNIT_EXPECT_EQ(test, 3ull, GENMASK_ULL(1, 0));
+	KUNIT_EXPECT_EQ(test, 0x000000ffffe00000ull, GENMASK_ULL(39, 21));
+	KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_ULL(63, 0));
+
+#ifdef TEST_GENMASK_FAILURES
+	/* these should fail compilation */
+	GENMASK_ULL(0, 1);
+	GENMASK_ULL(0, 10);
+	GENMASK_ULL(9, 10);
+#endif
+}
+
+static void genmask_input_check_test(struct kunit *test)
+{
+	unsigned int x, y;
+	int z, w;
+
+	/* Unknown input */
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(x, 0));
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(0, x));
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(x, y));
+
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(z, 0));
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(0, z));
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(z, w));
+
+	/* Valid input */
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(1, 1));
+	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(39, 21));
+}
+
+
+static struct kunit_case bits_test_cases[] = {
+	KUNIT_CASE(genmask_test),
+	KUNIT_CASE(genmask_ull_test),
+	KUNIT_CASE(genmask_input_check_test),
+	{}
+};
+
+static struct kunit_suite bits_test_suite = {
+	.name = "bits-test",
+	.test_cases = bits_test_cases,
+};
+kunit_test_suite(bits_test_suite);
+
+MODULE_LICENSE("GPL");
--- /dev/null
+++ a/lib/list_kunit.c
@@ -0,0 +1,748 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * KUnit test for the Kernel Linked-list structures.
+ *
+ * Copyright (C) 2019, Google LLC.
+ * Author: David Gow <davidgow@google.com>
+ */
+#include <kunit/test.h>
+
+#include <linux/list.h>
+
+struct list_test_struct {
+	int data;
+	struct list_head list;
+};
+
+static void list_test_list_init(struct kunit *test)
+{
+	/* Test the different ways of initialising a list. */
+	struct list_head list1 = LIST_HEAD_INIT(list1);
+	struct list_head list2;
+	LIST_HEAD(list3);
+	struct list_head *list4;
+	struct list_head *list5;
+
+	INIT_LIST_HEAD(&list2);
+
+	list4 = kzalloc(sizeof(*list4), GFP_KERNEL | __GFP_NOFAIL);
+	INIT_LIST_HEAD(list4);
+
+	list5 = kmalloc(sizeof(*list5), GFP_KERNEL | __GFP_NOFAIL);
+	memset(list5, 0xFF, sizeof(*list5));
+	INIT_LIST_HEAD(list5);
+
+	/* list_empty_careful() checks both next and prev. */
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list1));
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list3));
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(list4));
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(list5));
+
+	kfree(list4);
+	kfree(list5);
+}
+
+static void list_test_list_add(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add(&a, &list);
+	list_add(&b, &list);
+
+	/* should be [list] -> b -> a */
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
+	KUNIT_EXPECT_PTR_EQ(test, b.next, &a);
+}
+
+static void list_test_list_add_tail(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	/* should be [list] -> a -> b */
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &a);
+	KUNIT_EXPECT_PTR_EQ(test, a.prev, &list);
+	KUNIT_EXPECT_PTR_EQ(test, a.next, &b);
+}
+
+static void list_test_list_del(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a -> b */
+	list_del(&a);
+
+	/* now: [list] -> b */
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
+}
+
+static void list_test_list_replace(struct kunit *test)
+{
+	struct list_head a_old, a_new, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a_old, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a_old -> b */
+	list_replace(&a_old, &a_new);
+
+	/* now: [list] -> a_new -> b */
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new);
+}
+
+static void list_test_list_replace_init(struct kunit *test)
+{
+	struct list_head a_old, a_new, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a_old, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a_old -> b */
+	list_replace_init(&a_old, &a_new);
+
+	/* now: [list] -> a_new -> b */
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new);
+
+	/* check a_old is empty (initialized) */
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&a_old));
+}
+
+static void list_test_list_swap(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a -> b */
+	list_swap(&a, &b);
+
+	/* after: [list] -> b -> a */
+	KUNIT_EXPECT_PTR_EQ(test, &b, list.next);
+	KUNIT_EXPECT_PTR_EQ(test, &a, list.prev);
+
+	KUNIT_EXPECT_PTR_EQ(test, &a, b.next);
+	KUNIT_EXPECT_PTR_EQ(test, &list, b.prev);
+
+	KUNIT_EXPECT_PTR_EQ(test, &list, a.next);
+	KUNIT_EXPECT_PTR_EQ(test, &b, a.prev);
+}
+
+static void list_test_list_del_init(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a -> b */
+	list_del_init(&a);
+	/* after: [list] -> b, a initialised */
+
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&a));
+}
+
+static void list_test_list_move(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+
+	list_add_tail(&a, &list1);
+	list_add_tail(&b, &list2);
+
+	/* before: [list1] -> a, [list2] -> b */
+	list_move(&a, &list2);
+	/* after: [list1] empty, [list2] -> a -> b */
+
+	KUNIT_EXPECT_TRUE(test, list_empty(&list1));
+
+	KUNIT_EXPECT_PTR_EQ(test, &a, list2.next);
+	KUNIT_EXPECT_PTR_EQ(test, &b, a.next);
+}
+
+static void list_test_list_move_tail(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+
+	list_add_tail(&a, &list1);
+	list_add_tail(&b, &list2);
+
+	/* before: [list1] -> a, [list2] -> b */
+	list_move_tail(&a, &list2);
+	/* after: [list1] empty, [list2] -> b -> a */
+
+	KUNIT_EXPECT_TRUE(test, list_empty(&list1));
+
+	KUNIT_EXPECT_PTR_EQ(test, &b, list2.next);
+	KUNIT_EXPECT_PTR_EQ(test, &a, b.next);
+}
+
+static void list_test_list_bulk_move_tail(struct kunit *test)
+{
+	struct list_head a, b, c, d, x, y;
+	struct list_head *list1_values[] = { &x, &b, &c, &y };
+	struct list_head *list2_values[] = { &a, &d };
+	struct list_head *ptr;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&x, &list1);
+	list_add_tail(&y, &list1);
+
+	list_add_tail(&a, &list2);
+	list_add_tail(&b, &list2);
+	list_add_tail(&c, &list2);
+	list_add_tail(&d, &list2);
+
+	/* before: [list1] -> x -> y, [list2] -> a -> b -> c -> d */
+	list_bulk_move_tail(&y, &b, &c);
+	/* after: [list1] -> x -> b -> c -> y, [list2] -> a -> d */
+
+	list_for_each(ptr, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, ptr, list1_values[i]);
+		i++;
+	}
+	KUNIT_EXPECT_EQ(test, i, 4);
+	i = 0;
+	list_for_each(ptr, &list2) {
+		KUNIT_EXPECT_PTR_EQ(test, ptr, list2_values[i]);
+		i++;
+	}
+	KUNIT_EXPECT_EQ(test, i, 2);
+}
+
+static void list_test_list_is_first(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	KUNIT_EXPECT_TRUE(test, list_is_first(&a, &list));
+	KUNIT_EXPECT_FALSE(test, list_is_first(&b, &list));
+}
+
+static void list_test_list_is_last(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	KUNIT_EXPECT_FALSE(test, list_is_last(&a, &list));
+	KUNIT_EXPECT_TRUE(test, list_is_last(&b, &list));
+}
+
+static void list_test_list_empty(struct kunit *test)
+{
+	struct list_head a;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+
+	list_add_tail(&a, &list1);
+
+	KUNIT_EXPECT_FALSE(test, list_empty(&list1));
+	KUNIT_EXPECT_TRUE(test, list_empty(&list2));
+}
+
+static void list_test_list_empty_careful(struct kunit *test)
+{
+	/* This test doesn't check correctness under concurrent access */
+	struct list_head a;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+
+	list_add_tail(&a, &list1);
+
+	KUNIT_EXPECT_FALSE(test, list_empty_careful(&list1));
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
+}
+
+static void list_test_list_rotate_left(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+
+	/* before: [list] -> a -> b */
+	list_rotate_left(&list);
+	/* after: [list] -> b -> a */
+
+	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
+	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
+	KUNIT_EXPECT_PTR_EQ(test, b.next, &a);
+}
+
+static void list_test_list_rotate_to_front(struct kunit *test)
+{
+	struct list_head a, b, c, d;
+	struct list_head *list_values[] = { &c, &d, &a, &b };
+	struct list_head *ptr;
+	LIST_HEAD(list);
+	int i = 0;
+
+	list_add_tail(&a, &list);
+	list_add_tail(&b, &list);
+	list_add_tail(&c, &list);
+	list_add_tail(&d, &list);
+
+	/* before: [list] -> a -> b -> c -> d */
+	list_rotate_to_front(&c, &list);
+	/* after: [list] -> c -> d -> a -> b */
+
+	list_for_each(ptr, &list) {
+		KUNIT_EXPECT_PTR_EQ(test, ptr, list_values[i]);
+		i++;
+	}
+	KUNIT_EXPECT_EQ(test, i, 4);
+}
+
+static void list_test_list_is_singular(struct kunit *test)
+{
+	struct list_head a, b;
+	LIST_HEAD(list);
+
+	/* [list] empty */
+	KUNIT_EXPECT_FALSE(test, list_is_singular(&list));
+
+	list_add_tail(&a, &list);
+
+	/* [list] -> a */
+	KUNIT_EXPECT_TRUE(test, list_is_singular(&list));
+
+	list_add_tail(&b, &list);
+
+	/* [list] -> a -> b */
+	KUNIT_EXPECT_FALSE(test, list_is_singular(&list));
+}
+
+static void list_test_list_cut_position(struct kunit *test)
+{
+	struct list_head entries[3], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list1);
+
+	/* before: [list1] -> entries[0] -> entries[1] -> entries[2] */
+	list_cut_position(&list2, &list1, &entries[1]);
+	/* after: [list2] -> entries[0] -> entries[1], [list1] -> entries[2] */
+
+	list_for_each(cur, &list2) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 2);
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+}
+
+static void list_test_list_cut_before(struct kunit *test)
+{
+	struct list_head entries[3], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list1);
+
+	/* before: [list1] -> entries[0] -> entries[1] -> entries[2] */
+	list_cut_before(&list2, &list1, &entries[1]);
+	/* after: [list2] -> entries[0], [list1] -> entries[1] -> entries[2] */
+
+	list_for_each(cur, &list2) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 1);
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+}
+
+static void list_test_list_splice(struct kunit *test)
+{
+	struct list_head entries[5], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list2);
+	list_add_tail(&entries[3], &list2);
+	list_add_tail(&entries[4], &list1);
+
+	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
+	list_splice(&list2, &entries[1]);
+	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] uninit */
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 5);
+}
+
+static void list_test_list_splice_tail(struct kunit *test)
+{
+	struct list_head entries[5], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list2);
+	list_add_tail(&entries[3], &list2);
+	list_add_tail(&entries[4], &list1);
+
+	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
+	list_splice_tail(&list2, &entries[4]);
+	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] uninit */
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 5);
+}
+
+static void list_test_list_splice_init(struct kunit *test)
+{
+	struct list_head entries[5], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list2);
+	list_add_tail(&entries[3], &list2);
+	list_add_tail(&entries[4], &list1);
+
+	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
+	list_splice_init(&list2, &entries[1]);
+	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] empty */
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 5);
+
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
+}
+
+static void list_test_list_splice_tail_init(struct kunit *test)
+{
+	struct list_head entries[5], *cur;
+	LIST_HEAD(list1);
+	LIST_HEAD(list2);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list1);
+	list_add_tail(&entries[1], &list1);
+	list_add_tail(&entries[2], &list2);
+	list_add_tail(&entries[3], &list2);
+	list_add_tail(&entries[4], &list1);
+
+	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
+	list_splice_tail_init(&list2, &entries[4]);
+	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] empty */
+
+	list_for_each(cur, &list1) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 5);
+
+	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
+}
+
+static void list_test_list_entry(struct kunit *test)
+{
+	struct list_test_struct test_struct;
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct, list_entry(&(test_struct.list),
+				struct list_test_struct, list));
+}
+
+static void list_test_list_first_entry(struct kunit *test)
+{
+	struct list_test_struct test_struct1, test_struct2;
+	LIST_HEAD(list);
+
+	list_add_tail(&test_struct1.list, &list);
+	list_add_tail(&test_struct2.list, &list);
+
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_first_entry(&list,
+				struct list_test_struct, list));
+}
+
+static void list_test_list_last_entry(struct kunit *test)
+{
+	struct list_test_struct test_struct1, test_struct2;
+	LIST_HEAD(list);
+
+	list_add_tail(&test_struct1.list, &list);
+	list_add_tail(&test_struct2.list, &list);
+
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_last_entry(&list,
+				struct list_test_struct, list));
+}
+
+static void list_test_list_first_entry_or_null(struct kunit *test)
+{
+	struct list_test_struct test_struct1, test_struct2;
+	LIST_HEAD(list);
+
+	KUNIT_EXPECT_FALSE(test, list_first_entry_or_null(&list,
+				struct list_test_struct, list));
+
+	list_add_tail(&test_struct1.list, &list);
+	list_add_tail(&test_struct2.list, &list);
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct1,
+			list_first_entry_or_null(&list,
+				struct list_test_struct, list));
+}
+
+static void list_test_list_next_entry(struct kunit *test)
+{
+	struct list_test_struct test_struct1, test_struct2;
+	LIST_HEAD(list);
+
+	list_add_tail(&test_struct1.list, &list);
+	list_add_tail(&test_struct2.list, &list);
+
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_next_entry(&test_struct1,
+				list));
+}
+
+static void list_test_list_prev_entry(struct kunit *test)
+{
+	struct list_test_struct test_struct1, test_struct2;
+	LIST_HEAD(list);
+
+	list_add_tail(&test_struct1.list, &list);
+	list_add_tail(&test_struct2.list, &list);
+
+
+	KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_prev_entry(&test_struct2,
+				list));
+}
+
+static void list_test_list_for_each(struct kunit *test)
+{
+	struct list_head entries[3], *cur;
+	LIST_HEAD(list);
+	int i = 0;
+
+	list_add_tail(&entries[0], &list);
+	list_add_tail(&entries[1], &list);
+	list_add_tail(&entries[2], &list);
+
+	list_for_each(cur, &list) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 3);
+}
+
+static void list_test_list_for_each_prev(struct kunit *test)
+{
+	struct list_head entries[3], *cur;
+	LIST_HEAD(list);
+	int i = 2;
+
+	list_add_tail(&entries[0], &list);
+	list_add_tail(&entries[1], &list);
+	list_add_tail(&entries[2], &list);
+
+	list_for_each_prev(cur, &list) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		i--;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, -1);
+}
+
+static void list_test_list_for_each_safe(struct kunit *test)
+{
+	struct list_head entries[3], *cur, *n;
+	LIST_HEAD(list);
+	int i = 0;
+
+
+	list_add_tail(&entries[0], &list);
+	list_add_tail(&entries[1], &list);
+	list_add_tail(&entries[2], &list);
+
+	list_for_each_safe(cur, n, &list) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		list_del(&entries[i]);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 3);
+	KUNIT_EXPECT_TRUE(test, list_empty(&list));
+}
+
+static void list_test_list_for_each_prev_safe(struct kunit *test)
+{
+	struct list_head entries[3], *cur, *n;
+	LIST_HEAD(list);
+	int i = 2;
+
+	list_add_tail(&entries[0], &list);
+	list_add_tail(&entries[1], &list);
+	list_add_tail(&entries[2], &list);
+
+	list_for_each_prev_safe(cur, n, &list) {
+		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
+		list_del(&entries[i]);
+		i--;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, -1);
+	KUNIT_EXPECT_TRUE(test, list_empty(&list));
+}
+
+static void list_test_list_for_each_entry(struct kunit *test)
+{
+	struct list_test_struct entries[5], *cur;
+	LIST_HEAD(list);
+	int i = 0;
+
+	for (i = 0; i < 5; ++i) {
+		entries[i].data = i;
+		list_add_tail(&entries[i].list, &list);
+	}
+
+	i = 0;
+
+	list_for_each_entry(cur, &list, list) {
+		KUNIT_EXPECT_EQ(test, cur->data, i);
+		i++;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, 5);
+}
+
+static void list_test_list_for_each_entry_reverse(struct kunit *test)
+{
+	struct list_test_struct entries[5], *cur;
+	LIST_HEAD(list);
+	int i = 0;
+
+	for (i = 0; i < 5; ++i) {
+		entries[i].data = i;
+		list_add_tail(&entries[i].list, &list);
+	}
+
+	i = 4;
+
+	list_for_each_entry_reverse(cur, &list, list) {
+		KUNIT_EXPECT_EQ(test, cur->data, i);
+		i--;
+	}
+
+	KUNIT_EXPECT_EQ(test, i, -1);
+}
+
+static struct kunit_case list_test_cases[] = {
+	KUNIT_CASE(list_test_list_init),
+	KUNIT_CASE(list_test_list_add),
+	KUNIT_CASE(list_test_list_add_tail),
+	KUNIT_CASE(list_test_list_del),
+	KUNIT_CASE(list_test_list_replace),
+	KUNIT_CASE(list_test_list_replace_init),
+	KUNIT_CASE(list_test_list_swap),
+	KUNIT_CASE(list_test_list_del_init),
+	KUNIT_CASE(list_test_list_move),
+	KUNIT_CASE(list_test_list_move_tail),
+	KUNIT_CASE(list_test_list_bulk_move_tail),
+	KUNIT_CASE(list_test_list_is_first),
+	KUNIT_CASE(list_test_list_is_last),
+	KUNIT_CASE(list_test_list_empty),
+	KUNIT_CASE(list_test_list_empty_careful),
+	KUNIT_CASE(list_test_list_rotate_left),
+	KUNIT_CASE(list_test_list_rotate_to_front),
+	KUNIT_CASE(list_test_list_is_singular),
+	KUNIT_CASE(list_test_list_cut_position),
+	KUNIT_CASE(list_test_list_cut_before),
+	KUNIT_CASE(list_test_list_splice),
+	KUNIT_CASE(list_test_list_splice_tail),
+	KUNIT_CASE(list_test_list_splice_init),
+	KUNIT_CASE(list_test_list_splice_tail_init),
+	KUNIT_CASE(list_test_list_entry),
+	KUNIT_CASE(list_test_list_first_entry),
+	KUNIT_CASE(list_test_list_last_entry),
+	KUNIT_CASE(list_test_list_first_entry_or_null),
+	KUNIT_CASE(list_test_list_next_entry),
+	KUNIT_CASE(list_test_list_prev_entry),
+	KUNIT_CASE(list_test_list_for_each),
+	KUNIT_CASE(list_test_list_for_each_prev),
+	KUNIT_CASE(list_test_list_for_each_safe),
+	KUNIT_CASE(list_test_list_for_each_prev_safe),
+	KUNIT_CASE(list_test_list_for_each_entry),
+	KUNIT_CASE(list_test_list_for_each_entry_reverse),
+	{},
+};
+
+static struct kunit_suite list_test_module = {
+	.name = "list-kunit-test",
+	.test_cases = list_test_cases,
+};
+
+kunit_test_suites(&list_test_module);
+
+MODULE_LICENSE("GPL v2");
--- a/lib/list-test.c
+++ /dev/null
@@ -1,748 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * KUnit test for the Kernel Linked-list structures.
- *
- * Copyright (C) 2019, Google LLC.
- * Author: David Gow <davidgow@google.com>
- */
-#include <kunit/test.h>
-
-#include <linux/list.h>
-
-struct list_test_struct {
-	int data;
-	struct list_head list;
-};
-
-static void list_test_list_init(struct kunit *test)
-{
-	/* Test the different ways of initialising a list. */
-	struct list_head list1 = LIST_HEAD_INIT(list1);
-	struct list_head list2;
-	LIST_HEAD(list3);
-	struct list_head *list4;
-	struct list_head *list5;
-
-	INIT_LIST_HEAD(&list2);
-
-	list4 = kzalloc(sizeof(*list4), GFP_KERNEL | __GFP_NOFAIL);
-	INIT_LIST_HEAD(list4);
-
-	list5 = kmalloc(sizeof(*list5), GFP_KERNEL | __GFP_NOFAIL);
-	memset(list5, 0xFF, sizeof(*list5));
-	INIT_LIST_HEAD(list5);
-
-	/* list_empty_careful() checks both next and prev. */
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list1));
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list3));
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(list4));
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(list5));
-
-	kfree(list4);
-	kfree(list5);
-}
-
-static void list_test_list_add(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add(&a, &list);
-	list_add(&b, &list);
-
-	/* should be [list] -> b -> a */
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
-	KUNIT_EXPECT_PTR_EQ(test, b.next, &a);
-}
-
-static void list_test_list_add_tail(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	/* should be [list] -> a -> b */
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &a);
-	KUNIT_EXPECT_PTR_EQ(test, a.prev, &list);
-	KUNIT_EXPECT_PTR_EQ(test, a.next, &b);
-}
-
-static void list_test_list_del(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a -> b */
-	list_del(&a);
-
-	/* now: [list] -> b */
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
-}
-
-static void list_test_list_replace(struct kunit *test)
-{
-	struct list_head a_old, a_new, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a_old, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a_old -> b */
-	list_replace(&a_old, &a_new);
-
-	/* now: [list] -> a_new -> b */
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new);
-}
-
-static void list_test_list_replace_init(struct kunit *test)
-{
-	struct list_head a_old, a_new, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a_old, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a_old -> b */
-	list_replace_init(&a_old, &a_new);
-
-	/* now: [list] -> a_new -> b */
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new);
-
-	/* check a_old is empty (initialized) */
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&a_old));
-}
-
-static void list_test_list_swap(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a -> b */
-	list_swap(&a, &b);
-
-	/* after: [list] -> b -> a */
-	KUNIT_EXPECT_PTR_EQ(test, &b, list.next);
-	KUNIT_EXPECT_PTR_EQ(test, &a, list.prev);
-
-	KUNIT_EXPECT_PTR_EQ(test, &a, b.next);
-	KUNIT_EXPECT_PTR_EQ(test, &list, b.prev);
-
-	KUNIT_EXPECT_PTR_EQ(test, &list, a.next);
-	KUNIT_EXPECT_PTR_EQ(test, &b, a.prev);
-}
-
-static void list_test_list_del_init(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a -> b */
-	list_del_init(&a);
-	/* after: [list] -> b, a initialised */
-
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&a));
-}
-
-static void list_test_list_move(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-
-	list_add_tail(&a, &list1);
-	list_add_tail(&b, &list2);
-
-	/* before: [list1] -> a, [list2] -> b */
-	list_move(&a, &list2);
-	/* after: [list1] empty, [list2] -> a -> b */
-
-	KUNIT_EXPECT_TRUE(test, list_empty(&list1));
-
-	KUNIT_EXPECT_PTR_EQ(test, &a, list2.next);
-	KUNIT_EXPECT_PTR_EQ(test, &b, a.next);
-}
-
-static void list_test_list_move_tail(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-
-	list_add_tail(&a, &list1);
-	list_add_tail(&b, &list2);
-
-	/* before: [list1] -> a, [list2] -> b */
-	list_move_tail(&a, &list2);
-	/* after: [list1] empty, [list2] -> b -> a */
-
-	KUNIT_EXPECT_TRUE(test, list_empty(&list1));
-
-	KUNIT_EXPECT_PTR_EQ(test, &b, list2.next);
-	KUNIT_EXPECT_PTR_EQ(test, &a, b.next);
-}
-
-static void list_test_list_bulk_move_tail(struct kunit *test)
-{
-	struct list_head a, b, c, d, x, y;
-	struct list_head *list1_values[] = { &x, &b, &c, &y };
-	struct list_head *list2_values[] = { &a, &d };
-	struct list_head *ptr;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&x, &list1);
-	list_add_tail(&y, &list1);
-
-	list_add_tail(&a, &list2);
-	list_add_tail(&b, &list2);
-	list_add_tail(&c, &list2);
-	list_add_tail(&d, &list2);
-
-	/* before: [list1] -> x -> y, [list2] -> a -> b -> c -> d */
-	list_bulk_move_tail(&y, &b, &c);
-	/* after: [list1] -> x -> b -> c -> y, [list2] -> a -> d */
-
-	list_for_each(ptr, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, ptr, list1_values[i]);
-		i++;
-	}
-	KUNIT_EXPECT_EQ(test, i, 4);
-	i = 0;
-	list_for_each(ptr, &list2) {
-		KUNIT_EXPECT_PTR_EQ(test, ptr, list2_values[i]);
-		i++;
-	}
-	KUNIT_EXPECT_EQ(test, i, 2);
-}
-
-static void list_test_list_is_first(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	KUNIT_EXPECT_TRUE(test, list_is_first(&a, &list));
-	KUNIT_EXPECT_FALSE(test, list_is_first(&b, &list));
-}
-
-static void list_test_list_is_last(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	KUNIT_EXPECT_FALSE(test, list_is_last(&a, &list));
-	KUNIT_EXPECT_TRUE(test, list_is_last(&b, &list));
-}
-
-static void list_test_list_empty(struct kunit *test)
-{
-	struct list_head a;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-
-	list_add_tail(&a, &list1);
-
-	KUNIT_EXPECT_FALSE(test, list_empty(&list1));
-	KUNIT_EXPECT_TRUE(test, list_empty(&list2));
-}
-
-static void list_test_list_empty_careful(struct kunit *test)
-{
-	/* This test doesn't check correctness under concurrent access */
-	struct list_head a;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-
-	list_add_tail(&a, &list1);
-
-	KUNIT_EXPECT_FALSE(test, list_empty_careful(&list1));
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
-}
-
-static void list_test_list_rotate_left(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-
-	/* before: [list] -> a -> b */
-	list_rotate_left(&list);
-	/* after: [list] -> b -> a */
-
-	KUNIT_EXPECT_PTR_EQ(test, list.next, &b);
-	KUNIT_EXPECT_PTR_EQ(test, b.prev, &list);
-	KUNIT_EXPECT_PTR_EQ(test, b.next, &a);
-}
-
-static void list_test_list_rotate_to_front(struct kunit *test)
-{
-	struct list_head a, b, c, d;
-	struct list_head *list_values[] = { &c, &d, &a, &b };
-	struct list_head *ptr;
-	LIST_HEAD(list);
-	int i = 0;
-
-	list_add_tail(&a, &list);
-	list_add_tail(&b, &list);
-	list_add_tail(&c, &list);
-	list_add_tail(&d, &list);
-
-	/* before: [list] -> a -> b -> c -> d */
-	list_rotate_to_front(&c, &list);
-	/* after: [list] -> c -> d -> a -> b */
-
-	list_for_each(ptr, &list) {
-		KUNIT_EXPECT_PTR_EQ(test, ptr, list_values[i]);
-		i++;
-	}
-	KUNIT_EXPECT_EQ(test, i, 4);
-}
-
-static void list_test_list_is_singular(struct kunit *test)
-{
-	struct list_head a, b;
-	LIST_HEAD(list);
-
-	/* [list] empty */
-	KUNIT_EXPECT_FALSE(test, list_is_singular(&list));
-
-	list_add_tail(&a, &list);
-
-	/* [list] -> a */
-	KUNIT_EXPECT_TRUE(test, list_is_singular(&list));
-
-	list_add_tail(&b, &list);
-
-	/* [list] -> a -> b */
-	KUNIT_EXPECT_FALSE(test, list_is_singular(&list));
-}
-
-static void list_test_list_cut_position(struct kunit *test)
-{
-	struct list_head entries[3], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list1);
-
-	/* before: [list1] -> entries[0] -> entries[1] -> entries[2] */
-	list_cut_position(&list2, &list1, &entries[1]);
-	/* after: [list2] -> entries[0] -> entries[1], [list1] -> entries[2] */
-
-	list_for_each(cur, &list2) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 2);
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-}
-
-static void list_test_list_cut_before(struct kunit *test)
-{
-	struct list_head entries[3], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list1);
-
-	/* before: [list1] -> entries[0] -> entries[1] -> entries[2] */
-	list_cut_before(&list2, &list1, &entries[1]);
-	/* after: [list2] -> entries[0], [list1] -> entries[1] -> entries[2] */
-
-	list_for_each(cur, &list2) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 1);
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-}
-
-static void list_test_list_splice(struct kunit *test)
-{
-	struct list_head entries[5], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list2);
-	list_add_tail(&entries[3], &list2);
-	list_add_tail(&entries[4], &list1);
-
-	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
-	list_splice(&list2, &entries[1]);
-	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] uninit */
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 5);
-}
-
-static void list_test_list_splice_tail(struct kunit *test)
-{
-	struct list_head entries[5], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list2);
-	list_add_tail(&entries[3], &list2);
-	list_add_tail(&entries[4], &list1);
-
-	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
-	list_splice_tail(&list2, &entries[4]);
-	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] uninit */
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 5);
-}
-
-static void list_test_list_splice_init(struct kunit *test)
-{
-	struct list_head entries[5], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list2);
-	list_add_tail(&entries[3], &list2);
-	list_add_tail(&entries[4], &list1);
-
-	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
-	list_splice_init(&list2, &entries[1]);
-	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] empty */
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 5);
-
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
-}
-
-static void list_test_list_splice_tail_init(struct kunit *test)
-{
-	struct list_head entries[5], *cur;
-	LIST_HEAD(list1);
-	LIST_HEAD(list2);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list1);
-	list_add_tail(&entries[1], &list1);
-	list_add_tail(&entries[2], &list2);
-	list_add_tail(&entries[3], &list2);
-	list_add_tail(&entries[4], &list1);
-
-	/* before: [list1]->e[0]->e[1]->e[4], [list2]->e[2]->e[3] */
-	list_splice_tail_init(&list2, &entries[4]);
-	/* after: [list1]->e[0]->e[1]->e[2]->e[3]->e[4], [list2] empty */
-
-	list_for_each(cur, &list1) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 5);
-
-	KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2));
-}
-
-static void list_test_list_entry(struct kunit *test)
-{
-	struct list_test_struct test_struct;
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct, list_entry(&(test_struct.list),
-				struct list_test_struct, list));
-}
-
-static void list_test_list_first_entry(struct kunit *test)
-{
-	struct list_test_struct test_struct1, test_struct2;
-	LIST_HEAD(list);
-
-	list_add_tail(&test_struct1.list, &list);
-	list_add_tail(&test_struct2.list, &list);
-
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_first_entry(&list,
-				struct list_test_struct, list));
-}
-
-static void list_test_list_last_entry(struct kunit *test)
-{
-	struct list_test_struct test_struct1, test_struct2;
-	LIST_HEAD(list);
-
-	list_add_tail(&test_struct1.list, &list);
-	list_add_tail(&test_struct2.list, &list);
-
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_last_entry(&list,
-				struct list_test_struct, list));
-}
-
-static void list_test_list_first_entry_or_null(struct kunit *test)
-{
-	struct list_test_struct test_struct1, test_struct2;
-	LIST_HEAD(list);
-
-	KUNIT_EXPECT_FALSE(test, list_first_entry_or_null(&list,
-				struct list_test_struct, list));
-
-	list_add_tail(&test_struct1.list, &list);
-	list_add_tail(&test_struct2.list, &list);
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct1,
-			list_first_entry_or_null(&list,
-				struct list_test_struct, list));
-}
-
-static void list_test_list_next_entry(struct kunit *test)
-{
-	struct list_test_struct test_struct1, test_struct2;
-	LIST_HEAD(list);
-
-	list_add_tail(&test_struct1.list, &list);
-	list_add_tail(&test_struct2.list, &list);
-
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_next_entry(&test_struct1,
-				list));
-}
-
-static void list_test_list_prev_entry(struct kunit *test)
-{
-	struct list_test_struct test_struct1, test_struct2;
-	LIST_HEAD(list);
-
-	list_add_tail(&test_struct1.list, &list);
-	list_add_tail(&test_struct2.list, &list);
-
-
-	KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_prev_entry(&test_struct2,
-				list));
-}
-
-static void list_test_list_for_each(struct kunit *test)
-{
-	struct list_head entries[3], *cur;
-	LIST_HEAD(list);
-	int i = 0;
-
-	list_add_tail(&entries[0], &list);
-	list_add_tail(&entries[1], &list);
-	list_add_tail(&entries[2], &list);
-
-	list_for_each(cur, &list) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 3);
-}
-
-static void list_test_list_for_each_prev(struct kunit *test)
-{
-	struct list_head entries[3], *cur;
-	LIST_HEAD(list);
-	int i = 2;
-
-	list_add_tail(&entries[0], &list);
-	list_add_tail(&entries[1], &list);
-	list_add_tail(&entries[2], &list);
-
-	list_for_each_prev(cur, &list) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		i--;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, -1);
-}
-
-static void list_test_list_for_each_safe(struct kunit *test)
-{
-	struct list_head entries[3], *cur, *n;
-	LIST_HEAD(list);
-	int i = 0;
-
-
-	list_add_tail(&entries[0], &list);
-	list_add_tail(&entries[1], &list);
-	list_add_tail(&entries[2], &list);
-
-	list_for_each_safe(cur, n, &list) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		list_del(&entries[i]);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 3);
-	KUNIT_EXPECT_TRUE(test, list_empty(&list));
-}
-
-static void list_test_list_for_each_prev_safe(struct kunit *test)
-{
-	struct list_head entries[3], *cur, *n;
-	LIST_HEAD(list);
-	int i = 2;
-
-	list_add_tail(&entries[0], &list);
-	list_add_tail(&entries[1], &list);
-	list_add_tail(&entries[2], &list);
-
-	list_for_each_prev_safe(cur, n, &list) {
-		KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]);
-		list_del(&entries[i]);
-		i--;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, -1);
-	KUNIT_EXPECT_TRUE(test, list_empty(&list));
-}
-
-static void list_test_list_for_each_entry(struct kunit *test)
-{
-	struct list_test_struct entries[5], *cur;
-	LIST_HEAD(list);
-	int i = 0;
-
-	for (i = 0; i < 5; ++i) {
-		entries[i].data = i;
-		list_add_tail(&entries[i].list, &list);
-	}
-
-	i = 0;
-
-	list_for_each_entry(cur, &list, list) {
-		KUNIT_EXPECT_EQ(test, cur->data, i);
-		i++;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, 5);
-}
-
-static void list_test_list_for_each_entry_reverse(struct kunit *test)
-{
-	struct list_test_struct entries[5], *cur;
-	LIST_HEAD(list);
-	int i = 0;
-
-	for (i = 0; i < 5; ++i) {
-		entries[i].data = i;
-		list_add_tail(&entries[i].list, &list);
-	}
-
-	i = 4;
-
-	list_for_each_entry_reverse(cur, &list, list) {
-		KUNIT_EXPECT_EQ(test, cur->data, i);
-		i--;
-	}
-
-	KUNIT_EXPECT_EQ(test, i, -1);
-}
-
-static struct kunit_case list_test_cases[] = {
-	KUNIT_CASE(list_test_list_init),
-	KUNIT_CASE(list_test_list_add),
-	KUNIT_CASE(list_test_list_add_tail),
-	KUNIT_CASE(list_test_list_del),
-	KUNIT_CASE(list_test_list_replace),
-	KUNIT_CASE(list_test_list_replace_init),
-	KUNIT_CASE(list_test_list_swap),
-	KUNIT_CASE(list_test_list_del_init),
-	KUNIT_CASE(list_test_list_move),
-	KUNIT_CASE(list_test_list_move_tail),
-	KUNIT_CASE(list_test_list_bulk_move_tail),
-	KUNIT_CASE(list_test_list_is_first),
-	KUNIT_CASE(list_test_list_is_last),
-	KUNIT_CASE(list_test_list_empty),
-	KUNIT_CASE(list_test_list_empty_careful),
-	KUNIT_CASE(list_test_list_rotate_left),
-	KUNIT_CASE(list_test_list_rotate_to_front),
-	KUNIT_CASE(list_test_list_is_singular),
-	KUNIT_CASE(list_test_list_cut_position),
-	KUNIT_CASE(list_test_list_cut_before),
-	KUNIT_CASE(list_test_list_splice),
-	KUNIT_CASE(list_test_list_splice_tail),
-	KUNIT_CASE(list_test_list_splice_init),
-	KUNIT_CASE(list_test_list_splice_tail_init),
-	KUNIT_CASE(list_test_list_entry),
-	KUNIT_CASE(list_test_list_first_entry),
-	KUNIT_CASE(list_test_list_last_entry),
-	KUNIT_CASE(list_test_list_first_entry_or_null),
-	KUNIT_CASE(list_test_list_next_entry),
-	KUNIT_CASE(list_test_list_prev_entry),
-	KUNIT_CASE(list_test_list_for_each),
-	KUNIT_CASE(list_test_list_for_each_prev),
-	KUNIT_CASE(list_test_list_for_each_safe),
-	KUNIT_CASE(list_test_list_for_each_prev_safe),
-	KUNIT_CASE(list_test_list_for_each_entry),
-	KUNIT_CASE(list_test_list_for_each_entry_reverse),
-	{},
-};
-
-static struct kunit_suite list_test_module = {
-	.name = "list-kunit-test",
-	.test_cases = list_test_cases,
-};
-
-kunit_test_suites(&list_test_module);
-
-MODULE_LICENSE("GPL v2");
--- a/lib/Makefile~lib-bits_kunit-follow-new-file-name-convention-for-kunit-tests
+++ a/lib/Makefile
@@ -350,6 +350,6 @@ obj-$(CONFIG_PLDMFW) += pldmfw/
 
 # KUnit tests
 obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o
+obj-$(CONFIG_BITS_TEST) += bits_kunit.o
 obj-$(CONFIG_LINEAR_RANGES_TEST) += linear_ranges_kunit.o
 obj-$(CONFIG_LIST_KUNIT_TEST) += list_kunit.o
-obj-$(CONFIG_BITS_TEST) += test_bits.o
--- a/lib/test_bits.c
+++ /dev/null
@@ -1,75 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Test cases for functions and macros in bits.h
- */
-
-#include <kunit/test.h>
-#include <linux/bits.h>
-
-
-static void genmask_test(struct kunit *test)
-{
-	KUNIT_EXPECT_EQ(test, 1ul, GENMASK(0, 0));
-	KUNIT_EXPECT_EQ(test, 3ul, GENMASK(1, 0));
-	KUNIT_EXPECT_EQ(test, 6ul, GENMASK(2, 1));
-	KUNIT_EXPECT_EQ(test, 0xFFFFFFFFul, GENMASK(31, 0));
-
-#ifdef TEST_GENMASK_FAILURES
-	/* these should fail compilation */
-	GENMASK(0, 1);
-	GENMASK(0, 10);
-	GENMASK(9, 10);
-#endif
-
-
-}
-
-static void genmask_ull_test(struct kunit *test)
-{
-	KUNIT_EXPECT_EQ(test, 1ull, GENMASK_ULL(0, 0));
-	KUNIT_EXPECT_EQ(test, 3ull, GENMASK_ULL(1, 0));
-	KUNIT_EXPECT_EQ(test, 0x000000ffffe00000ull, GENMASK_ULL(39, 21));
-	KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_ULL(63, 0));
-
-#ifdef TEST_GENMASK_FAILURES
-	/* these should fail compilation */
-	GENMASK_ULL(0, 1);
-	GENMASK_ULL(0, 10);
-	GENMASK_ULL(9, 10);
-#endif
-}
-
-static void genmask_input_check_test(struct kunit *test)
-{
-	unsigned int x, y;
-	int z, w;
-
-	/* Unknown input */
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(x, 0));
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(0, x));
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(x, y));
-
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(z, 0));
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(0, z));
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(z, w));
-
-	/* Valid input */
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(1, 1));
-	KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(39, 21));
-}
-
-
-static struct kunit_case bits_test_cases[] = {
-	KUNIT_CASE(genmask_test),
-	KUNIT_CASE(genmask_ull_test),
-	KUNIT_CASE(genmask_input_check_test),
-	{}
-};
-
-static struct kunit_suite bits_test_suite = {
-	.name = "bits-test",
-	.test_cases = bits_test_cases,
-};
-kunit_test_suite(bits_test_suite);
-
-MODULE_LICENSE("GPL");
_


  parent reply	other threads:[~2020-12-16  4:43 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-16  4:41 incoming Andrew Morton
2020-12-16  4:42 ` [patch 01/95] mm: fix a race on nr_swap_pages Andrew Morton
2020-12-16  4:42 ` [patch 02/95] mm/memory_hotplug: quieting offline operation Andrew Morton
2020-12-16  4:42 ` [patch 03/95] alpha: replace bogus in_interrupt() Andrew Morton
2020-12-16  4:42 ` [patch 04/95] procfs: delete duplicated words + other fixes Andrew Morton
2020-12-16  4:42 ` [patch 05/95] proc: provide details on indirect branch speculation Andrew Morton
2020-12-16  4:42 ` [patch 06/95] proc: fix lookup in /proc/net subdirectories after setns(2) Andrew Morton
2020-12-16  4:42 ` [patch 07/95] fs/proc: make pde_get() return nothing Andrew Morton
2020-12-16  4:42 ` [patch 08/95] asm-generic: force inlining of get_order() to work around gcc10 poor decision Andrew Morton
2020-12-16  4:42 ` [patch 09/95] kernel.h: split out mathematical helpers Andrew Morton
2020-12-16  4:42 ` [patch 10/95] kernel/acct.c: use #elif instead of #end and #elif Andrew Morton
2020-12-16  4:42 ` [patch 11/95] include/linux/bitmap.h: convert bitmap_empty() / bitmap_full() to return boolean Andrew Morton
2020-12-16  4:42 ` [patch 12/95] bitmap: remove unused function declaration Andrew Morton
2020-12-16  4:43 ` [patch 13/95] lib/test_free_pages.c: add basic progress indicators Andrew Morton
2020-12-16  4:43 ` [patch 14/95] lib/stackdepot.c: replace one-element array with flexible-array member Andrew Morton
2020-12-16  4:43 ` [patch 15/95] lib/stackdepot.c: use flex_array_size() helper in memcpy() Andrew Morton
2020-12-16  4:43 ` [patch 16/95] lib/stackdepot.c: use array_size() helper in jhash2() Andrew Morton
2020-12-16  4:43 ` [patch 17/95] lib/test_lockup.c: minimum fix to get it compiled on PREEMPT_RT Andrew Morton
2020-12-16  4:43 ` [patch 18/95] lib/list_kunit: follow new file name convention for KUnit tests Andrew Morton
2020-12-16  6:02   ` Linus Torvalds
2020-12-16  6:53     ` David Gow
2020-12-16  7:01       ` Linus Torvalds
2020-12-16 10:41       ` Andy Shevchenko
2020-12-17  9:21         ` David Gow
2020-12-17 12:02           ` Andy Shevchenko
2020-12-16  4:43 ` [patch 19/95] lib/linear_ranges_kunit: " Andrew Morton
2020-12-16  4:43 ` Andrew Morton [this message]
2020-12-16  4:43 ` [patch 21/95] lib/cmdline: fix get_option() for strings starting with hyphen Andrew Morton
2020-12-16  4:43 ` [patch 22/95] lib/cmdline: allow NULL to be an output for get_option() Andrew Morton
2020-12-16  4:43 ` [patch 23/95] lib/cmdline_kunit: add a new test suite for cmdline API Andrew Morton
2020-12-16  4:43 ` [patch 24/95] ilog2: improve ilog2 for constant arguments Andrew Morton
2020-12-16  4:43 ` [patch 25/95] lib/string: remove unnecessary #undefs Andrew Morton
2020-12-16  4:43 ` [patch 26/95] lib: string.h: detect intra-object overflow in fortified string functions Andrew Morton
2020-12-16  4:43 ` [patch 27/95] lkdtm: tests for FORTIFY_SOURCE Andrew Morton
2020-12-16  4:43 ` [patch 28/95] string.h: add FORTIFY coverage for strscpy() Andrew Morton
2020-12-16  7:26   ` Linus Torvalds
2020-12-16  4:43 ` [patch 29/95] drivers/misc/lkdtm: add new file in LKDTM to test fortified strscpy Andrew Morton
2020-12-16  4:43 ` [patch 30/95] drivers/misc/lkdtm/lkdtm.h: correct wrong filenames in comment Andrew Morton
2020-12-16  4:44 ` [patch 31/95] lib: cleanup kstrto*() usage Andrew Morton
2020-12-16  4:44 ` [patch 32/95] lib/lz4: explicitly support in-place decompression Andrew Morton
2020-12-16  4:44 ` [patch 33/95] bitops: introduce the for_each_set_clump macro Andrew Morton
2020-12-16  6:14   ` Linus Torvalds
2020-12-16  4:44 ` [patch 34/95] lib/test_bitmap.c: add for_each_set_clump test cases Andrew Morton
2020-12-16  4:44 ` [patch 35/95] gpio: thunderx: utilize for_each_set_clump macro Andrew Morton
2020-12-16  4:44 ` [patch 36/95] gpio: xilinx: utilize generic bitmap_get_value and _set_value Andrew Morton
2020-12-16  4:44 ` [patch 37/95] checkpatch: add new exception to repeated word check Andrew Morton
2020-12-16  4:44 ` [patch 38/95] checkpatch: fix false positives in REPEATED_WORD warning Andrew Morton
2020-12-16  4:44 ` [patch 39/95] checkpatch: ignore generated CamelCase defines and enum values Andrew Morton
2020-12-16  4:44 ` [patch 40/95] checkpatch: prefer static const declarations Andrew Morton
2020-12-16  4:44 ` [patch 41/95] checkpatch: allow --fix removal of unnecessary break statements Andrew Morton
2020-12-16  4:44 ` [patch 42/95] checkpatch: extend attributes check to handle more patterns Andrew Morton
2020-12-16  4:44 ` [patch 43/95] checkpatch: add a fixer for missing newline at eof Andrew Morton
2020-12-16  4:44 ` [patch 44/95] checkpatch: update __attribute__((section("name"))) quote removal Andrew Morton
2020-12-16  4:44 ` [patch 45/95] checkpatch: add fix option for GERRIT_CHANGE_ID Andrew Morton
2020-12-16  4:44 ` [patch 46/95] checkpatch: add __alias and __weak to suggested __attribute__ conversions Andrew Morton
2020-12-16  4:44 ` [patch 47/95] checkpatch: improve email parsing Andrew Morton
2020-12-16  4:44 ` [patch 48/95] checkpatch: fix spelling errors and remove repeated word Andrew Morton
2020-12-16  4:44 ` [patch 49/95] checkpatch: avoid COMMIT_LOG_LONG_LINE warning for signature tags Andrew Morton
2020-12-16  4:45 ` [patch 50/95] checkpatch: fix unescaped left brace Andrew Morton
2020-12-16  4:45 ` [patch 51/95] checkpatch: add fix option for ASSIGNMENT_CONTINUATIONS Andrew Morton
2020-12-16  4:45 ` [patch 52/95] checkpatch: add fix option for LOGICAL_CONTINUATIONS Andrew Morton
2020-12-16  4:45 ` [patch 53/95] checkpatch: add fix and improve warning msg for non-standard signature Andrew Morton
2020-12-16  4:45 ` [patch 54/95] checkpatch: add warning for unnecessary use of %h[xudi] and %hh[xudi] Andrew Morton
2020-12-16  4:45 ` [patch 55/95] checkpatch: add warning for lines starting with a '#' in commit log Andrew Morton
2020-12-16  4:45 ` [patch 56/95] checkpatch: fix TYPO_SPELLING check for words with apostrophe Andrew Morton
2020-12-16  4:45 ` [patch 57/95] checkpatch: add printk_once and printk_ratelimit to prefer pr_<level> warning Andrew Morton
2020-12-16  4:45 ` [patch 58/95] fs/nilfs2: remove some unused macros to tame gcc Andrew Morton
2020-12-16  4:45 ` [patch 59/95] kdump: append uts_namespace.name offset to VMCOREINFO Andrew Morton
2020-12-16  4:45 ` [patch 60/95] rapidio: remove unused rio_get_asm() and rio_get_device() Andrew Morton
2020-12-16  4:45 ` [patch 61/95] gcov: remove support for GCC < 4.9 Andrew Morton
2020-12-16  4:45 ` [patch 62/95] gcov: fix kernel-doc markup issue Andrew Morton
2020-12-16  4:45 ` [patch 63/95] bfs: don't use WARNING: string when it's just info Andrew Morton
2020-12-16  4:45 ` [patch 64/95] relay: remove unused buf_mapped and buf_unmapped callbacks Andrew Morton
2020-12-16  4:45 ` [patch 65/95] relay: require non-NULL callbacks in relay_open() Andrew Morton
2020-12-16  4:45 ` [patch 66/95] relay: make create_buf_file and remove_buf_file callbacks mandatory Andrew Morton
2020-12-16  4:45 ` [patch 67/95] relay: allow the use of const callback structs Andrew Morton
2020-12-16  4:46 ` [patch 68/95] drm/i915: make relay callbacks const Andrew Morton
2020-12-16  4:46 ` [patch 69/95] ath10k: " Andrew Morton
2020-12-16  4:46 ` [patch 70/95] ath11k: " Andrew Morton
2020-12-16  4:46 ` [patch 71/95] ath9k: " Andrew Morton
2020-12-16  4:46 ` [patch 72/95] blktrace: " Andrew Morton
2020-12-16  4:46 ` [patch 73/95] kernel/resource.c: fix kernel-doc markups Andrew Morton
2020-12-16  4:46 ` [patch 74/95] ubsan: remove redundant -Wno-maybe-uninitialized Andrew Morton
2020-12-16  4:46 ` [patch 75/95] ubsan: move cc-option tests into Kconfig Andrew Morton
2020-12-16  4:46 ` [patch 76/95] ubsan: disable object-size sanitizer under GCC Andrew Morton
2020-12-16  4:46 ` [patch 77/95] ubsan: disable UBSAN_TRAP for all*config Andrew Morton
2020-12-16  4:46 ` [patch 78/95] ubsan: enable for all*config builds Andrew Morton
2020-12-16  4:46 ` [patch 79/95] ubsan: remove UBSAN_MISC in favor of individual options Andrew Morton
2020-12-16  4:46 ` [patch 80/95] ubsan: expand tests and reporting Andrew Morton
2020-12-16  4:46 ` [patch 81/95] kcov: don't instrument with UBSAN Andrew Morton
2020-12-16  4:46 ` [patch 82/95] lib/ubsan.c: mark type_check_kinds with static keyword Andrew Morton
2020-12-16  4:46 ` [patch 83/95] reboot: refactor and comment the cpu selection code Andrew Morton
2020-12-16  4:46 ` [patch 84/95] reboot: allow to specify reboot mode via sysfs Andrew Morton
2020-12-16  4:47 ` [patch 85/95] reboot: remove cf9_safe from allowed types and rename cf9_force Andrew Morton
2020-12-16  4:47 ` [patch 86/95] reboot: allow to override reboot type if quirks are found Andrew Morton
2020-12-16  4:47 ` [patch 87/95] reboot: hide from sysfs not applicable settings Andrew Morton
2020-12-16  4:47 ` [patch 88/95] fault-injection: handle EI_ETYPE_TRUE Andrew Morton
2020-12-16  4:47 ` [patch 89/95] lib/lzo/lzo1x_compress.c: make lzogeneric1x_1_compress() static Andrew Morton
2020-12-16  4:47 ` [patch 90/95] apparmor: remove duplicate macro list_entry_is_head() Andrew Morton
2020-12-16  4:47 ` [patch 91/95] mm: unexport follow_pte_pmd Andrew Morton
2020-12-16  4:47 ` [patch 92/95] mm: simplify follow_pte{,pmd} Andrew Morton
2020-12-16  4:47 ` [patch 93/95] mm: fix some spelling mistakes in comments Andrew Morton
2020-12-16  4:47 ` [patch 94/95] mmap locking API: don't check locking if the mm isn't live yet Andrew Morton
2020-12-16  5:07   ` Jann Horn
2020-12-16 18:08     ` Jason Gunthorpe
2020-12-16  4:47 ` [patch 95/95] mm/gup: assert that the mmap lock is held in __get_user_pages() Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201216044324.Xm_UvIHLC%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brendanhiggins@google.com \
    --cc=broonie@kernel.org \
    --cc=davidgow@google.com \
    --cc=linux-mm@kvack.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=torvalds@linux-foundation.org \
    --cc=vitor@massaru.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).