]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
include: replace linux/module.h with "struct module" wherever possible
authorPaul Gortmaker <paul.gortmaker@windriver.com>
Thu, 26 May 2011 17:46:22 +0000 (13:46 -0400)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Mon, 31 Oct 2011 23:32:32 +0000 (19:32 -0400)
The <linux/module.h> pretty much brings in the kitchen sink along
with it, so it should be avoided wherever reasonably possible in
terms of being included from other commonly used <linux/something.h>
files, as it results in a measureable increase on compile times.

The worst culprit was probably device.h since it is used everywhere.
This file also had an implicit dependency/usage of mutex.h which was
masked by module.h, and is also fixed here at the same time.

There are over a dozen other headers that simply declare the
struct instead of pulling in the whole file, so follow their lead
and simply make it a few more.

Most of the implicit dependencies on module.h being present by
these headers pulling it in have been now weeded out, so we can
finally make this change with hopefully minimal breakage.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
22 files changed:
include/drm/drmP.h
include/linux/blkdev.h
include/linux/cpuidle.h
include/linux/device.h
include/linux/firmware.h
include/linux/ftrace.h
include/linux/i2c.h
include/linux/ipmi.h
include/linux/ipmi_smi.h
include/linux/mdio-bitbang.h
include/linux/mtd/mtd.h
include/linux/regmap.h
include/linux/sunrpc/svc_xprt.h
include/linux/textsearch.h
include/linux/uio_driver.h
include/linux/vlynq.h
include/media/saa7146.h
include/media/v4l2-int-device.h
include/net/lib80211.h
include/net/sock.h
include/sound/core.h
include/trace/events/module.h

index 43538b64356032a19d3ac62bc69a85b49c48b72a..6bb4e629c09c038e3e8258b4bffecb1fa06f1cbd 100644 (file)
@@ -42,7 +42,6 @@
  * can build the DRM (part of PI DRI). 4/21/2000 S + B */
 #include <asm/current.h>
 #endif                         /* __alpha__ */
-#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
@@ -80,6 +79,8 @@
 #define __OS_HAS_AGP (defined(CONFIG_AGP) || (defined(CONFIG_AGP_MODULE) && defined(MODULE)))
 #define __OS_HAS_MTRR (defined(CONFIG_MTRR))
 
+struct module;
+
 struct drm_file;
 struct drm_device;
 
index 7fbaa9103344a261082afd872127f736abdcd56f..d750a3a79299e567efec8f98dbf18bcb832e6ed4 100644 (file)
@@ -14,7 +14,6 @@
 #include <linux/wait.h>
 #include <linux/mempool.h>
 #include <linux/bio.h>
-#include <linux/module.h>
 #include <linux/stringify.h>
 #include <linux/gfp.h>
 #include <linux/bsg.h>
@@ -22,6 +21,7 @@
 
 #include <asm/scatterlist.h>
 
+struct module;
 struct scsi_ioctl_command;
 
 struct request_queue;
index b51629e15cfcfee56982da848cfc8b47c77be18c..583baf22cad20a6082b688d079dd24dd8aa3aa18 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <linux/percpu.h>
 #include <linux/list.h>
-#include <linux/module.h>
 #include <linux/kobject.h>
 #include <linux/completion.h>
 
@@ -21,6 +20,8 @@
 #define CPUIDLE_NAME_LEN       16
 #define CPUIDLE_DESC_LEN       32
 
+struct module;
+
 struct cpuidle_device;
 
 
index 61f29f6a403d03f144218c9512dc7dd09299ea27..8ff7dc801fd518544e1da601364ae3d18422503c 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/lockdep.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
-#include <linux/module.h>
+#include <linux/mutex.h>
 #include <linux/pm.h>
 #include <linux/atomic.h>
 #include <asm/device.h>
@@ -29,6 +29,7 @@ struct device;
 struct device_private;
 struct device_driver;
 struct driver_private;
+struct module;
 struct class;
 struct subsys_private;
 struct bus_type;
index 21b3e7588abd32e29b482b2ce4797b2a808e27b4..1e7c01189fa698980e4ae1bbb1dbaa75ac8fbafa 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _LINUX_FIRMWARE_H
 #define _LINUX_FIRMWARE_H
 
-#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/gfp.h>
@@ -15,6 +14,7 @@ struct firmware {
        struct page **pages;
 };
 
+struct module;
 struct device;
 
 struct builtin_fw {
index f0c0e8a47ae61f67ed0bbf5b3f723acfdc5df435..26eafcef75be715b0e59d29429bc3a680c6b9bc0 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/kallsyms.h>
 #include <linux/linkage.h>
 #include <linux/bitops.h>
-#include <linux/module.h>
 #include <linux/ktime.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -19,6 +18,7 @@
 
 #include <asm/ftrace.h>
 
+struct module;
 struct ftrace_hash;
 
 #ifdef CONFIG_FUNCTION_TRACER
index 1be303bfc254637d70878d54d9f80aaa8b564277..a81bf6d23b3e6ad62333696032e0b49317115667 100644 (file)
@@ -28,7 +28,6 @@
 
 #include <linux/types.h>
 #ifdef __KERNEL__
-#include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/device.h>      /* for struct device */
 #include <linux/sched.h>       /* for completion */
@@ -49,6 +48,8 @@ struct i2c_driver;
 union i2c_smbus_data;
 struct i2c_board_info;
 
+struct module;
+
 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
 /*
  * The master routines are the ones normally used to transmit data to devices
index ca85cf894e33fb4a89653aebcf8c10642a346a8e..bbd156bb953b8773b1f727898d9889612ac91bc1 100644 (file)
@@ -220,10 +220,11 @@ struct kernel_ipmi_msg {
  * The in-kernel interface.
  */
 #include <linux/list.h>
-#include <linux/module.h>
 #include <linux/device.h>
 #include <linux/proc_fs.h>
 
+struct module;
+
 /* Opaque type for a IPMI message user.  One of these is needed to
    send and receive messages. */
 typedef struct ipmi_user *ipmi_user_t;
index 204f9cd26c16012126206106f5d36be3c0af21cf..3ef0d8b6aa6faf19c8e8d24a3033f15fc728a39b 100644 (file)
@@ -36,7 +36,6 @@
 
 #include <linux/ipmi_msgdefs.h>
 #include <linux/proc_fs.h>
-#include <linux/module.h>
 #include <linux/device.h>
 #include <linux/platform_device.h>
 #include <linux/ipmi.h>
index 8ea9a42a4c02c6702f562fd46e60137f5e4f7a0a..0fe00cd4c93ca3b26fb8841b6becfd8ef10a02cd 100644 (file)
@@ -2,7 +2,8 @@
 #define __LINUX_MDIO_BITBANG_H
 
 #include <linux/phy.h>
-#include <linux/module.h>
+
+struct module;
 
 struct mdiobb_ctrl;
 
index 2541fb848daa7c2108c7ff74e27a44d146731642..37be05bbfbc87a84cf405e762d1c17cfd9f107ff 100644 (file)
@@ -21,7 +21,6 @@
 #define __MTD_MTD_H__
 
 #include <linux/types.h>
-#include <linux/module.h>
 #include <linux/uio.h>
 #include <linux/notifier.h>
 #include <linux/device.h>
@@ -125,6 +124,8 @@ struct nand_ecclayout {
        struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE];
 };
 
+struct module; /* only needed for owner field in mtd_info */
+
 struct mtd_info {
        u_char type;
        uint32_t flags;
index 3daac2d8dc37c427bd49d173fe1e0b2d645bed2b..690276a642cf75dd5dbfcd1d620b8a94880714fc 100644 (file)
@@ -15,8 +15,8 @@
 
 #include <linux/device.h>
 #include <linux/list.h>
-#include <linux/module.h>
 
+struct module;
 struct i2c_client;
 struct spi_device;
 
index 7ad9751a0d8796e677fb2fdfd50cc4854bcf0eb7..8620f79658d42e593e313124b189d22c1cde7a42 100644 (file)
@@ -8,7 +8,8 @@
 #define SUNRPC_SVC_XPRT_H
 
 #include <linux/sunrpc/svc.h>
-#include <linux/module.h>
+
+struct module;
 
 struct svc_xprt_ops {
        struct svc_xprt *(*xpo_create)(struct svc_serv *,
index d9a85d616385d3791c198fbd223a9b7cf222c30d..cfaee869146f6ec6f877681f9b041171ef238806 100644 (file)
@@ -4,10 +4,11 @@
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 
+struct module;
+
 struct ts_config;
 
 #define TS_AUTOLOAD    1 /* Automatically load textsearch modules when needed */
index 73898189a97c988a9bc3e8cd8466a686abc1f550..1ad4724458de0127424795eede13c63ef344476f 100644 (file)
 #ifndef _UIO_DRIVER_H_
 #define _UIO_DRIVER_H_
 
-#include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 
+struct module;
 struct uio_map;
 
 /**
index 8f6a95882b093f1e792b59db7ec164de626a2fe3..017d4a53d55ef9c7158c5cdaa6c199f4136b3975 100644 (file)
 #define __VLYNQ_H__
 
 #include <linux/device.h>
-#include <linux/module.h>
 #include <linux/types.h>
 
+struct module;
+
 #define VLYNQ_NUM_IRQS 32
 
 struct vlynq_mapping {
index 79827143d5acd925510f3ad7a4de2f912c49ff48..6e84cde44b82c5441be950711d9ad3061edf308c 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __SAA7146__
 #define __SAA7146__
 
-#include <linux/module.h>      /* for module-version */
 #include <linux/delay.h>       /* for delay-stuff */
 #include <linux/slab.h>                /* for kmalloc/kfree */
 #include <linux/pci.h>         /* for pci-config-stuff, vendor ids etc. */
@@ -47,6 +46,8 @@ extern unsigned int saa7146_debug;
 #define SAA7146_ISR_CLEAR(x,y) \
        saa7146_write(x, ISR, (y));
 
+struct module;
+
 struct saa7146_dev;
 struct saa7146_extension;
 struct saa7146_vv;
index fbf585561570bc7fbc43859fd9aa70a4bfdc68f6..e6aa2318367baa39bff7c260b828cfab15c4d8ac 100644 (file)
@@ -25,7 +25,6 @@
 #ifndef V4L2_INT_DEVICE_H
 #define V4L2_INT_DEVICE_H
 
-#include <linux/module.h>
 #include <media/v4l2-common.h>
 
 #define V4L2NAMESIZE 32
@@ -41,6 +40,8 @@ enum v4l2_int_type {
        v4l2_int_type_slave
 };
 
+struct module;
+
 struct v4l2_int_device;
 
 struct v4l2_int_master {
index 2ec896bb72b21787962fb1546b4565b930e503da..d178c26a55588743dbfa9509d1712935b70e3f9b 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <linux/types.h>
 #include <linux/list.h>
-#include <linux/module.h>
 #include <linux/atomic.h>
 #include <linux/if.h>
 #include <linux/skbuff.h>
@@ -42,6 +41,8 @@ enum {
        IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0),
 };
 
+struct module;
+
 struct lib80211_crypto_ops {
        const char *name;
        struct list_head list;
index 5ac682f73d6389ab4fe4977fb183ab13044929b1..beb1a911acbbc3d07cd3b93799fcf3201d25d70e 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/list_nulls.h>
 #include <linux/timer.h>
 #include <linux/cache.h>
-#include <linux/module.h>
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>      /* struct sk_buff */
@@ -729,6 +728,7 @@ struct request_sock_ops;
 struct timewait_sock_ops;
 struct inet_hashinfo;
 struct raw_hashinfo;
+struct module;
 
 /* Networking protocol blocks we attach to sockets.
  * socket layer -> transport layer interface
index 1fa2407c966fdc5240d9853395fd22af6f435724..a91d78eb2f07afaa51eb62dc58d116b710fa12af 100644 (file)
@@ -22,7 +22,6 @@
  *
  */
 
-#include <linux/module.h>
 #include <linux/sched.h>               /* wake_up() */
 #include <linux/mutex.h>               /* struct mutex */
 #include <linux/rwsem.h>               /* struct rw_semaphore */
@@ -43,6 +42,7 @@
 #ifdef CONFIG_PCI
 struct pci_dev;
 #endif
+struct module;
 
 /* device allocation stuff */
 
index 21a546d27c0c499e371852b1023be7c67a160140..1619327374164909b6f8aaea6a730b0821ec6ee2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Because linux/module.h has tracepoints in the header, and ftrace.h
- * eventually includes this file, define_trace.h includes linux/module.h
+ * used to include this file, define_trace.h includes linux/module.h
  * But we do not want the module.h to override the TRACE_SYSTEM macro
  * variable that define_trace.h is processing, so we only set it
  * when module events are being processed, which would happen when