aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-03-24 04:04:11 -0400
committerTejun Heo <tj@kernel.org>2010-03-30 09:02:32 -0400
commit5a0e3ad6af8660be21ca98a971cd00f331318c05 (patch)
tree5bfb7be11a03176a87296a43ac6647975c00a1d1 /include
parented391f4ebf8f701d3566423ce8f17e614cde9806 (diff)
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drmP.h1
-rw-r--r--include/linux/delayacct.h1
-rw-r--r--include/linux/fsnotify.h1
-rw-r--r--include/linux/gameport.h1
-rw-r--r--include/linux/io-mapping.h1
-rw-r--r--include/linux/jbd.h1
-rw-r--r--include/linux/jbd2.h1
-rw-r--r--include/linux/security.h2
-rw-r--r--include/linux/spi/spi.h1
-rw-r--r--include/linux/taskstats_kern.h1
-rw-r--r--include/linux/usb/gadget.h2
-rw-r--r--include/linux/wimax/debug.h1
-rw-r--r--include/net/ax25.h1
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/ipx.h1
-rw-r--r--include/net/iucv/iucv.h1
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h2
-rw-r--r--include/net/netlabel.h1
-rw-r--r--include/net/netrom.h1
-rw-r--r--include/net/sock.h1
-rw-r--r--include/net/x25.h1
-rw-r--r--include/net/xfrm.h1
-rw-r--r--include/scsi/libsas.h1
-rw-r--r--include/xen/xenbus.h1
24 files changed, 26 insertions, 1 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index 4a3c4e441027..cca2845bca55 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -55,6 +55,7 @@
55#include <linux/mm.h> 55#include <linux/mm.h>
56#include <linux/cdev.h> 56#include <linux/cdev.h>
57#include <linux/mutex.h> 57#include <linux/mutex.h>
58#include <linux/slab.h>
58#if defined(__alpha__) || defined(__powerpc__) 59#if defined(__alpha__) || defined(__powerpc__)
59#include <asm/pgtable.h> /* For pte_wrprotect */ 60#include <asm/pgtable.h> /* For pte_wrprotect */
60#endif 61#endif
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index 5076fe0c8a96..6cee17c22313 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -18,6 +18,7 @@
18#define _LINUX_DELAYACCT_H 18#define _LINUX_DELAYACCT_H
19 19
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/slab.h>
21 22
22/* 23/*
23 * Per-task flags relevant to delay accounting 24 * Per-task flags relevant to delay accounting
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index df8fd9a3b214..01755909ce81 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -15,6 +15,7 @@
15#include <linux/inotify.h> 15#include <linux/inotify.h>
16#include <linux/fsnotify_backend.h> 16#include <linux/fsnotify_backend.h>
17#include <linux/audit.h> 17#include <linux/audit.h>
18#include <linux/slab.h>
18 19
19/* 20/*
20 * fsnotify_d_instantiate - instantiate a dentry for inode 21 * fsnotify_d_instantiate - instantiate a dentry for inode
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 48e68da097f6..361d1cc288d0 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/slab.h>
19 20
20struct gameport { 21struct gameport {
21 22
diff --git a/include/linux/io-mapping.h b/include/linux/io-mapping.h
index 97eb928b4924..25085ddd955f 100644
--- a/include/linux/io-mapping.h
+++ b/include/linux/io-mapping.h
@@ -19,6 +19,7 @@
19#define _LINUX_IO_MAPPING_H 19#define _LINUX_IO_MAPPING_H
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/slab.h>
22#include <asm/io.h> 23#include <asm/io.h>
23#include <asm/page.h> 24#include <asm/page.h>
24#include <asm/iomap.h> 25#include <asm/iomap.h>
diff --git a/include/linux/jbd.h b/include/linux/jbd.h
index f3aa59cb675d..516a2a27e87a 100644
--- a/include/linux/jbd.h
+++ b/include/linux/jbd.h
@@ -31,6 +31,7 @@
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/lockdep.h> 33#include <linux/lockdep.h>
34#include <linux/slab.h>
34 35
35#define journal_oom_retry 1 36#define journal_oom_retry 1
36 37
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index 1ec876358180..a4d2e9f7088a 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -30,6 +30,7 @@
30#include <linux/bit_spinlock.h> 30#include <linux/bit_spinlock.h>
31#include <linux/mutex.h> 31#include <linux/mutex.h>
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/slab.h>
33#endif 34#endif
34 35
35#define journal_oom_retry 1 36#define journal_oom_retry 1
diff --git a/include/linux/security.h b/include/linux/security.h
index 233d20b52c1b..3158dd982d27 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -33,7 +33,7 @@
33#include <linux/sched.h> 33#include <linux/sched.h>
34#include <linux/key.h> 34#include <linux/key.h>
35#include <linux/xfrm.h> 35#include <linux/xfrm.h>
36#include <linux/gfp.h> 36#include <linux/slab.h>
37#include <net/flow.h> 37#include <net/flow.h>
38 38
39/* Maximum number of letters for an LSM name string */ 39/* Maximum number of letters for an LSM name string */
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 97b60b37f445..af56071b06f9 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -21,6 +21,7 @@
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h>
24 25
25/* 26/*
26 * INTERFACES between SPI master-side drivers and SPI infrastructure. 27 * INTERFACES between SPI master-side drivers and SPI infrastructure.
diff --git a/include/linux/taskstats_kern.h b/include/linux/taskstats_kern.h
index b6523c1427ce..58de6edf751f 100644
--- a/include/linux/taskstats_kern.h
+++ b/include/linux/taskstats_kern.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/taskstats.h> 10#include <linux/taskstats.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/slab.h>
12 13
13#ifdef CONFIG_TASKSTATS 14#ifdef CONFIG_TASKSTATS
14extern struct kmem_cache *taskstats_cache; 15extern struct kmem_cache *taskstats_cache;
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index bbf45d500b6d..f4b7ca516cdd 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -15,6 +15,8 @@
15#ifndef __LINUX_USB_GADGET_H 15#ifndef __LINUX_USB_GADGET_H
16#define __LINUX_USB_GADGET_H 16#define __LINUX_USB_GADGET_H
17 17
18#include <linux/slab.h>
19
18struct usb_ep; 20struct usb_ep;
19 21
20/** 22/**
diff --git a/include/linux/wimax/debug.h b/include/linux/wimax/debug.h
index db8096e88533..57031b4d12f2 100644
--- a/include/linux/wimax/debug.h
+++ b/include/linux/wimax/debug.h
@@ -155,6 +155,7 @@
155 155
156#include <linux/types.h> 156#include <linux/types.h>
157#include <linux/device.h> 157#include <linux/device.h>
158#include <linux/slab.h>
158 159
159 160
160/* Backend stuff */ 161/* Backend stuff */
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 717e2192d521..206d22297ac3 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -10,6 +10,7 @@
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h>
13#include <asm/atomic.h> 14#include <asm/atomic.h>
14 15
15#define AX25_T1CLAMPLO 1 16#define AX25_T1CLAMPLO 1
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index c07ac9650ebc..c49086d2bc7d 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -2,6 +2,7 @@
2#define __NET_FIB_RULES_H 2#define __NET_FIB_RULES_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/slab.h>
5#include <linux/netdevice.h> 6#include <linux/netdevice.h>
6#include <linux/fib_rules.h> 7#include <linux/fib_rules.h>
7#include <net/flow.h> 8#include <net/flow.h>
diff --git a/include/net/ipx.h b/include/net/ipx.h
index a14121dd1932..ef51a668ba19 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -13,6 +13,7 @@
13#include <net/datalink.h> 13#include <net/datalink.h>
14#include <linux/ipx.h> 14#include <linux/ipx.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/slab.h>
16 17
17struct ipx_address { 18struct ipx_address {
18 __be32 net; 19 __be32 net;
diff --git a/include/net/iucv/iucv.h b/include/net/iucv/iucv.h
index 5e310c8d8e2f..205a3360156e 100644
--- a/include/net/iucv/iucv.h
+++ b/include/net/iucv/iucv.h
@@ -28,6 +28,7 @@
28 */ 28 */
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/slab.h>
31#include <asm/debug.h> 32#include <asm/debug.h>
32 33
33/* 34/*
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 2d2a1f9a61d8..32d15bd6efa3 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -1,6 +1,8 @@
1#ifndef _NF_CONNTRACK_EXTEND_H 1#ifndef _NF_CONNTRACK_EXTEND_H
2#define _NF_CONNTRACK_EXTEND_H 2#define _NF_CONNTRACK_EXTEND_H
3 3
4#include <linux/slab.h>
5
4#include <net/netfilter/nf_conntrack.h> 6#include <net/netfilter/nf_conntrack.h>
5 7
6enum nf_ct_ext_id { 8enum nf_ct_ext_id {
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 60ebbc1fef46..9db401a8b4d9 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -31,6 +31,7 @@
31#define _NETLABEL_H 31#define _NETLABEL_H
32 32
33#include <linux/types.h> 33#include <linux/types.h>
34#include <linux/slab.h>
34#include <linux/net.h> 35#include <linux/net.h>
35#include <linux/skbuff.h> 36#include <linux/skbuff.h>
36#include <linux/in.h> 37#include <linux/in.h>
diff --git a/include/net/netrom.h b/include/net/netrom.h
index ab170a60e7d3..f0793c1cb5f8 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -9,6 +9,7 @@
9 9
10#include <linux/netrom.h> 10#include <linux/netrom.h>
11#include <linux/list.h> 11#include <linux/list.h>
12#include <linux/slab.h>
12#include <net/sock.h> 13#include <net/sock.h>
13 14
14#define NR_NETWORK_LEN 15 15#define NR_NETWORK_LEN 15
diff --git a/include/net/sock.h b/include/net/sock.h
index 092b0551e77f..b4603cd54fcd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -51,6 +51,7 @@
51#include <linux/skbuff.h> /* struct sk_buff */ 51#include <linux/skbuff.h> /* struct sk_buff */
52#include <linux/mm.h> 52#include <linux/mm.h>
53#include <linux/security.h> 53#include <linux/security.h>
54#include <linux/slab.h>
54 55
55#include <linux/filter.h> 56#include <linux/filter.h>
56#include <linux/rculist_nulls.h> 57#include <linux/rculist_nulls.h>
diff --git a/include/net/x25.h b/include/net/x25.h
index 9baa07dc7d17..15ef9624ab75 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -10,6 +10,7 @@
10#ifndef _X25_H 10#ifndef _X25_H
11#define _X25_H 11#define _X25_H
12#include <linux/x25.h> 12#include <linux/x25.h>
13#include <linux/slab.h>
13#include <net/sock.h> 14#include <net/sock.h>
14 15
15#define X25_ADDR_LEN 16 16#define X25_ADDR_LEN 16
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d74e080ba6c9..ac52f33f3e4a 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -12,6 +12,7 @@
12#include <linux/in6.h> 12#include <linux/in6.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/audit.h> 14#include <linux/audit.h>
15#include <linux/slab.h>
15 16
16#include <net/sock.h> 17#include <net/sock.h>
17#include <net/dst.h> 18#include <net/dst.h>
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 9eaa3f05f954..3b586859669c 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -36,6 +36,7 @@
36#include <scsi/scsi_cmnd.h> 36#include <scsi/scsi_cmnd.h>
37#include <scsi/scsi_transport_sas.h> 37#include <scsi/scsi_transport_sas.h>
38#include <linux/scatterlist.h> 38#include <linux/scatterlist.h>
39#include <linux/slab.h>
39 40
40struct block_device; 41struct block_device;
41 42
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b9763badbd77..43e2d7d33976 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -39,6 +39,7 @@
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/completion.h> 40#include <linux/completion.h>
41#include <linux/init.h> 41#include <linux/init.h>
42#include <linux/slab.h>
42#include <xen/interface/xen.h> 43#include <xen/interface/xen.h>
43#include <xen/interface/grant_table.h> 44#include <xen/interface/grant_table.h>
44#include <xen/interface/io/xenbus.h> 45#include <xen/interface/io/xenbus.h>