From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
linux-kernel@vger.kernel.org
Subject: [PATCH 07/19] lib/list_sort.c: Rearrange includes
Date: Wed, 31 Dec 2014 02:21:42 +0100 [thread overview]
Message-ID: <1419988915-20730-8-git-send-email-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <1419988915-20730-1-git-send-email-linux@rasmusvillemoes.dk>
Memory allocation only happens in the self test, just as random
numbers are only used there. So move the inclusion of slab.h inside
the CONFIG_TEST_LIST_SORT.
We don't need module.h and all of the stuff it carries with it, so
replace with export.h and compiler.h. Unfortunately, the ARRAY_SIZE
macro from kernel.h requires the user to ensure bug.h is also included
(for BUILD_BUG_ON_ZERO, used by __must_be_array). We used to get that
through some maze of nested includes, but just include it explicitly.
linux/string.h is then only included implicitly through
kernel.h->printk.h->dynamic_debug.h, but only if
!CONFIG_DYNAMIC_DEBUG, so just include it explicitly (for memset).
objdump -d says the generated code is the same, and wc -l says that
lib/.list_sort.o.cmd went from 579 to 165 lines.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/list_sort.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/list_sort.c b/lib/list_sort.c
index 12bcba1c8612..b29015102698 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -2,9 +2,11 @@
#define pr_fmt(fmt) "list_sort_test: " fmt
#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/bug.h>
+#include <linux/compiler.h>
+#include <linux/export.h>
+#include <linux/string.h>
#include <linux/list_sort.h>
-#include <linux/slab.h>
#include <linux/list.h>
#define MAX_LIST_LENGTH_BITS 20
@@ -146,6 +148,7 @@ EXPORT_SYMBOL(list_sort);
#ifdef CONFIG_TEST_LIST_SORT
+#include <linux/slab.h>
#include <linux/random.h>
/*
--
2.1.3
next prev parent reply other threads:[~2014-12-31 1:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 01/19] lib/interval_tree.c: Simplify includes Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 02/19] lib/sort.c: Use simpler includes Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 03/19] lib/dynamic_queue_limits.c: Simplify includes Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 04/19] lib/halfmd4.c: " Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 05/19] lib/idr.c: Remove redundant include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 06/19] lib/genalloc.c: " Rasmus Villemoes
2014-12-31 1:21 ` Rasmus Villemoes [this message]
2014-12-31 1:21 ` [PATCH 08/19] lib/md5.c: Simplify include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 09/19] lib/llist.c: Remove redundant include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 10/19] lib/kobject_uevent.c: " Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 11/19] lib/nlattr.c: " Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 12/19] lib/plist.c: " Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 13/19] lib/radix-tree.c: Change to simpler include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 14/19] lib/show_mem.c: Remove redundant include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 15/19] lib/sort.c: Move include inside #if 0 Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 16/19] lib/stmp_device.c: Replace module.h include Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 17/19] lib/strncpy_from_user.c: " Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 18/19] lib/percpu_ida.c: Remove redundant includes Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 19/19] lib/lcm.c: Replace include Rasmus Villemoes
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=1419988915-20730-8-git-send-email-linux@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®