* [PATCH 01/19] lib/interval_tree.c: Simplify includes
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 02/19] lib/sort.c: Use simpler includes Rasmus Villemoes
` (17 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
The file uses nothing from init.h, and also doesn't need the full
module.h machinery; export.h is sufficient. The latter requires the
user to ensure compiler.h is included, so do that explicitly instead
of relying on some other header pulling it in.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/interval_tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/interval_tree.c b/lib/interval_tree.c
index f367f9ad544c..c85f6600a5f8 100644
--- a/lib/interval_tree.c
+++ b/lib/interval_tree.c
@@ -1,7 +1,7 @@
-#include <linux/init.h>
#include <linux/interval_tree.h>
#include <linux/interval_tree_generic.h>
-#include <linux/module.h>
+#include <linux/compiler.h>
+#include <linux/export.h>
#define START(node) ((node)->start)
#define LAST(node) ((node)->last)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 02/19] lib/sort.c: Use simpler includes
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 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 03/19] lib/dynamic_queue_limits.c: Simplify includes Rasmus Villemoes
` (16 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
sort.c doesn't use facilities from kernel.h, but does use some types
defined in linux/types.h. Include the latter directly instead of
relying on some other header doing it. Similarly, include
linux/export.h directly instead of through module.h. This removes 80
lines from the dependency file .sort.o.cmd.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/sort.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sort.c b/lib/sort.c
index 926d00429ed2..14fc1dfadb3f 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -4,8 +4,8 @@
* Jan 23 2005 Matt Mackall <mpm@selenic.com>
*/
-#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/export.h>
#include <linux/sort.h>
#include <linux/slab.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 03/19] lib/dynamic_queue_limits.c: Simplify includes
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 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 04/19] lib/halfmd4.c: " Rasmus Villemoes
` (15 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
The file doesn't use anything from ctype.h. Instead of module.h, just
use export.h for EXPORT_SYMBOL. The latter requires the user to
include compiler.h, so do that explicitly instead of relying on some
other header pulling it in.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/dynamic_queue_limits.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/dynamic_queue_limits.c b/lib/dynamic_queue_limits.c
index 0777c5a45fa0..f346715e2255 100644
--- a/lib/dynamic_queue_limits.c
+++ b/lib/dynamic_queue_limits.c
@@ -3,12 +3,12 @@
*
* Copyright (c) 2011, Tom Herbert <therbert@google.com>
*/
-#include <linux/module.h>
#include <linux/types.h>
-#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/dynamic_queue_limits.h>
+#include <linux/compiler.h>
+#include <linux/export.h>
#define POSDIFF(A, B) ((int)((A) - (B)) > 0 ? (A) - (B) : 0)
#define AFTER_EQ(A, B) ((int)((A) - (B)) >= 0)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 04/19] lib/halfmd4.c: Simplify includes
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (2 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 03/19] lib/dynamic_queue_limits.c: Simplify includes Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 05/19] lib/idr.c: Remove redundant include Rasmus Villemoes
` (14 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
We only need EXPORT_SYMBOL, so compiler.h and export.h suffice. This
means linux/types.h is no longer implicitly included, so add an
include of uapi/linux/types.h to linux/cryptohash.h for __u32. Other
users of cryptohash.h cannot be affected, since they must already have
been including uapi/linux/types.h in order for gcc not to complain
about unknown types.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
include/linux/cryptohash.h | 2 ++
lib/halfmd4.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h
index 2cd9f1cf9fa3..f4754282c9c2 100644
--- a/include/linux/cryptohash.h
+++ b/include/linux/cryptohash.h
@@ -1,6 +1,8 @@
#ifndef __CRYPTOHASH_H
#define __CRYPTOHASH_H
+#include <uapi/linux/types.h>
+
#define SHA_DIGEST_WORDS 5
#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)
#define SHA_WORKSPACE_WORDS 16
diff --git a/lib/halfmd4.c b/lib/halfmd4.c
index 66d0ee8b7776..a8fe6274a13c 100644
--- a/lib/halfmd4.c
+++ b/lib/halfmd4.c
@@ -1,4 +1,4 @@
-#include <linux/kernel.h>
+#include <linux/compiler.h>
#include <linux/export.h>
#include <linux/cryptohash.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 05/19] lib/idr.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (3 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 04/19] lib/halfmd4.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 06/19] lib/genalloc.c: " Rasmus Villemoes
` (13 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
idr.c doesn't seem to use anything from hardirq.h (or anything
included from that). Removing it produces identical objdump -d output,
and gives 44 fewer lines in the .idr.o.cmd dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/idr.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/idr.c b/lib/idr.c
index e654aebd5f80..5335c43adf46 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -30,7 +30,6 @@
#include <linux/idr.h>
#include <linux/spinlock.h>
#include <linux/percpu.h>
-#include <linux/hardirq.h>
#define MAX_IDR_SHIFT (sizeof(int) * 8 - 1)
#define MAX_IDR_BIT (1U << MAX_IDR_SHIFT)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 06/19] lib/genalloc.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (4 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 05/19] lib/idr.c: Remove redundant include Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 07/19] lib/list_sort.c: Rearrange includes Rasmus Villemoes
` (12 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
Removing this include produces byte-identical output, and thus removes
a false dependency.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/genalloc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 2e65d206b01c..17d8f58f6716 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -34,7 +34,6 @@
#include <linux/rculist.h>
#include <linux/interrupt.h>
#include <linux/genalloc.h>
-#include <linux/of_address.h>
#include <linux/of_device.h>
static inline size_t chunk_size(const struct gen_pool_chunk *chunk)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 07/19] lib/list_sort.c: Rearrange includes
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (5 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 06/19] lib/genalloc.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 08/19] lib/md5.c: Simplify include Rasmus Villemoes
` (11 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
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
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 08/19] lib/md5.c: Simplify include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (6 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 07/19] lib/list_sort.c: Rearrange includes Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 09/19] lib/llist.c: Remove redundant include Rasmus Villemoes
` (10 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
md5.c doesn't use anything from kernel.h, except that that pulls in
compiler.h, which is needed for the export.h to work.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/md5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/md5.c b/lib/md5.c
index 958a3c15923c..bb0cd01d356d 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,4 +1,4 @@
-#include <linux/kernel.h>
+#include <linux/compiler.h>
#include <linux/export.h>
#include <linux/cryptohash.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 09/19] lib/llist.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (7 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 08/19] lib/md5.c: Simplify include Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 10/19] lib/kobject_uevent.c: " Rasmus Villemoes
` (9 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
This file doesn't seem to use anything provided by linux/interrupt.h
or anything recursively included through that. Removing it produces
byte-identical output, while reducing .llist.o.cmd from 541 to 156
lines.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/llist.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/llist.c b/lib/llist.c
index f76196d07409..0b0e9779d675 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -24,7 +24,6 @@
*/
#include <linux/kernel.h>
#include <linux/export.h>
-#include <linux/interrupt.h>
#include <linux/llist.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 10/19] lib/kobject_uevent.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (8 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 09/19] lib/llist.c: Remove redundant include Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 11/19] lib/nlattr.c: " Rasmus Villemoes
` (8 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
The file doesn't seem to use anything from linux/user_namespace.h, and
removing it yields byte-identical object code and strictly fewer
dependencies in the .cmd file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/kobject_uevent.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 9ebf9e20de53..f6c2c1e7779c 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -20,7 +20,6 @@
#include <linux/export.h>
#include <linux/kmod.h>
#include <linux/slab.h>
-#include <linux/user_namespace.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
#include <linux/netlink.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 11/19] lib/nlattr.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (9 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 10/19] lib/kobject_uevent.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 12/19] lib/plist.c: " Rasmus Villemoes
` (7 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
nlattr.c doesn't seem to rely on anything from netdevice.h. Removing
it yields identical objdump -d output for each of {allyes,allno,def}config,
and eliminates more than 200 lines from the generated dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/nlattr.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/nlattr.c b/lib/nlattr.c
index 9c3e85ff0a6c..76a1b59523ab 100644
--- a/lib/nlattr.c
+++ b/lib/nlattr.c
@@ -9,7 +9,6 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/jiffies.h>
-#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/string.h>
#include <linux/types.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 12/19] lib/plist.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (10 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 11/19] lib/nlattr.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 13/19] lib/radix-tree.c: Change to simpler include Rasmus Villemoes
` (6 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
Removing the include of linux/spinlock.h produces byte-identical
output for {allno,def}config, and identical objdump -d output for
allyesconfig. In the former two cases, more than a 100 lines are
eliminated from the generated dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/plist.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/plist.c b/lib/plist.c
index d408e774b746..3a30c53db061 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -25,7 +25,6 @@
#include <linux/bug.h>
#include <linux/plist.h>
-#include <linux/spinlock.h>
#ifdef CONFIG_DEBUG_PI_LIST
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 13/19] lib/radix-tree.c: Change to simpler include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (11 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 12/19] lib/plist.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 14/19] lib/show_mem.c: Remove redundant include Rasmus Villemoes
` (5 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
The comment helpfully explains why hardirq.h is included, but since
2d4b84739f0a ("hardirq: Split preempt count mask definitions")
in_interrupt() has been provided by preempt_mask.h. Use that instead,
saving around 40 lines in the generated dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/radix-tree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index 3291a8e37490..3d2aa27b845b 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -33,7 +33,7 @@
#include <linux/string.h>
#include <linux/bitops.h>
#include <linux/rcupdate.h>
-#include <linux/hardirq.h> /* in_interrupt() */
+#include <linux/preempt_mask.h> /* in_interrupt() */
/*
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 14/19] lib/show_mem.c: Remove redundant include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (12 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 13/19] lib/radix-tree.c: Change to simpler include Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 15/19] lib/sort.c: Move include inside #if 0 Rasmus Villemoes
` (4 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
show_mem.c doesn't use anything from nmi.h. Removing it yields
identical objdump -d output for each of {allyes,allno,def}config and
eliminates more than 100 lines in the dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/show_mem.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/show_mem.c b/lib/show_mem.c
index 7de89f4a36cf..adc98e1825ba 100644
--- a/lib/show_mem.c
+++ b/lib/show_mem.c
@@ -6,7 +6,6 @@
*/
#include <linux/mm.h>
-#include <linux/nmi.h>
#include <linux/quicklist.h>
#include <linux/cma.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 15/19] lib/sort.c: Move include inside #if 0
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (13 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 14/19] lib/show_mem.c: Remove redundant include Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 16/19] lib/stmp_device.c: Replace module.h include Rasmus Villemoes
` (3 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
The sort function and its helpers don't do memory allocation, so the
slab.h include is redundant. Move it inside the #if 0 protecting the
self-test, similar to how it is done in lib/list_sort.c. This removes
over 450 lines from the generated dependency file.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sort.c b/lib/sort.c
index 14fc1dfadb3f..43c9fe73ae2e 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -7,7 +7,6 @@
#include <linux/types.h>
#include <linux/export.h>
#include <linux/sort.h>
-#include <linux/slab.h>
static void u32_swap(void *a, void *b, int size)
{
@@ -85,6 +84,7 @@ void sort(void *base, size_t num, size_t size,
EXPORT_SYMBOL(sort);
#if 0
+#include <linux/slab.h>
/* a simple boot-time regression test */
int cmpint(const void *a, const void *b)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 16/19] lib/stmp_device.c: Replace module.h include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (14 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 15/19] lib/sort.c: Move include inside #if 0 Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 17/19] lib/strncpy_from_user.c: " Rasmus Villemoes
` (2 subsequent siblings)
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
stmp_device.c only needs EXPORT_SYMBOL, so just include compiler.h and
export.h instead of the whole module.h machinery.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/stmp_device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/stmp_device.c b/lib/stmp_device.c
index 8ac9bcc4289a..a904656f4fd7 100644
--- a/lib/stmp_device.c
+++ b/lib/stmp_device.c
@@ -15,7 +15,8 @@
#include <linux/io.h>
#include <linux/errno.h>
#include <linux/delay.h>
-#include <linux/module.h>
+#include <linux/compiler.h>
+#include <linux/export.h>
#include <linux/stmp_device.h>
#define STMP_MODULE_CLKGATE (1 << 30)
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 17/19] lib/strncpy_from_user.c: Replace module.h include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (15 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 16/19] lib/stmp_device.c: Replace module.h include Rasmus Villemoes
@ 2014-12-31 1:21 ` 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
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
strncpy_from_user.c only needs EXPORT_SYMBOL, so just include
compiler.h and export.h instead of the whole module.h machinery.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/strncpy_from_user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c
index bb2b201d6ad0..e0af6ff73d14 100644
--- a/lib/strncpy_from_user.c
+++ b/lib/strncpy_from_user.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/compiler.h>
+#include <linux/export.h>
#include <linux/uaccess.h>
#include <linux/kernel.h>
#include <linux/errno.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 18/19] lib/percpu_ida.c: Remove redundant includes
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (16 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 17/19] lib/strncpy_from_user.c: " Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
2014-12-31 1:21 ` [PATCH 19/19] lib/lcm.c: Replace include Rasmus Villemoes
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
These three #includes seem to be completely redundant: Removing them
yields identical objdump -d output for each of
{allyes,allno,def}config, and neither included file end up in the
generated dependency file through some recursive include. In total,
about 50 lines are eliminated from .percpu.o.cmd.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/percpu_ida.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index 93d145e5539c..f75715131f20 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -19,13 +19,10 @@
#include <linux/bug.h>
#include <linux/err.h>
#include <linux/export.h>
-#include <linux/hardirq.h>
-#include <linux/idr.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/percpu.h>
#include <linux/sched.h>
-#include <linux/slab.h>
#include <linux/string.h>
#include <linux/spinlock.h>
#include <linux/percpu_ida.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread* [PATCH 19/19] lib/lcm.c: Replace include
2014-12-31 1:21 [PATCH 00/19] lib: Some #include cleanups Rasmus Villemoes
` (17 preceding siblings ...)
2014-12-31 1:21 ` [PATCH 18/19] lib/percpu_ida.c: Remove redundant includes Rasmus Villemoes
@ 2014-12-31 1:21 ` Rasmus Villemoes
18 siblings, 0 replies; 20+ messages in thread
From: Rasmus Villemoes @ 2014-12-31 1:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rasmus Villemoes, linux-kernel
We don't need all the stuff kernel.h pulls in; just compiler.h since
export.h doesn't do necessary #includes. This removes more than 100
dependencies.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
lib/lcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/lcm.c b/lib/lcm.c
index 51cc6b13cd52..e97dbd51e756 100644
--- a/lib/lcm.c
+++ b/lib/lcm.c
@@ -1,4 +1,4 @@
-#include <linux/kernel.h>
+#include <linux/compiler.h>
#include <linux/gcd.h>
#include <linux/export.h>
#include <linux/lcm.h>
--
2.1.3
^ permalink raw reply [flat|nested] 20+ messages in thread