From 4ec65b8dbcc3e27c191c9bd83062ca101dc806bd Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 13:36:45 -0400 Subject: net: inet_timewait_sock doesnt need There is nothing module specific in this header, and removing it doesn't seem to uncover any implicit dependencies either. Must be simply a vestige of an ancient legacy. Signed-off-by: Paul Gortmaker --- include/net/inet_timewait_sock.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net') diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 180231c5bbb..d9bf9806ea4 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h @@ -18,7 +18,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From 39aa9fddb984fcc61592d3eb88e345e315359161 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 13:38:59 -0400 Subject: net: sch_generic remove redundant use of This file has modular references, but they are limited to those which are covered by the simple "struct module;" declaration used in dozens of other places. In fact that declaration is already there (just outside of the context of this commit) so simply remove the include line. Signed-off-by: Paul Gortmaker --- include/net/sch_generic.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net') diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 2eb207ea4ea..f6bb08b73ca 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From de47725421ad5627a5c905f4e40bb844ebc06d29 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 13:46:22 -0400 Subject: include: replace linux/module.h with "struct module" wherever possible The 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 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 --- include/drm/drmP.h | 3 ++- include/linux/blkdev.h | 2 +- include/linux/cpuidle.h | 3 ++- include/linux/device.h | 3 ++- include/linux/firmware.h | 2 +- include/linux/ftrace.h | 2 +- include/linux/i2c.h | 3 ++- include/linux/ipmi.h | 3 ++- include/linux/ipmi_smi.h | 1 - include/linux/mdio-bitbang.h | 3 ++- include/linux/mtd/mtd.h | 3 ++- include/linux/regmap.h | 2 +- include/linux/sunrpc/svc_xprt.h | 3 ++- include/linux/textsearch.h | 3 ++- include/linux/uio_driver.h | 2 +- include/linux/vlynq.h | 3 ++- include/media/saa7146.h | 3 ++- include/media/v4l2-int-device.h | 3 ++- include/net/lib80211.h | 3 ++- include/net/sock.h | 2 +- include/sound/core.h | 2 +- include/trace/events/module.h | 2 +- 22 files changed, 34 insertions(+), 22 deletions(-) (limited to 'include/net') diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 43538b64356..6bb4e629c09 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -42,7 +42,6 @@ * can build the DRM (part of PI DRI). 4/21/2000 S + B */ #include #endif /* __alpha__ */ -#include #include #include #include @@ -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; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 7fbaa910334..d750a3a7929 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -22,6 +21,7 @@ #include +struct module; struct scsi_ioctl_command; struct request_queue; diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index b51629e15cf..583baf22cad 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -13,7 +13,6 @@ #include #include -#include #include #include @@ -21,6 +20,8 @@ #define CPUIDLE_NAME_LEN 16 #define CPUIDLE_DESC_LEN 32 +struct module; + struct cpuidle_device; diff --git a/include/linux/device.h b/include/linux/device.h index 61f29f6a403..8ff7dc801fd 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -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; diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 21b3e7588ab..1e7c01189fa 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -1,7 +1,6 @@ #ifndef _LINUX_FIRMWARE_H #define _LINUX_FIRMWARE_H -#include #include #include #include @@ -15,6 +14,7 @@ struct firmware { struct page **pages; }; +struct module; struct device; struct builtin_fw { diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index f0c0e8a47ae..26eafcef75b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -19,6 +18,7 @@ #include +struct module; struct ftrace_hash; #ifdef CONFIG_FUNCTION_TRACER diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 1be303bfc25..a81bf6d23b3 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -28,7 +28,6 @@ #include #ifdef __KERNEL__ -#include #include #include /* for struct device */ #include /* 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 diff --git a/include/linux/ipmi.h b/include/linux/ipmi.h index ca85cf894e3..bbd156bb953 100644 --- a/include/linux/ipmi.h +++ b/include/linux/ipmi.h @@ -220,10 +220,11 @@ struct kernel_ipmi_msg { * The in-kernel interface. */ #include -#include #include #include +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; diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 204f9cd26c1..3ef0d8b6aa6 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -36,7 +36,6 @@ #include #include -#include #include #include #include diff --git a/include/linux/mdio-bitbang.h b/include/linux/mdio-bitbang.h index 8ea9a42a4c0..0fe00cd4c93 100644 --- a/include/linux/mdio-bitbang.h +++ b/include/linux/mdio-bitbang.h @@ -2,7 +2,8 @@ #define __LINUX_MDIO_BITBANG_H #include -#include + +struct module; struct mdiobb_ctrl; diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 2541fb848da..37be05bbfbc 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -21,7 +21,6 @@ #define __MTD_MTD_H__ #include -#include #include #include #include @@ -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; diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 3daac2d8dc3..690276a642c 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -15,8 +15,8 @@ #include #include -#include +struct module; struct i2c_client; struct spi_device; diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 7ad9751a0d8..8620f79658d 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h @@ -8,7 +8,8 @@ #define SUNRPC_SVC_XPRT_H #include -#include + +struct module; struct svc_xprt_ops { struct svc_xprt *(*xpo_create)(struct svc_serv *, diff --git a/include/linux/textsearch.h b/include/linux/textsearch.h index d9a85d61638..cfaee869146 100644 --- a/include/linux/textsearch.h +++ b/include/linux/textsearch.h @@ -4,10 +4,11 @@ #include #include #include -#include #include #include +struct module; + struct ts_config; #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 73898189a97..1ad4724458d 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -14,10 +14,10 @@ #ifndef _UIO_DRIVER_H_ #define _UIO_DRIVER_H_ -#include #include #include +struct module; struct uio_map; /** diff --git a/include/linux/vlynq.h b/include/linux/vlynq.h index 8f6a95882b0..017d4a53d55 100644 --- a/include/linux/vlynq.h +++ b/include/linux/vlynq.h @@ -20,9 +20,10 @@ #define __VLYNQ_H__ #include -#include #include +struct module; + #define VLYNQ_NUM_IRQS 32 struct vlynq_mapping { diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 79827143d5a..6e84cde44b8 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h @@ -1,7 +1,6 @@ #ifndef __SAA7146__ #define __SAA7146__ -#include /* for module-version */ #include /* for delay-stuff */ #include /* for kmalloc/kfree */ #include /* 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; diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h index fbf58556157..e6aa2318367 100644 --- a/include/media/v4l2-int-device.h +++ b/include/media/v4l2-int-device.h @@ -25,7 +25,6 @@ #ifndef V4L2_INT_DEVICE_H #define V4L2_INT_DEVICE_H -#include #include #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 { diff --git a/include/net/lib80211.h b/include/net/lib80211.h index 2ec896bb72b..d178c26a555 100644 --- a/include/net/lib80211.h +++ b/include/net/lib80211.h @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -42,6 +41,8 @@ enum { IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), }; +struct module; + struct lib80211_crypto_ops { const char *name; struct list_head list; diff --git a/include/net/sock.h b/include/net/sock.h index 5ac682f73d6..beb1a911acb 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include #include /* 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 diff --git a/include/sound/core.h b/include/sound/core.h index 1fa2407c966..a91d78eb2f0 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -22,7 +22,6 @@ * */ -#include #include /* wake_up() */ #include /* struct mutex */ #include /* struct rw_semaphore */ @@ -43,6 +42,7 @@ #ifdef CONFIG_PCI struct pci_dev; #endif +struct module; /* device allocation stuff */ diff --git a/include/trace/events/module.h b/include/trace/events/module.h index 21a546d27c0..16193273741 100644 --- a/include/trace/events/module.h +++ b/include/trace/events/module.h @@ -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 -- cgit v1.2.3 From 34641c6d003a0a94ccabf78211f42da36799f1a2 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 29 Aug 2011 13:21:14 -0400 Subject: nf_conntrack.h: fix up fallout from implicit moduleparam.h presence The implicit presence of module.h everywhere meant that this header also was getting moduleparam.h which defines struct kernel_param. Since it only needs to know that kernel_param is a struct, call that out instead of adding an include of moduleparam.h -- to get rid of this: include/net/netfilter/nf_conntrack.h:316: warning: 'struct kernel_param' declared inside parameter list include/net/netfilter/nf_conntrack.h:316: warning: its scope is only this definition or declaration, which is probably not what you want Signed-off-by: Paul Gortmaker --- include/net/netfilter/nf_conntrack.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/net') diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 0b7f05e4a92..8a2b0ae7dbd 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) return skb->dev && skb->skb_iif && skb->dev->flags & IFF_LOOPBACK; } +struct kernel_param; + extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); extern unsigned int nf_conntrack_htable_size; extern unsigned int nf_conntrack_max; -- cgit v1.2.3 From 69e7dae4096caeea0a7e2ede376f22a4fdee8456 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 29 Aug 2011 12:40:15 -0400 Subject: ip_vs.h: fix implicit use of module_get/module_put from module.h This file was using the module get/put functions in two simple inline functions. But module_get/put were only within scope because of the implicit presence of module.h being everywhere. Rather than add module.h to another file in include/ -- which is exactly the thing we are trying to avoid, simply convert these one-line functions into a define, as per what was done for the device_schedule_callback() in commit 523ded71de0c5e669733. Signed-off-by: Paul Gortmaker --- include/net/ip_vs.h | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'include/net') diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 8fa4430f99c..623916acbf3 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); struct ip_vs_pe *ip_vs_pe_getbyname(const char *name); struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name); -static inline void ip_vs_pe_get(const struct ip_vs_pe *pe) -{ - if (pe && pe->module) +/* + * Use a #define to avoid all of module.h just for these trivial ops + */ +#define ip_vs_pe_get(pe) \ + if (pe && pe->module) \ __module_get(pe->module); -} -static inline void ip_vs_pe_put(const struct ip_vs_pe *pe) -{ - if (pe && pe->module) +#define ip_vs_pe_put(pe) \ + if (pe && pe->module) \ module_put(pe->module); -} /* * IPVS protocol functions (from ip_vs_proto.c) -- cgit v1.2.3 From 1d58996da6a8045c8df2899ce5689a19c721322f Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 15 Sep 2011 17:56:39 -0400 Subject: bluetooth: macroize two small inlines to avoid module.h These two small inlines make calls to try_module_get() and module_put() which would force us to keep module.h present within yet another common include header. We can avoid this by turning them into macros. The hci_dev_hold construct is patterned off of raw_spin_trylock_irqsave() in spinlock.h Signed-off-by: Paul Gortmaker --- include/net/bluetooth/hci_core.h | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'include/net') diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 5b924423cf2..3779ea36225 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) d->destruct(d); } -static inline void hci_dev_put(struct hci_dev *d) -{ - __hci_dev_put(d); - module_put(d->owner); -} +/* + * hci_dev_put and hci_dev_hold are macros to avoid dragging all the + * overhead of all the modular infrastructure into this header. + */ +#define hci_dev_put(d) \ +do { \ + __hci_dev_put(d); \ + module_put(d->owner); \ +} while (0) static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) { @@ -525,12 +529,10 @@ static inline struct hci_dev *__hci_dev_hold(struct hci_dev *d) return d; } -static inline struct hci_dev *hci_dev_hold(struct hci_dev *d) -{ - if (try_module_get(d->owner)) - return __hci_dev_hold(d); - return NULL; -} +#define hci_dev_hold(d) \ +({ \ + try_module_get(d->owner) ? __hci_dev_hold(d) : NULL; \ +}) #define hci_dev_lock(d) spin_lock(&d->lock) #define hci_dev_unlock(d) spin_unlock(&d->lock) -- cgit v1.2.3