lib: reduce the use of module.h wherever possible

For files only using THIS_MODULE and/or EXPORT_SYMBOL, map
them onto including export.h -- or if the file isn't even
using those, then just delete the include.  Fix up any implicit
include dependencies that were being masked by module.h along
the way.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
This commit is contained in:
Paul Gortmaker 2011-11-16 21:29:17 -05:00
parent 630d9c4727
commit 8bc3bcc93a
63 changed files with 74 additions and 63 deletions

View File

@ -6,7 +6,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/export.h>
static const char *skip_arg(const char *cp) static const char *skip_arg(const char *cp)
{ {

View File

@ -13,7 +13,7 @@
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/atomic.h> #include <linux/atomic.h>
/* /*

View File

@ -5,8 +5,9 @@
* Version 2. See the file COPYING for more details. * Version 2. See the file COPYING for more details.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/average.h> #include <linux/average.h>
#include <linux/kernel.h>
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/log2.h> #include <linux/log2.h>

View File

@ -1,5 +1,5 @@
#include <linux/bcd.h> #include <linux/bcd.h>
#include <linux/module.h> #include <linux/export.h>
unsigned bcd2bin(unsigned char val) unsigned bcd2bin(unsigned char val)
{ {

View File

@ -5,7 +5,8 @@
* This source code is licensed under the GNU General Public License, * This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details. * Version 2. See the file COPYING for more details.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/thread_info.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>

View File

@ -9,7 +9,7 @@
* published by the Free Software Foundation; version 2. * published by the Free Software Foundation; version 2.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/bsearch.h> #include <linux/bsearch.h>
/* /*

View File

@ -1,5 +1,5 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/export.h>
/** /**
* check_signature - find BIOS signatures * check_signature - find BIOS signatures

View File

@ -32,7 +32,7 @@
/* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access
kills, so most of the assembly has to go. */ kills, so most of the assembly has to go. */
#include <linux/module.h> #include <linux/export.h>
#include <net/checksum.h> #include <net/checksum.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -12,7 +12,7 @@
* *
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>

View File

@ -11,7 +11,7 @@
#ifdef CONFIG_GENERIC_HARDIRQS #ifdef CONFIG_GENERIC_HARDIRQS
#include <linux/interrupt.h> #include <linux/interrupt.h>
#endif #endif
#include <linux/module.h> #include <linux/export.h>
/* /*
* These functions maintain a mapping from CPUs to some ordered set of * These functions maintain a mapping from CPUs to some ordered set of

View File

@ -2,7 +2,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
int __first_cpu(const cpumask_t *srcp) int __first_cpu(const cpumask_t *srcp)

View File

@ -5,7 +5,8 @@
*/ */
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/module.h> #include <linux/compiler.h>
#include <linux/export.h>
const unsigned char _ctype[] = { const unsigned char _ctype[] = {
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */

View File

@ -10,7 +10,7 @@
*/ */
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/debug_locks.h> #include <linux/debug_locks.h>

View File

@ -1,4 +1,4 @@
#include <linux/module.h> #include <linux/export.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/atomic.h> #include <linux/atomic.h>

View File

@ -1,7 +1,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/module.h> #include <linux/export.h>
void devm_ioremap_release(struct device *dev, void *res) void devm_ioremap_release(struct device *dev, void *res)
{ {

View File

@ -16,7 +16,8 @@
* assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S. * assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/kernel.h>
#include <linux/math64.h> #include <linux/math64.h>
/* Not needed on 64bit architectures */ /* Not needed on 64bit architectures */

View File

@ -4,7 +4,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
void dump_stack(void) void dump_stack(void)
{ {

View File

@ -5,7 +5,7 @@
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/stacktrace.h> #include <linux/stacktrace.h>
#include <linux/fault-inject.h> #include <linux/fault-inject.h>

View File

@ -11,7 +11,7 @@
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/module.h> #include <linux/export.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -10,7 +10,7 @@
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/module.h> #include <linux/export.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -23,7 +23,7 @@
#include <linux/flex_array.h> #include <linux/flex_array.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/reciprocal_div.h> #include <linux/reciprocal_div.h>
struct flex_array_part { struct flex_array_part {

View File

@ -1,6 +1,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/gcd.h> #include <linux/gcd.h>
#include <linux/module.h> #include <linux/export.h>
/* Greatest common divisor */ /* Greatest common divisor */
unsigned long gcd(unsigned long a, unsigned long b) unsigned long gcd(unsigned long a, unsigned long b)

View File

@ -29,7 +29,7 @@
*/ */
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/rculist.h> #include <linux/rculist.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>

View File

@ -1,5 +1,5 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/cryptohash.h> #include <linux/cryptohash.h>
/* F, G and H are basic MD4 functions: selection, majority, parity */ /* F, G and H are basic MD4 functions: selection, majority, parity */

View File

@ -10,7 +10,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
const char hex_asc[] = "0123456789abcdef"; const char hex_asc[] = "0123456789abcdef";
EXPORT_SYMBOL(hex_asc); EXPORT_SYMBOL(hex_asc);

View File

@ -1,4 +1,4 @@
#include <linux/module.h> #include <linux/export.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <asm/types.h> #include <asm/types.h>

View File

@ -29,7 +29,7 @@
#ifndef TEST // to test in user space... #ifndef TEST // to test in user space...
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/export.h>
#endif #endif
#include <linux/err.h> #include <linux/err.h>
#include <linux/string.h> #include <linux/string.h>

View File

@ -1,6 +1,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
/** /**
* int_sqrt - rough approximation to sqrt * int_sqrt - rough approximation to sqrt

View File

@ -6,7 +6,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/export.h>
/* /*
* Read/write from/to an (offsettable) iomem cookie. It might be a PIO * Read/write from/to an (offsettable) iomem cookie. It might be a PIO

View File

@ -15,7 +15,7 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/io.h> #include <linux/io.h>
/** /**

View File

@ -2,7 +2,7 @@
* IOMMU helper functions for the free area management * IOMMU helper functions for the free area management
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
int iommu_is_span_boundary(unsigned int index, unsigned int nr, int iommu_is_span_boundary(unsigned int index, unsigned int nr,

View File

@ -9,7 +9,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/export.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>

View File

@ -8,7 +8,8 @@
* as published by the Free Software Foundation; either version * as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/percpu.h>
#include <asm/irq_regs.h> #include <asm/irq_regs.h>
#ifndef ARCH_HAS_OWN_IRQ_REGS #ifndef ARCH_HAS_OWN_IRQ_REGS

View File

@ -5,7 +5,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>

View File

@ -35,7 +35,7 @@
*/ */
#include <linux/klist.h> #include <linux/klist.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/sched.h> #include <linux/sched.h>
/* /*

View File

@ -14,7 +14,7 @@
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/stat.h> #include <linux/stat.h>
#include <linux/slab.h> #include <linux/slab.h>

View File

@ -17,7 +17,8 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/kobject.h> #include <linux/kobject.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/kmod.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/user_namespace.h> #include <linux/user_namespace.h>
#include <linux/socket.h> #include <linux/socket.h>

View File

@ -15,7 +15,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/math64.h> #include <linux/math64.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/types.h> #include <linux/types.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include "kstrtox.h" #include "kstrtox.h"

View File

@ -1,6 +1,6 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/gcd.h> #include <linux/gcd.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/lcm.h> #include <linux/lcm.h>
/* Lowest common multiple */ /* Lowest common multiple */

View File

@ -6,8 +6,9 @@
* DEBUG_LIST. * DEBUG_LIST.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/kernel.h>
/* /*
* Insert a new entry between two known consecutive entries. * Insert a new entry between two known consecutive entries.

View File

@ -23,7 +23,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/llist.h> #include <linux/llist.h>

View File

@ -14,7 +14,6 @@
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h>
#include <linux/lockdep.h> #include <linux/lockdep.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/kallsyms.h> #include <linux/kallsyms.h>

View File

@ -1,5 +1,5 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/cryptohash.h> #include <linux/cryptohash.h>
#define F1(x, y, z) (z ^ (x & (y ^ z))) #define F1(x, y, z) (z ^ (x & (y ^ z)))

View File

@ -5,7 +5,7 @@
* Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> * Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>

View File

@ -6,7 +6,8 @@
*/ */
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/module.h> #include <linux/types.h>
#include <linux/export.h>
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/string.h> #include <linux/string.h>

View File

@ -22,7 +22,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/slab.h> #include <linux/slab.h>

View File

@ -35,7 +35,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/random.h> #include <linux/random.h>

View File

@ -11,7 +11,7 @@
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/module.h> #include <linux/export.h>
/* /*
* __ratelimit - rate limiting * __ratelimit - rate limiting

View File

@ -7,7 +7,8 @@
*/ */
#include <linux/rational.h> #include <linux/rational.h>
#include <linux/module.h> #include <linux/compiler.h>
#include <linux/export.h>
/* /*
* calculate best rational approximation for a given fraction * calculate best rational approximation for a given fraction

View File

@ -21,7 +21,7 @@
*/ */
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <linux/module.h> #include <linux/export.h>
static void __rb_rotate_left(struct rb_node *node, struct rb_root *root) static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
{ {

View File

@ -7,7 +7,7 @@
*/ */
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/module.h> #include <linux/export.h>
struct rwsem_waiter { struct rwsem_waiter {
struct list_head list; struct list_head list;

View File

@ -6,7 +6,7 @@
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/export.h>
/* /*
* Initialize an rwsem: * Initialize an rwsem:

View File

@ -6,7 +6,7 @@
* This source code is licensed under the GNU General Public License, * This source code is licensed under the GNU General Public License,
* Version 2. See the file COPYING for more details. * Version 2. See the file COPYING for more details.
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#include <linux/highmem.h> #include <linux/highmem.h>

View File

@ -6,7 +6,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/cryptohash.h> #include <linux/cryptohash.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>

View File

@ -3,7 +3,7 @@
* *
* DEBUG_PREEMPT variant of smp_processor_id(). * DEBUG_PREEMPT variant of smp_processor_id().
*/ */
#include <linux/module.h> #include <linux/export.h>
#include <linux/kallsyms.h> #include <linux/kallsyms.h>
#include <linux/sched.h> #include <linux/sched.h>

View File

@ -11,7 +11,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/debug_locks.h> #include <linux/debug_locks.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h> #include <linux/export.h>
void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
struct lock_class_key *key) struct lock_class_key *key)

View File

@ -22,7 +22,10 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/module.h> #include <linux/kernel.h>
#include <linux/export.h>
#include <linux/bug.h>
#include <linux/errno.h>
#ifndef __HAVE_ARCH_STRNICMP #ifndef __HAVE_ARCH_STRNICMP
/** /**

View File

@ -5,7 +5,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/math64.h> #include <linux/math64.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/string_helpers.h> #include <linux/string_helpers.h>
/** /**

View File

@ -20,7 +20,7 @@
#include <linux/cache.h> #include <linux/cache.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/swiotlb.h> #include <linux/swiotlb.h>

View File

@ -1,6 +1,6 @@
#include <linux/ptrace.h> #include <linux/ptrace.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/module.h> #include <linux/export.h>
#include <asm/syscall.h> #include <asm/syscall.h>
static int collect_syscall(struct task_struct *target, long *callno, static int collect_syscall(struct task_struct *target, long *callno,

View File

@ -24,7 +24,7 @@
#include <linux/timerqueue.h> #include <linux/timerqueue.h>
#include <linux/rbtree.h> #include <linux/rbtree.h>
#include <linux/module.h> #include <linux/export.h>
/** /**
* timerqueue_add - Adds timer to timerqueue. * timerqueue_add - Adds timer to timerqueue.

View File

@ -19,7 +19,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/export.h>
#include <linux/uuid.h> #include <linux/uuid.h>
#include <linux/random.h> #include <linux/random.h>

View File

@ -17,7 +17,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <linux/module.h> #include <linux/module.h> /* for KSYM_SYMBOL_LEN */
#include <linux/types.h> #include <linux/types.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/ctype.h> #include <linux/ctype.h>