From 5a0e3ad6af8660be21ca98a971cd00f331318c05 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 24 Mar 2010 17:04:11 +0900 Subject: 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 Guess-its-ok-by: Christoph Lameter Cc: Ingo Molnar Cc: Lee Schermerhorn --- drivers/char/agp/amd-k7-agp.c | 2 +- drivers/char/agp/backend.c | 1 + drivers/char/agp/compat_ioctl.c | 1 + drivers/char/agp/generic.c | 1 + drivers/char/agp/hp-agp.c | 1 + drivers/char/agp/intel-agp.c | 1 + drivers/char/agp/nvidia-agp.c | 1 - drivers/char/agp/sgi-agp.c | 1 + drivers/char/agp/uninorth-agp.c | 1 + drivers/char/bfin_jtag_comm.c | 1 + drivers/char/briq_panel.c | 1 - drivers/char/bsr.c | 1 + drivers/char/cyclades.c | 1 + drivers/char/dsp56k.c | 1 - drivers/char/epca.c | 1 - drivers/char/generic_serial.c | 1 + drivers/char/hpet.c | 1 + drivers/char/hvc_console.c | 1 + drivers/char/hvc_iucv.c | 1 + drivers/char/hvcs.c | 1 + drivers/char/hw_random/intel-rng.c | 1 + drivers/char/hw_random/octeon-rng.c | 1 + drivers/char/hw_random/tx4939-rng.c | 1 + drivers/char/isicom.c | 1 + drivers/char/mbcs.c | 1 + drivers/char/misc.c | 2 +- drivers/char/mmtimer.c | 1 + drivers/char/moxa.c | 1 + drivers/char/mxser.c | 2 +- drivers/char/nozomi.c | 1 + drivers/char/nvram.c | 1 - drivers/char/pcmcia/ipwireless/network.c | 1 + drivers/char/ppdev.c | 1 + drivers/char/ps3flash.c | 1 + drivers/char/pty.c | 1 + drivers/char/raw.c | 1 + drivers/char/rio/rioinit.c | 1 - drivers/char/rio/riointr.c | 1 - drivers/char/rio/rioparam.c | 1 - drivers/char/rio/rioroute.c | 1 - drivers/char/rio/riotty.c | 1 - drivers/char/serial167.c | 1 + drivers/char/snsc_event.c | 1 + drivers/char/sonypi.c | 1 + drivers/char/specialix.c | 1 + drivers/char/sysrq.c | 1 + drivers/char/tpm/tpm.c | 1 + drivers/char/tpm/tpm_bios.c | 1 + drivers/char/tpm/tpm_nsc.c | 1 + drivers/char/tpm/tpm_tis.c | 1 + drivers/char/tty_audit.c | 1 + drivers/char/viotape.c | 1 + drivers/char/virtio_console.c | 1 + drivers/char/vme_scc.c | 1 - drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 + 55 files changed, 44 insertions(+), 14 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c index 73dbf40c874..a7637d72cef 100644 --- a/drivers/char/agp/amd-k7-agp.c +++ b/drivers/char/agp/amd-k7-agp.c @@ -6,9 +6,9 @@ #include #include #include -#include #include #include +#include #include "agp.h" #define AMD_MMBASE 0x14 diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index c3ab46da51a..ee4f855611b 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/agp/compat_ioctl.c b/drivers/char/agp/compat_ioctl.c index 58c57cb2518..9d2c97a69cd 100644 --- a/drivers/char/agp/compat_ioctl.c +++ b/drivers/char/agp/compat_ioctl.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "agp.h" #include "compat_ioctl.h" diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index c50543966eb..fb86708e47e 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 58752b70efe..056b289a1e8 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index b78d5c381ef..d41331bc2aa 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c index 7e36d2b4f9d..10f24e349a2 100644 --- a/drivers/char/agp/nvidia-agp.c +++ b/drivers/char/agp/nvidia-agp.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/agp/sgi-agp.c b/drivers/char/agp/sgi-agp.c index 0d426ae39c8..ffa888cd1c8 100644 --- a/drivers/char/agp/sgi-agp.c +++ b/drivers/char/agp/sgi-agp.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index d89da4ac061..6f48931ac1c 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c @@ -3,6 +3,7 @@ */ #include #include +#include #include #include #include diff --git a/drivers/char/bfin_jtag_comm.c b/drivers/char/bfin_jtag_comm.c index 2628c7415ea..e397df3ad98 100644 --- a/drivers/char/bfin_jtag_comm.c +++ b/drivers/char/bfin_jtag_comm.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c index d8cff909001..555cd93c2ee 100644 --- a/drivers/char/briq_panel.c +++ b/drivers/char/briq_panel.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c index c02db01f736..7fef305774d 100644 --- a/drivers/char/bsr.c +++ b/drivers/char/bsr.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index b861c08263a..9824b416290 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c @@ -79,6 +79,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c index 85832ab924e..8a1b28a10ef 100644 --- a/drivers/char/dsp56k.c +++ b/drivers/char/dsp56k.c @@ -24,7 +24,6 @@ */ #include -#include /* for kmalloc() and kfree() */ #include #include #include diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 17b044a71e0..6f5ffe1320f 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index d400cbd280f..5954ee1dc95 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #define DEBUG diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index 9c5eea3ea4d..9ded667625a 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index ba55bba151b..d3890e8d30e 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c @@ -38,6 +38,7 @@ #include #include #include +#include #include diff --git a/drivers/char/hvc_iucv.c b/drivers/char/hvc_iucv.c index 37b0542a4ee..5a80ad68ef2 100644 --- a/drivers/char/hvc_iucv.c +++ b/drivers/char/hvc_iucv.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt #include +#include #include #include #include diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 266b858b8f8..bedc6c1b6fa 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c @@ -74,6 +74,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 91b53eb1c05..86fe45c1996 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c index 54b0d9ba65c..9cd0feca318 100644 --- a/drivers/char/hw_random/octeon-rng.c +++ b/drivers/char/hw_random/octeon-rng.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/hw_random/tx4939-rng.c b/drivers/char/hw_random/tx4939-rng.c index 544d9085a8e..0bc0cb70210 100644 --- a/drivers/char/hw_random/tx4939-rng.c +++ b/drivers/char/hw_random/tx4939-rng.c @@ -14,6 +14,7 @@ #include #include #include +#include #define TX4939_RNG_RCSR 0x00000000 #define TX4939_RNG_ROR(n) (0x00000018 + (n) * 8) diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index be2e8f9a27c..0fa2e4a0835 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -130,6 +130,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index 87c67b42bc0..83bef4efe37 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 94a136e96c0..92ab03d2829 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include /* * Head entry for the doubly linked miscdevice list diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 04fd0d843b3..ea7c99fa978 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 166495d6a1d..107b0bd58d1 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index e0c5d2a6904..95c9f54f3d3 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -33,12 +33,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c index a3f32a15fde..a6638003f53 100644 --- a/drivers/char/nozomi.c +++ b/drivers/char/nozomi.c @@ -55,6 +55,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c index 5eb83c3ca20..47e8f7b0e4c 100644 --- a/drivers/char/nvram.c +++ b/drivers/char/nvram.c @@ -100,7 +100,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/pcmcia/ipwireless/network.c b/drivers/char/pcmcia/ipwireless/network.c index 590762a7f21..65920163f53 100644 --- a/drivers/char/pcmcia/ipwireless/network.c +++ b/drivers/char/pcmcia/ipwireless/network.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 432655bcb04..fdd37543aa7 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c index f424d394a28..606048b72bc 100644 --- a/drivers/char/ps3flash.c +++ b/drivers/char/ps3flash.c @@ -20,6 +20,7 @@ #include #include +#include #include #include diff --git a/drivers/char/pty.c b/drivers/char/pty.c index 5ee42481726..d83a43130df 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c @@ -29,6 +29,7 @@ #include #include #include +#include #include diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 64acd05f71c..d331c59b571 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c @@ -20,6 +20,7 @@ #include #include #include +#include #include diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index be0ba401966..24a282bb89d 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -31,7 +31,6 @@ */ #include -#include #include #include #include diff --git a/drivers/char/rio/riointr.c b/drivers/char/rio/riointr.c index 71f87600907..2e71aecae20 100644 --- a/drivers/char/rio/riointr.c +++ b/drivers/char/rio/riointr.c @@ -31,7 +31,6 @@ */ #include -#include #include #include #include diff --git a/drivers/char/rio/rioparam.c b/drivers/char/rio/rioparam.c index d687c17be15..6415f3f32a7 100644 --- a/drivers/char/rio/rioparam.c +++ b/drivers/char/rio/rioparam.c @@ -31,7 +31,6 @@ */ #include -#include #include #include #include diff --git a/drivers/char/rio/rioroute.c b/drivers/char/rio/rioroute.c index 706c2a25f7a..f9b936ac339 100644 --- a/drivers/char/rio/rioroute.c +++ b/drivers/char/rio/rioroute.c @@ -31,7 +31,6 @@ */ #include -#include #include #include #include diff --git a/drivers/char/rio/riotty.c b/drivers/char/rio/riotty.c index 47fab7c3307..8a90393faf3 100644 --- a/drivers/char/rio/riotty.c +++ b/drivers/char/rio/riotty.c @@ -34,7 +34,6 @@ #include #include -#include #include #include #include diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index 1ec3d5cd748..8dfd24721a8 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index 55a95892ccf..ee156948b9f 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index bba727c3807..73f66d03624 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 07ac14d949c..2c24fcdc722 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -94,6 +94,7 @@ #include #include #include +#include #include "specialix_io8.h" #include "cd1865.h" diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 1ae2de7d8b4..59de2525d30 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index f06bb37defb..068c816e694 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -24,6 +24,7 @@ */ #include +#include #include #include diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c index bf2170fb1cd..0636520fa9b 100644 --- a/drivers/char/tpm/tpm_bios.c +++ b/drivers/char/tpm/tpm_bios.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "tpm.h" diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c index 70efba2ee05..a605cb7dd89 100644 --- a/drivers/char/tpm/tpm_nsc.c +++ b/drivers/char/tpm/tpm_nsc.c @@ -20,6 +20,7 @@ */ #include +#include #include "tpm.h" /* National definitions */ diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 2405f17b29d..94345994f8a 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "tpm.h" diff --git a/drivers/char/tty_audit.c b/drivers/char/tty_audit.c index 283a15bc84e..1b8ee590b4c 100644 --- a/drivers/char/tty_audit.c +++ b/drivers/char/tty_audit.c @@ -10,6 +10,7 @@ */ #include +#include #include struct tty_audit_buf { diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index 042c8149a6d..1144a04cda6 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 44288ce0cb4..026ea6c27e0 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index 8b24729fec8..12de1202d22 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c index 4846d50199f..7261b8d9087 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -86,6 +86,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3