aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 22:44:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 22:44:47 -0500
commit32aaeffbd4a7457bf2f7448b33b5946ff2a960eb (patch)
treefaf7ad871d87176423ff9ed1d1ba4d9c688fc23f /include
parent208bca0860406d16398145ddd950036a737c3c9d (diff)
parent67b84999b1a8b1af5625b1eabe92146c5eb42932 (diff)
Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
Diffstat (limited to 'include')
-rw-r--r--include/acpi/platform/aclinux.h1
-rw-r--r--include/drm/drmP.h3
-rw-r--r--include/linux/bcma/bcma.h7
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/cpuidle.h3
-rw-r--r--include/linux/crypto.h6
-rw-r--r--include/linux/device.h15
-rw-r--r--include/linux/device_cgroup.h1
-rw-r--r--include/linux/dmaengine.h2
-rw-r--r--include/linux/export.h89
-rw-r--r--include/linux/firmware.h2
-rw-r--r--include/linux/ftrace.h2
-rw-r--r--include/linux/gameport.h17
-rw-r--r--include/linux/hid.h9
-rw-r--r--include/linux/i2c.h10
-rw-r--r--include/linux/ipmi.h3
-rw-r--r--include/linux/ipmi_smi.h1
-rw-r--r--include/linux/irq.h32
-rw-r--r--include/linux/irqdesc.h1
-rw-r--r--include/linux/mdio-bitbang.h3
-rw-r--r--include/linux/miscdevice.h3
-rw-r--r--include/linux/module.h73
-rw-r--r--include/linux/moduleparam.h5
-rw-r--r--include/linux/mtd/mtd.h3
-rw-r--r--include/linux/of.h1
-rw-r--r--include/linux/of_platform.h1
-rw-r--r--include/linux/pci_hotplug.h10
-rw-r--r--include/linux/pm_runtime.h1
-rw-r--r--include/linux/regmap.h2
-rw-r--r--include/linux/regulator/driver.h1
-rw-r--r--include/linux/serio.h20
-rw-r--r--include/linux/ssb/ssb.h7
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/svc_xprt.h3
-rw-r--r--include/linux/sysdev.h1
-rw-r--r--include/linux/textsearch.h3
-rw-r--r--include/linux/uio_driver.h12
-rw-r--r--include/linux/usb.h9
-rw-r--r--include/linux/uwb.h1
-rw-r--r--include/linux/uwb/umc.h7
-rw-r--r--include/linux/vermagic.h1
-rw-r--r--include/linux/vlynq.h3
-rw-r--r--include/media/saa7146.h3
-rw-r--r--include/media/v4l2-int-device.h3
-rw-r--r--include/net/bluetooth/hci_core.h24
-rw-r--r--include/net/inet_timewait_sock.h1
-rw-r--r--include/net/ip_vs.h15
-rw-r--r--include/net/lib80211.h3
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sock.h2
-rw-r--r--include/sound/core.h2
-rw-r--r--include/trace/define_trace.h10
-rw-r--r--include/trace/events/module.h2
-rw-r--r--include/xen/xenbus.h1
55 files changed, 231 insertions, 215 deletions
diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
index f72403c4b51a..f4b2effe0333 100644
--- a/include/acpi/platform/aclinux.h
+++ b/include/acpi/platform/aclinux.h
@@ -55,7 +55,6 @@
55 55
56#include <linux/string.h> 56#include <linux/string.h>
57#include <linux/kernel.h> 57#include <linux/kernel.h>
58#include <linux/module.h>
59#include <linux/ctype.h> 58#include <linux/ctype.h>
60#include <linux/sched.h> 59#include <linux/sched.h>
61#include <asm/system.h> 60#include <asm/system.h>
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index cf3b446139ea..cf399495d38f 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -42,7 +42,6 @@
42 * can build the DRM (part of PI DRI). 4/21/2000 S + B */ 42 * can build the DRM (part of PI DRI). 4/21/2000 S + B */
43#include <asm/current.h> 43#include <asm/current.h>
44#endif /* __alpha__ */ 44#endif /* __alpha__ */
45#include <linux/module.h>
46#include <linux/kernel.h> 45#include <linux/kernel.h>
47#include <linux/miscdevice.h> 46#include <linux/miscdevice.h>
48#include <linux/fs.h> 47#include <linux/fs.h>
@@ -80,6 +79,8 @@
80#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE))) 79#define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
81#define __OS_HAS_MTRR (defined(CONFIG_MTRR)) 80#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
82 81
82struct module;
83
83struct drm_file; 84struct drm_file;
84struct drm_device; 85struct drm_device;
85 86
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 5dbd7055cb86..4d4b59de9467 100644
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -170,10 +170,9 @@ struct bcma_driver {
170}; 170};
171extern 171extern
172int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); 172int __bcma_driver_register(struct bcma_driver *drv, struct module *owner);
173static inline int bcma_driver_register(struct bcma_driver *drv) 173#define bcma_driver_register(drv) \
174{ 174 __bcma_driver_register(drv, THIS_MODULE)
175 return __bcma_driver_register(drv, THIS_MODULE); 175
176}
177extern void bcma_driver_unregister(struct bcma_driver *drv); 176extern void bcma_driver_unregister(struct bcma_driver *drv);
178 177
179struct bcma_bus { 178struct bcma_bus {
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 5267cd2f20dc..c7a6d3b5bc7b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -14,7 +14,6 @@
14#include <linux/wait.h> 14#include <linux/wait.h>
15#include <linux/mempool.h> 15#include <linux/mempool.h>
16#include <linux/bio.h> 16#include <linux/bio.h>
17#include <linux/module.h>
18#include <linux/stringify.h> 17#include <linux/stringify.h>
19#include <linux/gfp.h> 18#include <linux/gfp.h>
20#include <linux/bsg.h> 19#include <linux/bsg.h>
@@ -22,6 +21,7 @@
22 21
23#include <asm/scatterlist.h> 22#include <asm/scatterlist.h>
24 23
24struct module;
25struct scsi_ioctl_command; 25struct scsi_ioctl_command;
26 26
27struct request_queue; 27struct request_queue;
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index b51629e15cfc..583baf22cad2 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -13,7 +13,6 @@
13 13
14#include <linux/percpu.h> 14#include <linux/percpu.h>
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/module.h>
17#include <linux/kobject.h> 16#include <linux/kobject.h>
18#include <linux/completion.h> 17#include <linux/completion.h>
19 18
@@ -21,6 +20,8 @@
21#define CPUIDLE_NAME_LEN 16 20#define CPUIDLE_NAME_LEN 16
22#define CPUIDLE_DESC_LEN 32 21#define CPUIDLE_DESC_LEN 32
23 22
23struct module;
24
24struct cpuidle_device; 25struct cpuidle_device;
25 26
26 27
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index de9adec5693c..8a94217b298e 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -18,7 +18,6 @@
18#define _LINUX_CRYPTO_H 18#define _LINUX_CRYPTO_H
19 19
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <linux/module.h>
22#include <linux/kernel.h> 21#include <linux/kernel.h>
23#include <linux/list.h> 22#include <linux/list.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
@@ -510,11 +509,6 @@ static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm)
510 return tfm->__crt_alg->cra_priority; 509 return tfm->__crt_alg->cra_priority;
511} 510}
512 511
513static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm)
514{
515 return module_name(tfm->__crt_alg->cra_module);
516}
517
518static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) 512static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm)
519{ 513{
520 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; 514 return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK;
diff --git a/include/linux/device.h b/include/linux/device.h
index e88abeecfadf..ffbcf95cd97d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -20,7 +20,7 @@
20#include <linux/lockdep.h> 20#include <linux/lockdep.h>
21#include <linux/compiler.h> 21#include <linux/compiler.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/module.h> 23#include <linux/mutex.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <asm/device.h> 26#include <asm/device.h>
@@ -29,6 +29,7 @@ struct device;
29struct device_private; 29struct device_private;
30struct device_driver; 30struct device_driver;
31struct driver_private; 31struct driver_private;
32struct module;
32struct class; 33struct class;
33struct subsys_private; 34struct subsys_private;
34struct bus_type; 35struct bus_type;
@@ -723,10 +724,14 @@ extern int dev_set_drvdata(struct device *dev, void *data);
723 */ 724 */
724extern struct device *__root_device_register(const char *name, 725extern struct device *__root_device_register(const char *name,
725 struct module *owner); 726 struct module *owner);
726static inline struct device *root_device_register(const char *name) 727
727{ 728/*
728 return __root_device_register(name, THIS_MODULE); 729 * This is a macro to avoid include problems with THIS_MODULE,
729} 730 * just as per what is done for device_schedule_callback() above.
731 */
732#define root_device_register(name) \
733 __root_device_register(name, THIS_MODULE)
734
730extern void root_device_unregister(struct device *root); 735extern void root_device_unregister(struct device *root);
731 736
732static inline void *dev_get_platdata(const struct device *dev) 737static inline void *dev_get_platdata(const struct device *dev)
diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h
index 7aad1f440867..8b64221b432b 100644
--- a/include/linux/device_cgroup.h
+++ b/include/linux/device_cgroup.h
@@ -1,4 +1,3 @@
1#include <linux/module.h>
2#include <linux/fs.h> 1#include <linux/fs.h>
3 2
4#ifdef CONFIG_CGROUP_DEVICE 3#ifdef CONFIG_CGROUP_DEVICE
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index ace51af4369f..75f53f874b24 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -25,6 +25,8 @@
25#include <linux/uio.h> 25#include <linux/uio.h>
26#include <linux/dma-direction.h> 26#include <linux/dma-direction.h>
27#include <linux/scatterlist.h> 27#include <linux/scatterlist.h>
28#include <linux/bitmap.h>
29#include <asm/page.h>
28 30
29/** 31/**
30 * typedef dma_cookie_t - an opaque DMA cookie 32 * typedef dma_cookie_t - an opaque DMA cookie
diff --git a/include/linux/export.h b/include/linux/export.h
new file mode 100644
index 000000000000..696c0f48afc7
--- /dev/null
+++ b/include/linux/export.h
@@ -0,0 +1,89 @@
1#ifndef _LINUX_EXPORT_H
2#define _LINUX_EXPORT_H
3/*
4 * Export symbols from the kernel to modules. Forked from module.h
5 * to reduce the amount of pointless cruft we feed to gcc when only
6 * exporting a simple symbol or two.
7 *
8 * If you feel the need to add #include <linux/foo.h> to this file
9 * then you are doing something wrong and should go away silently.
10 */
11
12/* Some toolchains use a `_' prefix for all user symbols. */
13#ifdef CONFIG_SYMBOL_PREFIX
14#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
15#else
16#define MODULE_SYMBOL_PREFIX ""
17#endif
18
19struct kernel_symbol
20{
21 unsigned long value;
22 const char *name;
23};
24
25#ifdef MODULE
26extern struct module __this_module;
27#define THIS_MODULE (&__this_module)
28#else
29#define THIS_MODULE ((struct module *)0)
30#endif
31
32#ifdef CONFIG_MODULES
33
34#ifndef __GENKSYMS__
35#ifdef CONFIG_MODVERSIONS
36/* Mark the CRC weak since genksyms apparently decides not to
37 * generate a checksums for some symbols */
38#define __CRC_SYMBOL(sym, sec) \
39 extern void *__crc_##sym __attribute__((weak)); \
40 static const unsigned long __kcrctab_##sym \
41 __used \
42 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
43 = (unsigned long) &__crc_##sym;
44#else
45#define __CRC_SYMBOL(sym, sec)
46#endif
47
48/* For every exported symbol, place a struct in the __ksymtab section */
49#define __EXPORT_SYMBOL(sym, sec) \
50 extern typeof(sym) sym; \
51 __CRC_SYMBOL(sym, sec) \
52 static const char __kstrtab_##sym[] \
53 __attribute__((section("__ksymtab_strings"), aligned(1))) \
54 = MODULE_SYMBOL_PREFIX #sym; \
55 static const struct kernel_symbol __ksymtab_##sym \
56 __used \
57 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
58 = { (unsigned long)&sym, __kstrtab_##sym }
59
60#define EXPORT_SYMBOL(sym) \
61 __EXPORT_SYMBOL(sym, "")
62
63#define EXPORT_SYMBOL_GPL(sym) \
64 __EXPORT_SYMBOL(sym, "_gpl")
65
66#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
67 __EXPORT_SYMBOL(sym, "_gpl_future")
68
69#ifdef CONFIG_UNUSED_SYMBOLS
70#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
71#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
72#else
73#define EXPORT_UNUSED_SYMBOL(sym)
74#define EXPORT_UNUSED_SYMBOL_GPL(sym)
75#endif
76
77#endif /* __GENKSYMS__ */
78
79#else /* !CONFIG_MODULES... */
80
81#define EXPORT_SYMBOL(sym)
82#define EXPORT_SYMBOL_GPL(sym)
83#define EXPORT_SYMBOL_GPL_FUTURE(sym)
84#define EXPORT_UNUSED_SYMBOL(sym)
85#define EXPORT_UNUSED_SYMBOL_GPL(sym)
86
87#endif /* CONFIG_MODULES */
88
89#endif /* _LINUX_EXPORT_H */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index 21b3e7588abd..1e7c01189fa6 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -1,7 +1,6 @@
1#ifndef _LINUX_FIRMWARE_H 1#ifndef _LINUX_FIRMWARE_H
2#define _LINUX_FIRMWARE_H 2#define _LINUX_FIRMWARE_H
3 3
4#include <linux/module.h>
5#include <linux/types.h> 4#include <linux/types.h>
6#include <linux/compiler.h> 5#include <linux/compiler.h>
7#include <linux/gfp.h> 6#include <linux/gfp.h>
@@ -15,6 +14,7 @@ struct firmware {
15 struct page **pages; 14 struct page **pages;
16}; 15};
17 16
17struct module;
18struct device; 18struct device;
19 19
20struct builtin_fw { 20struct builtin_fw {
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index f0c0e8a47ae6..26eafcef75be 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -10,7 +10,6 @@
10#include <linux/kallsyms.h> 10#include <linux/kallsyms.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/module.h>
14#include <linux/ktime.h> 13#include <linux/ktime.h>
15#include <linux/sched.h> 14#include <linux/sched.h>
16#include <linux/types.h> 15#include <linux/types.h>
@@ -19,6 +18,7 @@
19 18
20#include <asm/ftrace.h> 19#include <asm/ftrace.h>
21 20
21struct module;
22struct ftrace_hash; 22struct ftrace_hash;
23 23
24#ifdef CONFIG_FUNCTION_TRACER 24#ifdef CONFIG_FUNCTION_TRACER
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 069ee4139105..b456b08d70ed 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -71,10 +71,9 @@ void gameport_close(struct gameport *gameport);
71#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) 71#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
72 72
73void __gameport_register_port(struct gameport *gameport, struct module *owner); 73void __gameport_register_port(struct gameport *gameport, struct module *owner);
74static inline void gameport_register_port(struct gameport *gameport) 74/* use a define to avoid include chaining to get THIS_MODULE */
75{ 75#define gameport_register_port(gameport) \
76 __gameport_register_port(gameport, THIS_MODULE); 76 __gameport_register_port(gameport, THIS_MODULE)
77}
78 77
79void gameport_unregister_port(struct gameport *gameport); 78void gameport_unregister_port(struct gameport *gameport);
80 79
@@ -145,12 +144,12 @@ static inline void gameport_unpin_driver(struct gameport *gameport)
145 mutex_unlock(&gameport->drv_mutex); 144 mutex_unlock(&gameport->drv_mutex);
146} 145}
147 146
148int __gameport_register_driver(struct gameport_driver *drv, 147int __must_check __gameport_register_driver(struct gameport_driver *drv,
149 struct module *owner, const char *mod_name); 148 struct module *owner, const char *mod_name);
150static inline int __must_check gameport_register_driver(struct gameport_driver *drv) 149
151{ 150/* use a define to avoid include chaining to get THIS_MODULE & friends */
152 return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); 151#define gameport_register_driver(drv) \
153} 152 __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
154 153
155void gameport_unregister_driver(struct gameport_driver *drv); 154void gameport_unregister_driver(struct gameport_driver *drv);
156 155
diff --git a/include/linux/hid.h b/include/linux/hid.h
index deed5f9a1e1c..c235e4e8767c 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -697,10 +697,11 @@ extern void hid_destroy_device(struct hid_device *);
697 697
698extern int __must_check __hid_register_driver(struct hid_driver *, 698extern int __must_check __hid_register_driver(struct hid_driver *,
699 struct module *, const char *mod_name); 699 struct module *, const char *mod_name);
700static inline int __must_check hid_register_driver(struct hid_driver *driver) 700
701{ 701/* use a define to avoid include chaining to get THIS_MODULE & friends */
702 return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 702#define hid_register_driver(driver) \
703} 703 __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
704
704extern void hid_unregister_driver(struct hid_driver *); 705extern void hid_unregister_driver(struct hid_driver *);
705 706
706extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); 707extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 38a21c3edd2c..a81bf6d23b3e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -28,7 +28,6 @@
28 28
29#include <linux/types.h> 29#include <linux/types.h>
30#ifdef __KERNEL__ 30#ifdef __KERNEL__
31#include <linux/module.h>
32#include <linux/mod_devicetable.h> 31#include <linux/mod_devicetable.h>
33#include <linux/device.h> /* for struct device */ 32#include <linux/device.h> /* for struct device */
34#include <linux/sched.h> /* for completion */ 33#include <linux/sched.h> /* for completion */
@@ -49,6 +48,8 @@ struct i2c_driver;
49union i2c_smbus_data; 48union i2c_smbus_data;
50struct i2c_board_info; 49struct i2c_board_info;
51 50
51struct module;
52
52#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 53#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
53/* 54/*
54 * The master routines are the ones normally used to transmit data to devices 55 * The master routines are the ones normally used to transmit data to devices
@@ -451,10 +452,9 @@ extern int i2c_add_numbered_adapter(struct i2c_adapter *);
451extern int i2c_register_driver(struct module *, struct i2c_driver *); 452extern int i2c_register_driver(struct module *, struct i2c_driver *);
452extern void i2c_del_driver(struct i2c_driver *); 453extern void i2c_del_driver(struct i2c_driver *);
453 454
454static inline int i2c_add_driver(struct i2c_driver *driver) 455/* use a define to avoid include chaining to get THIS_MODULE */
455{ 456#define i2c_add_driver(driver) \
456 return i2c_register_driver(THIS_MODULE, driver); 457 i2c_register_driver(THIS_MODULE, driver)
457}
458 458
459extern struct i2c_client *i2c_use_client(struct i2c_client *client); 459extern struct i2c_client *i2c_use_client(struct i2c_client *client);
460extern void i2c_release_client(struct i2c_client *client); 460extern void i2c_release_client(struct i2c_client *client);
diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h
index ca85cf894e33..bbd156bb953b 100644
--- a/include/linux/ipmi.h
+++ b/include/linux/ipmi.h
@@ -220,10 +220,11 @@ struct kernel_ipmi_msg {
220 * The in-kernel interface. 220 * The in-kernel interface.
221 */ 221 */
222#include <linux/list.h> 222#include <linux/list.h>
223#include <linux/module.h>
224#include <linux/device.h> 223#include <linux/device.h>
225#include <linux/proc_fs.h> 224#include <linux/proc_fs.h>
226 225
226struct module;
227
227/* Opaque type for a IPMI message user. One of these is needed to 228/* Opaque type for a IPMI message user. One of these is needed to
228 send and receive messages. */ 229 send and receive messages. */
229typedef struct ipmi_user *ipmi_user_t; 230typedef struct ipmi_user *ipmi_user_t;
diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
index 204f9cd26c16..3ef0d8b6aa6f 100644
--- a/include/linux/ipmi_smi.h
+++ b/include/linux/ipmi_smi.h
@@ -36,7 +36,6 @@
36 36
37#include <linux/ipmi_msgdefs.h> 37#include <linux/ipmi_msgdefs.h>
38#include <linux/proc_fs.h> 38#include <linux/proc_fs.h>
39#include <linux/module.h>
40#include <linux/device.h> 39#include <linux/device.h>
41#include <linux/platform_device.h> 40#include <linux/platform_device.h>
42#include <linux/ipmi.h> 41#include <linux/ipmi.h>
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 59e49c80cc2c..bff29c58da23 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -23,13 +23,13 @@
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/topology.h> 24#include <linux/topology.h>
25#include <linux/wait.h> 25#include <linux/wait.h>
26#include <linux/module.h>
27 26
28#include <asm/irq.h> 27#include <asm/irq.h>
29#include <asm/ptrace.h> 28#include <asm/ptrace.h>
30#include <asm/irq_regs.h> 29#include <asm/irq_regs.h>
31 30
32struct seq_file; 31struct seq_file;
32struct module;
33struct irq_desc; 33struct irq_desc;
34struct irq_data; 34struct irq_data;
35typedef void (*irq_flow_handler_t)(unsigned int irq, 35typedef void (*irq_flow_handler_t)(unsigned int irq,
@@ -567,29 +567,21 @@ static inline struct msi_desc *irq_data_get_msi(struct irq_data *d)
567int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node, 567int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node,
568 struct module *owner); 568 struct module *owner);
569 569
570static inline int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, 570/* use macros to avoid needing export.h for THIS_MODULE */
571 int node) 571#define irq_alloc_descs(irq, from, cnt, node) \
572{ 572 __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE)
573 return __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE);
574}
575 573
576void irq_free_descs(unsigned int irq, unsigned int cnt); 574#define irq_alloc_desc(node) \
577int irq_reserve_irqs(unsigned int from, unsigned int cnt); 575 irq_alloc_descs(-1, 0, 1, node)
578 576
579static inline int irq_alloc_desc(int node) 577#define irq_alloc_desc_at(at, node) \
580{ 578 irq_alloc_descs(at, at, 1, node)
581 return irq_alloc_descs(-1, 0, 1, node);
582}
583 579
584static inline int irq_alloc_desc_at(unsigned int at, int node) 580#define irq_alloc_desc_from(from, node) \
585{ 581 irq_alloc_descs(-1, from, 1, node)
586 return irq_alloc_descs(at, at, 1, node);
587}
588 582
589static inline int irq_alloc_desc_from(unsigned int from, int node) 583void irq_free_descs(unsigned int irq, unsigned int cnt);
590{ 584int irq_reserve_irqs(unsigned int from, unsigned int cnt);
591 return irq_alloc_descs(-1, from, 1, node);
592}
593 585
594static inline void irq_free_desc(unsigned int irq) 586static inline void irq_free_desc(unsigned int irq)
595{ 587{
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 6b69c2c9dff1..f1e2527006bd 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -11,6 +11,7 @@
11struct irq_affinity_notify; 11struct irq_affinity_notify;
12struct proc_dir_entry; 12struct proc_dir_entry;
13struct timer_rand_state; 13struct timer_rand_state;
14struct module;
14/** 15/**
15 * struct irq_desc - interrupt descriptor 16 * struct irq_desc - interrupt descriptor
16 * @irq_data: per irq and chip data passed down to chip functions 17 * @irq_data: per irq and chip data passed down to chip functions
diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h
index 8ea9a42a4c02..0fe00cd4c93c 100644
--- a/include/linux/mdio-bitbang.h
+++ b/include/linux/mdio-bitbang.h
@@ -2,7 +2,8 @@
2#define __LINUX_MDIO_BITBANG_H 2#define __LINUX_MDIO_BITBANG_H
3 3
4#include <linux/phy.h> 4#include <linux/phy.h>
5#include <linux/module.h> 5
6struct module;
6 7
7struct mdiobb_ctrl; 8struct mdiobb_ctrl;
8 9
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index c309b1ecdc1c..c41d7270c6c6 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_MISCDEVICE_H 1#ifndef _LINUX_MISCDEVICE_H
2#define _LINUX_MISCDEVICE_H 2#define _LINUX_MISCDEVICE_H
3#include <linux/module.h>
4#include <linux/major.h> 3#include <linux/major.h>
4#include <linux/list.h>
5#include <linux/types.h>
5 6
6/* 7/*
7 * These allocations are managed by device@lanana.org. If you use an 8 * These allocations are managed by device@lanana.org. If you use an
diff --git a/include/linux/module.h b/include/linux/module.h
index 863921637d9f..3cb7839a60b9 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -16,6 +16,7 @@
16#include <linux/kobject.h> 16#include <linux/kobject.h>
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/tracepoint.h> 18#include <linux/tracepoint.h>
19#include <linux/export.h>
19 20
20#include <linux/percpu.h> 21#include <linux/percpu.h>
21#include <asm/module.h> 22#include <asm/module.h>
@@ -25,21 +26,8 @@
25/* Not Yet Implemented */ 26/* Not Yet Implemented */
26#define MODULE_SUPPORTED_DEVICE(name) 27#define MODULE_SUPPORTED_DEVICE(name)
27 28
28/* Some toolchains use a `_' prefix for all user symbols. */
29#ifdef CONFIG_SYMBOL_PREFIX
30#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
31#else
32#define MODULE_SYMBOL_PREFIX ""
33#endif
34
35#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN 29#define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
36 30
37struct kernel_symbol
38{
39 unsigned long value;
40 const char *name;
41};
42
43struct modversion_info 31struct modversion_info
44{ 32{
45 unsigned long crc; 33 unsigned long crc;
@@ -98,11 +86,8 @@ void trim_init_extable(struct module *m);
98extern const struct gtype##_id __mod_##gtype##_table \ 86extern const struct gtype##_id __mod_##gtype##_table \
99 __attribute__ ((unused, alias(__stringify(name)))) 87 __attribute__ ((unused, alias(__stringify(name))))
100 88
101extern struct module __this_module;
102#define THIS_MODULE (&__this_module)
103#else /* !MODULE */ 89#else /* !MODULE */
104#define MODULE_GENERIC_TABLE(gtype,name) 90#define MODULE_GENERIC_TABLE(gtype,name)
105#define THIS_MODULE ((struct module *)0)
106#endif 91#endif
107 92
108/* Generic info of form tag = "info" */ 93/* Generic info of form tag = "info" */
@@ -150,11 +135,6 @@ extern struct module __this_module;
150/* What your module does. */ 135/* What your module does. */
151#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) 136#define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
152 137
153/* One for each parameter, describing how to use it. Some files do
154 multiple of these per line, so can't just use MODULE_INFO. */
155#define MODULE_PARM_DESC(_parm, desc) \
156 __MODULE_INFO(parm, _parm, #_parm ":" desc)
157
158#define MODULE_DEVICE_TABLE(type,name) \ 138#define MODULE_DEVICE_TABLE(type,name) \
159 MODULE_GENERIC_TABLE(type##_device,name) 139 MODULE_GENERIC_TABLE(type##_device,name)
160 140
@@ -218,52 +198,6 @@ struct module_use {
218 struct module *source, *target; 198 struct module *source, *target;
219}; 199};
220 200
221#ifndef __GENKSYMS__
222#ifdef CONFIG_MODVERSIONS
223/* Mark the CRC weak since genksyms apparently decides not to
224 * generate a checksums for some symbols */
225#define __CRC_SYMBOL(sym, sec) \
226 extern void *__crc_##sym __attribute__((weak)); \
227 static const unsigned long __kcrctab_##sym \
228 __used \
229 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
230 = (unsigned long) &__crc_##sym;
231#else
232#define __CRC_SYMBOL(sym, sec)
233#endif
234
235/* For every exported symbol, place a struct in the __ksymtab section */
236#define __EXPORT_SYMBOL(sym, sec) \
237 extern typeof(sym) sym; \
238 __CRC_SYMBOL(sym, sec) \
239 static const char __kstrtab_##sym[] \
240 __attribute__((section("__ksymtab_strings"), aligned(1))) \
241 = MODULE_SYMBOL_PREFIX #sym; \
242 static const struct kernel_symbol __ksymtab_##sym \
243 __used \
244 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
245 = { (unsigned long)&sym, __kstrtab_##sym }
246
247#define EXPORT_SYMBOL(sym) \
248 __EXPORT_SYMBOL(sym, "")
249
250#define EXPORT_SYMBOL_GPL(sym) \
251 __EXPORT_SYMBOL(sym, "_gpl")
252
253#define EXPORT_SYMBOL_GPL_FUTURE(sym) \
254 __EXPORT_SYMBOL(sym, "_gpl_future")
255
256
257#ifdef CONFIG_UNUSED_SYMBOLS
258#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
259#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
260#else
261#define EXPORT_UNUSED_SYMBOL(sym)
262#define EXPORT_UNUSED_SYMBOL_GPL(sym)
263#endif
264
265#endif
266
267enum module_state 201enum module_state
268{ 202{
269 MODULE_STATE_LIVE, 203 MODULE_STATE_LIVE,
@@ -581,11 +515,6 @@ int unregister_module_notifier(struct notifier_block * nb);
581extern void print_modules(void); 515extern void print_modules(void);
582 516
583#else /* !CONFIG_MODULES... */ 517#else /* !CONFIG_MODULES... */
584#define EXPORT_SYMBOL(sym)
585#define EXPORT_SYMBOL_GPL(sym)
586#define EXPORT_SYMBOL_GPL_FUTURE(sym)
587#define EXPORT_UNUSED_SYMBOL(sym)
588#define EXPORT_UNUSED_SYMBOL_GPL(sym)
589 518
590/* Given an address, look for it in the exception tables. */ 519/* Given an address, look for it in the exception tables. */
591static inline const struct exception_table_entry * 520static inline const struct exception_table_entry *
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index fffb10bd5514..7939f636c8ba 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -31,6 +31,11 @@ static const char __module_cat(name,__LINE__)[] \
31#define __MODULE_PARM_TYPE(name, _type) \ 31#define __MODULE_PARM_TYPE(name, _type) \
32 __MODULE_INFO(parmtype, name##type, #name ":" _type) 32 __MODULE_INFO(parmtype, name##type, #name ":" _type)
33 33
34/* One for each parameter, describing how to use it. Some files do
35 multiple of these per line, so can't just use MODULE_INFO. */
36#define MODULE_PARM_DESC(_parm, desc) \
37 __MODULE_INFO(parm, _parm, #_parm ":" desc)
38
34struct kernel_param; 39struct kernel_param;
35 40
36struct kernel_param_ops { 41struct kernel_param_ops {
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 2541fb848daa..37be05bbfbc8 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -21,7 +21,6 @@
21#define __MTD_MTD_H__ 21#define __MTD_MTD_H__
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/module.h>
25#include <linux/uio.h> 24#include <linux/uio.h>
26#include <linux/notifier.h> 25#include <linux/notifier.h>
27#include <linux/device.h> 26#include <linux/device.h>
@@ -125,6 +124,8 @@ struct nand_ecclayout {
125 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE]; 124 struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
126}; 125};
127 126
127struct module; /* only needed for owner field in mtd_info */
128
128struct mtd_info { 129struct mtd_info {
129 u_char type; 130 u_char type;
130 uint32_t flags; 131 uint32_t flags;
diff --git a/include/linux/of.h b/include/linux/of.h
index 0e89aa0bf07a..4948552d60f5 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -23,6 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24 24
25#include <asm/byteorder.h> 25#include <asm/byteorder.h>
26#include <asm/errno.h>
26 27
27typedef u32 phandle; 28typedef u32 phandle;
28typedef u32 ihandle; 29typedef u32 ihandle;
diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h
index 5a6f458a4bb7..040ce2f6e8de 100644
--- a/include/linux/of_platform.h
+++ b/include/linux/of_platform.h
@@ -12,7 +12,6 @@
12 */ 12 */
13 13
14#ifdef CONFIG_OF_DEVICE 14#ifdef CONFIG_OF_DEVICE
15#include <linux/module.h>
16#include <linux/device.h> 15#include <linux/device.h>
17#include <linux/mod_devicetable.h> 16#include <linux/mod_devicetable.h>
18#include <linux/pm.h> 17#include <linux/pm.h>
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 5d09cbafa7db..45fc162cbdc0 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -132,13 +132,9 @@ extern int pci_hp_deregister(struct hotplug_slot *slot);
132extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, 132extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
133 struct hotplug_slot_info *info); 133 struct hotplug_slot_info *info);
134 134
135static inline int pci_hp_register(struct hotplug_slot *slot, 135/* use a define to avoid include chaining to get THIS_MODULE & friends */
136 struct pci_bus *pbus, 136#define pci_hp_register(slot, pbus, devnr, name) \
137 int devnr, const char *name) 137 __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME)
138{
139 return __pci_hp_register(slot, pbus, devnr, name,
140 THIS_MODULE, KBUILD_MODNAME);
141}
142 138
143/* PCI Setting Record (Type 0) */ 139/* PCI Setting Record (Type 0) */
144struct hpp_type0 { 140struct hpp_type0 {
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 70b284024d9e..d8d903619642 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -10,6 +10,7 @@
10#define _LINUX_PM_RUNTIME_H 10#define _LINUX_PM_RUNTIME_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/notifier.h>
13#include <linux/pm.h> 14#include <linux/pm.h>
14 15
15#include <linux/jiffies.h> 16#include <linux/jiffies.h>
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index 3daac2d8dc37..690276a642cf 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -15,8 +15,8 @@
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/module.h>
19 18
19struct module;
20struct i2c_client; 20struct i2c_client;
21struct spi_device; 21struct spi_device;
22 22
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 12a1aa04b720..52c89ae32f64 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -16,6 +16,7 @@
16#define __LINUX_REGULATOR_DRIVER_H_ 16#define __LINUX_REGULATOR_DRIVER_H_
17 17
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/notifier.h>
19#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
20 21
21struct regulator_dev; 22struct regulator_dev;
diff --git a/include/linux/serio.h b/include/linux/serio.h
index be7dfb0f12d0..ca82861b0e46 100644
--- a/include/linux/serio.h
+++ b/include/linux/serio.h
@@ -79,19 +79,21 @@ void serio_reconnect(struct serio *serio);
79irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags); 79irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags);
80 80
81void __serio_register_port(struct serio *serio, struct module *owner); 81void __serio_register_port(struct serio *serio, struct module *owner);
82static inline void serio_register_port(struct serio *serio) 82
83{ 83/* use a define to avoid include chaining to get THIS_MODULE */
84 __serio_register_port(serio, THIS_MODULE); 84#define serio_register_port(serio) \
85} 85 __serio_register_port(serio, THIS_MODULE)
86 86
87void serio_unregister_port(struct serio *serio); 87void serio_unregister_port(struct serio *serio);
88void serio_unregister_child_port(struct serio *serio); 88void serio_unregister_child_port(struct serio *serio);
89 89
90int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); 90int __must_check __serio_register_driver(struct serio_driver *drv,
91static inline int __must_check serio_register_driver(struct serio_driver *drv) 91 struct module *owner, const char *mod_name);
92{ 92
93 return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); 93/* use a define to avoid include chaining to get THIS_MODULE & friends */
94} 94#define serio_register_driver(drv) \
95 __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
96
95void serio_unregister_driver(struct serio_driver *drv); 97void serio_unregister_driver(struct serio_driver *drv);
96 98
97static inline int serio_write(struct serio *serio, unsigned char data) 99static inline int serio_write(struct serio *serio, unsigned char data)
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index f10ed7b4a714..061e560251b4 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -231,10 +231,9 @@ struct ssb_driver {
231#define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) 231#define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv)
232 232
233extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); 233extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner);
234static inline int ssb_driver_register(struct ssb_driver *drv) 234#define ssb_driver_register(drv) \
235{ 235 __ssb_driver_register(drv, THIS_MODULE)
236 return __ssb_driver_register(drv, THIS_MODULE); 236
237}
238extern void ssb_driver_unregister(struct ssb_driver *drv); 237extern void ssb_driver_unregister(struct ssb_driver *drv);
239 238
240 239
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 2d04ea916760..c170edc3bf5f 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/cpu.h> 4#include <linux/cpu.h>
5#include <linux/cpumask.h> 5#include <linux/cpumask.h>
6#include <linux/smp.h>
6#include <linux/list.h> 7#include <linux/list.h>
7#include <asm/system.h> 8#include <asm/system.h>
8 9
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index 7ad9751a0d87..8620f79658d4 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -8,7 +8,8 @@
8#define SUNRPC_SVC_XPRT_H 8#define SUNRPC_SVC_XPRT_H
9 9
10#include <linux/sunrpc/svc.h> 10#include <linux/sunrpc/svc.h>
11#include <linux/module.h> 11
12struct module;
12 13
13struct svc_xprt_ops { 14struct svc_xprt_ops {
14 struct svc_xprt *(*xpo_create)(struct svc_serv *, 15 struct svc_xprt *(*xpo_create)(struct svc_serv *,
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index d35e783a598c..20f63d3e6144 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -22,7 +22,6 @@
22#define _SYSDEV_H_ 22#define _SYSDEV_H_
23 23
24#include <linux/kobject.h> 24#include <linux/kobject.h>
25#include <linux/module.h>
26#include <linux/pm.h> 25#include <linux/pm.h>
27 26
28 27
diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h
index d9a85d616385..cfaee869146f 100644
--- a/include/linux/textsearch.h
+++ b/include/linux/textsearch.h
@@ -4,10 +4,11 @@
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/list.h> 5#include <linux/list.h>
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/err.h> 7#include <linux/err.h>
9#include <linux/slab.h> 8#include <linux/slab.h>
10 9
10struct module;
11
11struct ts_config; 12struct ts_config;
12 13
13#define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */ 14#define TS_AUTOLOAD 1 /* Automatically load textsearch modules when needed */
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
index fd99ff9298c6..1ad4724458de 100644
--- a/include/linux/uio_driver.h
+++ b/include/linux/uio_driver.h
@@ -14,10 +14,10 @@
14#ifndef _UIO_DRIVER_H_ 14#ifndef _UIO_DRIVER_H_
15#define _UIO_DRIVER_H_ 15#define _UIO_DRIVER_H_
16 16
17#include <linux/module.h>
18#include <linux/fs.h> 17#include <linux/fs.h>
19#include <linux/interrupt.h> 18#include <linux/interrupt.h>
20 19
20struct module;
21struct uio_map; 21struct uio_map;
22 22
23/** 23/**
@@ -101,11 +101,11 @@ extern int __must_check
101 __uio_register_device(struct module *owner, 101 __uio_register_device(struct module *owner,
102 struct device *parent, 102 struct device *parent,
103 struct uio_info *info); 103 struct uio_info *info);
104static inline int __must_check 104
105 uio_register_device(struct device *parent, struct uio_info *info) 105/* use a define to avoid include chaining to get THIS_MODULE */
106{ 106#define uio_register_device(parent, info) \
107 return __uio_register_device(THIS_MODULE, parent, info); 107 __uio_register_device(THIS_MODULE, parent, info)
108} 108
109extern void uio_unregister_device(struct uio_info *info); 109extern void uio_unregister_device(struct uio_info *info);
110extern void uio_event_notify(struct uio_info *info); 110extern void uio_event_notify(struct uio_info *info);
111 111
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 6f49a1b39fa6..d3d0c1374334 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -946,10 +946,11 @@ struct usb_class_driver {
946 */ 946 */
947extern int usb_register_driver(struct usb_driver *, struct module *, 947extern int usb_register_driver(struct usb_driver *, struct module *,
948 const char *); 948 const char *);
949static inline int usb_register(struct usb_driver *driver) 949
950{ 950/* use a define to avoid include chaining to get THIS_MODULE & friends */
951 return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); 951#define usb_register(driver) \
952} 952 usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME)
953
953extern void usb_deregister(struct usb_driver *); 954extern void usb_deregister(struct usb_driver *);
954 955
955extern int usb_register_device_driver(struct usb_device_driver *, 956extern int usb_register_device_driver(struct usb_device_driver *,
diff --git a/include/linux/uwb.h b/include/linux/uwb.h
index b0c564ec2160..7dbbee9741b7 100644
--- a/include/linux/uwb.h
+++ b/include/linux/uwb.h
@@ -33,6 +33,7 @@
33#include <linux/wait.h> 33#include <linux/wait.h>
34#include <linux/workqueue.h> 34#include <linux/workqueue.h>
35#include <linux/uwb/spec.h> 35#include <linux/uwb/spec.h>
36#include <asm/page.h>
36 37
37struct uwb_dev; 38struct uwb_dev;
38struct uwb_beca_e; 39struct uwb_beca_e;
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index 7b4842028ca7..891d1d5f3947 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -111,10 +111,9 @@ int __must_check __umc_driver_register(struct umc_driver *umc_drv,
111 * umc_driver_register - register a UMC capabiltity driver. 111 * umc_driver_register - register a UMC capabiltity driver.
112 * @umc_drv: pointer to the driver. 112 * @umc_drv: pointer to the driver.
113 */ 113 */
114static inline int __must_check umc_driver_register(struct umc_driver *umc_drv) 114#define umc_driver_register(umc_drv) \
115{ 115 __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME)
116 return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME); 116
117}
118void umc_driver_unregister(struct umc_driver *umc_drv); 117void umc_driver_unregister(struct umc_driver *umc_drv);
119 118
120/* 119/*
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h
index cf97b5b9d1fe..6f8fbcf10dfb 100644
--- a/include/linux/vermagic.h
+++ b/include/linux/vermagic.h
@@ -1,5 +1,4 @@
1#include <generated/utsrelease.h> 1#include <generated/utsrelease.h>
2#include <linux/module.h>
3 2
4/* Simply sanity version stamp for modules. */ 3/* Simply sanity version stamp for modules. */
5#ifdef CONFIG_SMP 4#ifdef CONFIG_SMP
diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h
index 8f6a95882b09..017d4a53d55e 100644
--- a/include/linux/vlynq.h
+++ b/include/linux/vlynq.h
@@ -20,9 +20,10 @@
20#define __VLYNQ_H__ 20#define __VLYNQ_H__
21 21
22#include <linux/device.h> 22#include <linux/device.h>
23#include <linux/module.h>
24#include <linux/types.h> 23#include <linux/types.h>
25 24
25struct module;
26
26#define VLYNQ_NUM_IRQS 32 27#define VLYNQ_NUM_IRQS 32
27 28
28struct vlynq_mapping { 29struct vlynq_mapping {
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index 5017500eda1b..0f037e8edf9a 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -1,7 +1,6 @@
1#ifndef __SAA7146__ 1#ifndef __SAA7146__
2#define __SAA7146__ 2#define __SAA7146__
3 3
4#include <linux/module.h> /* for module-version */
5#include <linux/delay.h> /* for delay-stuff */ 4#include <linux/delay.h> /* for delay-stuff */
6#include <linux/slab.h> /* for kmalloc/kfree */ 5#include <linux/slab.h> /* for kmalloc/kfree */
7#include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */ 6#include <linux/pci.h> /* for pci-config-stuff, vendor ids etc. */
@@ -55,6 +54,8 @@ do { \
55#define SAA7146_ISR_CLEAR(x,y) \ 54#define SAA7146_ISR_CLEAR(x,y) \
56 saa7146_write(x, ISR, (y)); 55 saa7146_write(x, ISR, (y));
57 56
57struct module;
58
58struct saa7146_dev; 59struct saa7146_dev;
59struct saa7146_extension; 60struct saa7146_extension;
60struct saa7146_vv; 61struct saa7146_vv;
diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index fbf585561570..e6aa2318367b 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -25,7 +25,6 @@
25#ifndef V4L2_INT_DEVICE_H 25#ifndef V4L2_INT_DEVICE_H
26#define V4L2_INT_DEVICE_H 26#define V4L2_INT_DEVICE_H
27 27
28#include <linux/module.h>
29#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
30 29
31#define V4L2NAMESIZE 32 30#define V4L2NAMESIZE 32
@@ -41,6 +40,8 @@ enum v4l2_int_type {
41 v4l2_int_type_slave 40 v4l2_int_type_slave
42}; 41};
43 42
43struct module;
44
44struct v4l2_int_device; 45struct v4l2_int_device;
45 46
46struct v4l2_int_master { 47struct v4l2_int_master {
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 5b924423cf20..3779ea362257 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -513,11 +513,15 @@ static inline void __hci_dev_put(struct hci_dev *d)
513 d->destruct(d); 513 d->destruct(d);
514} 514}
515 515
516static inline void hci_dev_put(struct hci_dev *d) 516/*
517{ 517 * hci_dev_put and hci_dev_hold are macros to avoid dragging all the
518 __hci_dev_put(d); 518 * overhead of all the modular infrastructure into this header.
519 module_put(d->owner); 519 */
520} 520#define hci_dev_put(d) \
521do { \
522 __hci_dev_put(d); \
523 module_put(d->owner); \
524} while (0)
521 525
522static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) 526static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
523{ 527{
@@ -525,12 +529,10 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d)
525 return d; 529 return d;
526} 530}
527 531
528static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) 532#define hci_dev_hold(d) \
529{ 533({ \
530 if (try_module_get(d->owner)) 534 try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \
531 return __hci_dev_hold(d); 535})
532 return NULL;
533}
534 536
535#define hci_dev_lock(d) spin_lock(&d->lock) 537#define hci_dev_lock(d) spin_lock(&d->lock)
536#define hci_dev_unlock(d) spin_unlock(&d->lock) 538#define hci_dev_unlock(d) spin_unlock(&d->lock)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f91a1fb5da7c..e8c25b981205 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -18,7 +18,6 @@
18 18
19#include <linux/kmemcheck.h> 19#include <linux/kmemcheck.h>
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/module.h>
22#include <linux/timer.h> 21#include <linux/timer.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/workqueue.h> 23#include <linux/workqueue.h>
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 05b08c926ade..873d5be7926c 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -1126,17 +1126,16 @@ int unregister_ip_vs_pe(struct ip_vs_pe *pe);
1126struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); 1126struct ip_vs_pe *ip_vs_pe_getbyname(const char *name);
1127struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); 1127struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1128 1128
1129static inline void ip_vs_pe_get(const struct ip_vs_pe *pe) 1129/*
1130{ 1130 * Use a #define to avoid all of module.h just for these trivial ops
1131 if (pe && pe->module) 1131 */
1132#define ip_vs_pe_get(pe) \
1133 if (pe && pe->module) \
1132 __module_get(pe->module); 1134 __module_get(pe->module);
1133}
1134 1135
1135static inline void ip_vs_pe_put(const struct ip_vs_pe *pe) 1136#define ip_vs_pe_put(pe) \
1136{ 1137 if (pe && pe->module) \
1137 if (pe && pe->module)
1138 module_put(pe->module); 1138 module_put(pe->module);
1139}
1140 1139
1141/* 1140/*
1142 * IPVS protocol functions (from ip_vs_proto.c) 1141 * IPVS protocol functions (from ip_vs_proto.c)
diff --git a/include/net/lib80211.h b/include/net/lib80211.h
index 2ec896bb72b2..d178c26a5558 100644
--- a/include/net/lib80211.h
+++ b/include/net/lib80211.h
@@ -25,7 +25,6 @@
25 25
26#include <linux/types.h> 26#include <linux/types.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/module.h>
29#include <linux/atomic.h> 28#include <linux/atomic.h>
30#include <linux/if.h> 29#include <linux/if.h>
31#include <linux/skbuff.h> 30#include <linux/skbuff.h>
@@ -42,6 +41,8 @@ enum {
42 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), 41 IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
43}; 42};
44 43
44struct module;
45
45struct lib80211_crypto_ops { 46struct lib80211_crypto_ops {
46 const char *name; 47 const char *name;
47 struct list_head list; 48 struct list_head list;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0b7f05e4a927..8a2b0ae7dbd2 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -313,6 +313,8 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
313 return skb->dev && skb->skb_iif && skb->dev->flags & IFF_LOOPBACK; 313 return skb->dev && skb->skb_iif && skb->dev->flags & IFF_LOOPBACK;
314} 314}
315 315
316struct kernel_param;
317
316extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 318extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
317extern unsigned int nf_conntrack_htable_size; 319extern unsigned int nf_conntrack_htable_size;
318extern unsigned int nf_conntrack_max; 320extern unsigned int nf_conntrack_max;
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 2eb207ea4eaf..f6bb08b73ca4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -4,7 +4,6 @@
4#include <linux/netdevice.h> 4#include <linux/netdevice.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
7#include <linux/module.h>
8#include <linux/pkt_sched.h> 7#include <linux/pkt_sched.h>
9#include <linux/pkt_cls.h> 8#include <linux/pkt_cls.h>
10#include <net/gen_stats.h> 9#include <net/gen_stats.h>
diff --git a/include/net/sock.h b/include/net/sock.h
index c6658bef7f32..abb6e0f0c3c3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -46,7 +46,6 @@
46#include <linux/list_nulls.h> 46#include <linux/list_nulls.h>
47#include <linux/timer.h> 47#include <linux/timer.h>
48#include <linux/cache.h> 48#include <linux/cache.h>
49#include <linux/module.h>
50#include <linux/lockdep.h> 49#include <linux/lockdep.h>
51#include <linux/netdevice.h> 50#include <linux/netdevice.h>
52#include <linux/skbuff.h> /* struct sk_buff */ 51#include <linux/skbuff.h> /* struct sk_buff */
@@ -729,6 +728,7 @@ struct request_sock_ops;
729struct timewait_sock_ops; 728struct timewait_sock_ops;
730struct inet_hashinfo; 729struct inet_hashinfo;
731struct raw_hashinfo; 730struct raw_hashinfo;
731struct module;
732 732
733/* Networking protocol blocks we attach to sockets. 733/* Networking protocol blocks we attach to sockets.
734 * socket layer -> transport layer interface 734 * socket layer -> transport layer interface
diff --git a/include/sound/core.h b/include/sound/core.h
index 91d513879a78..3be5ab782b99 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/module.h>
26#include <linux/sched.h> /* wake_up() */ 25#include <linux/sched.h> /* wake_up() */
27#include <linux/mutex.h> /* struct mutex */ 26#include <linux/mutex.h> /* struct mutex */
28#include <linux/rwsem.h> /* struct rw_semaphore */ 27#include <linux/rwsem.h> /* struct rw_semaphore */
@@ -43,6 +42,7 @@
43#ifdef CONFIG_PCI 42#ifdef CONFIG_PCI
44struct pci_dev; 43struct pci_dev;
45#endif 44#endif
45struct module;
46 46
47/* device allocation stuff */ 47/* device allocation stuff */
48 48
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index da39b22636f7..b0b4eb24d592 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -21,16 +21,6 @@
21#undef CREATE_TRACE_POINTS 21#undef CREATE_TRACE_POINTS
22 22
23#include <linux/stringify.h> 23#include <linux/stringify.h>
24/*
25 * module.h includes tracepoints, and because ftrace.h
26 * pulls in module.h:
27 * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h ->
28 * linux/ftrace.h -> linux/module.h
29 * we must include module.h here before we play with any of
30 * the TRACE_EVENT() macros, otherwise the tracepoints included
31 * by module.h may break the build.
32 */
33#include <linux/module.h>
34 24
35#undef TRACE_EVENT 25#undef TRACE_EVENT
36#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ 26#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 21a546d27c0c..161932737416 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * Because linux/module.h has tracepoints in the header, and ftrace.h 2 * Because linux/module.h has tracepoints in the header, and ftrace.h
3 * eventually includes this file, define_trace.h includes linux/module.h 3 * used to include this file, define_trace.h includes linux/module.h
4 * But we do not want the module.h to override the TRACE_SYSTEM macro 4 * But we do not want the module.h to override the TRACE_SYSTEM macro
5 * variable that define_trace.h is processing, so we only set it 5 * variable that define_trace.h is processing, so we only set it
6 * when module events are being processed, which would happen when 6 * when module events are being processed, which would happen when
diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h
index b9f9fb5af0d8..b1b6676c1c43 100644
--- a/include/xen/xenbus.h
+++ b/include/xen/xenbus.h
@@ -37,6 +37,7 @@
37#include <linux/device.h> 37#include <linux/device.h>
38#include <linux/notifier.h> 38#include <linux/notifier.h>
39#include <linux/mutex.h> 39#include <linux/mutex.h>
40#include <linux/export.h>
40#include <linux/completion.h> 41#include <linux/completion.h>
41#include <linux/init.h> 42#include <linux/init.h>
42#include <linux/slab.h> 43#include <linux/slab.h>