From f50169324df4ad942e544386d136216c8617636a Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 23 May 2011 14:11:39 -0400 Subject: module.h: split out the EXPORT_SYMBOL into export.h A lot of files pull in module.h when all they are really looking for is the basic EXPORT_SYMBOL functionality. The recent data from Ingo[1] shows that this is one of several instances that has a significant impact on compile times, and it should be targeted for factoring out (as done here). Note that several commonly used header files in include/* directly include themselves (some 34 of them!) The most commonly used ones of these will have to be made independent of module.h before the full benefit of this change can be realized. We also transition THIS_MODULE from module.h to export.h, since there are lots of files with subsystem structs that in turn will have a struct module *owner and only be doing: .owner = THIS_MODULE; and absolutely nothing else modular. So, we also want to have the THIS_MODULE definition present in the lightweight header. [1] https://lkml.org/lkml/2011/5/23/76 Signed-off-by: Paul Gortmaker --- include/linux/export.h | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/module.h | 68 +------------------------------------- 2 files changed, 90 insertions(+), 67 deletions(-) create mode 100644 include/linux/export.h (limited to 'include') diff --git a/include/linux/export.h b/include/linux/export.h new file mode 100644 index 00000000000..696c0f48afc --- /dev/null +++ b/include/linux/export.h @@ -0,0 +1,89 @@ +#ifndef _LINUX_EXPORT_H +#define _LINUX_EXPORT_H +/* + * Export symbols from the kernel to modules. Forked from module.h + * to reduce the amount of pointless cruft we feed to gcc when only + * exporting a simple symbol or two. + * + * If you feel the need to add #include to this file + * then you are doing something wrong and should go away silently. + */ + +/* Some toolchains use a `_' prefix for all user symbols. */ +#ifdef CONFIG_SYMBOL_PREFIX +#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX +#else +#define MODULE_SYMBOL_PREFIX "" +#endif + +struct kernel_symbol +{ + unsigned long value; + const char *name; +}; + +#ifdef MODULE +extern struct module __this_module; +#define THIS_MODULE (&__this_module) +#else +#define THIS_MODULE ((struct module *)0) +#endif + +#ifdef CONFIG_MODULES + +#ifndef __GENKSYMS__ +#ifdef CONFIG_MODVERSIONS +/* Mark the CRC weak since genksyms apparently decides not to + * generate a checksums for some symbols */ +#define __CRC_SYMBOL(sym, sec) \ + extern void *__crc_##sym __attribute__((weak)); \ + static const unsigned long __kcrctab_##sym \ + __used \ + __attribute__((section("___kcrctab" sec "+" #sym), unused)) \ + = (unsigned long) &__crc_##sym; +#else +#define __CRC_SYMBOL(sym, sec) +#endif + +/* For every exported symbol, place a struct in the __ksymtab section */ +#define __EXPORT_SYMBOL(sym, sec) \ + extern typeof(sym) sym; \ + __CRC_SYMBOL(sym, sec) \ + static const char __kstrtab_##sym[] \ + __attribute__((section("__ksymtab_strings"), aligned(1))) \ + = MODULE_SYMBOL_PREFIX #sym; \ + static const struct kernel_symbol __ksymtab_##sym \ + __used \ + __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ + = { (unsigned long)&sym, __kstrtab_##sym } + +#define EXPORT_SYMBOL(sym) \ + __EXPORT_SYMBOL(sym, "") + +#define EXPORT_SYMBOL_GPL(sym) \ + __EXPORT_SYMBOL(sym, "_gpl") + +#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ + __EXPORT_SYMBOL(sym, "_gpl_future") + +#ifdef CONFIG_UNUSED_SYMBOLS +#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") +#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") +#else +#define EXPORT_UNUSED_SYMBOL(sym) +#define EXPORT_UNUSED_SYMBOL_GPL(sym) +#endif + +#endif /* __GENKSYMS__ */ + +#else /* !CONFIG_MODULES... */ + +#define EXPORT_SYMBOL(sym) +#define EXPORT_SYMBOL_GPL(sym) +#define EXPORT_SYMBOL_GPL_FUTURE(sym) +#define EXPORT_UNUSED_SYMBOL(sym) +#define EXPORT_UNUSED_SYMBOL_GPL(sym) + +#endif /* CONFIG_MODULES */ + +#endif /* _LINUX_EXPORT_H */ diff --git a/include/linux/module.h b/include/linux/module.h index 863921637d9..9f0ddc808a8 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -25,21 +26,8 @@ /* Not Yet Implemented */ #define MODULE_SUPPORTED_DEVICE(name) -/* Some toolchains use a `_' prefix for all user symbols. */ -#ifdef CONFIG_SYMBOL_PREFIX -#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX -#else -#define MODULE_SYMBOL_PREFIX "" -#endif - #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN -struct kernel_symbol -{ - unsigned long value; - const char *name; -}; - struct modversion_info { unsigned long crc; @@ -98,11 +86,8 @@ void trim_init_extable(struct module *m); extern const struct gtype##_id __mod_##gtype##_table \ __attribute__ ((unused, alias(__stringify(name)))) -extern struct module __this_module; -#define THIS_MODULE (&__this_module) #else /* !MODULE */ #define MODULE_GENERIC_TABLE(gtype,name) -#define THIS_MODULE ((struct module *)0) #endif /* Generic info of form tag = "info" */ @@ -218,52 +203,6 @@ struct module_use { struct module *source, *target; }; -#ifndef __GENKSYMS__ -#ifdef CONFIG_MODVERSIONS -/* Mark the CRC weak since genksyms apparently decides not to - * generate a checksums for some symbols */ -#define __CRC_SYMBOL(sym, sec) \ - extern void *__crc_##sym __attribute__((weak)); \ - static const unsigned long __kcrctab_##sym \ - __used \ - __attribute__((section("___kcrctab" sec "+" #sym), unused)) \ - = (unsigned long) &__crc_##sym; -#else -#define __CRC_SYMBOL(sym, sec) -#endif - -/* For every exported symbol, place a struct in the __ksymtab section */ -#define __EXPORT_SYMBOL(sym, sec) \ - extern typeof(sym) sym; \ - __CRC_SYMBOL(sym, sec) \ - static const char __kstrtab_##sym[] \ - __attribute__((section("__ksymtab_strings"), aligned(1))) \ - = MODULE_SYMBOL_PREFIX #sym; \ - static const struct kernel_symbol __ksymtab_##sym \ - __used \ - __attribute__((section("___ksymtab" sec "+" #sym), unused)) \ - = { (unsigned long)&sym, __kstrtab_##sym } - -#define EXPORT_SYMBOL(sym) \ - __EXPORT_SYMBOL(sym, "") - -#define EXPORT_SYMBOL_GPL(sym) \ - __EXPORT_SYMBOL(sym, "_gpl") - -#define EXPORT_SYMBOL_GPL_FUTURE(sym) \ - __EXPORT_SYMBOL(sym, "_gpl_future") - - -#ifdef CONFIG_UNUSED_SYMBOLS -#define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused") -#define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl") -#else -#define EXPORT_UNUSED_SYMBOL(sym) -#define EXPORT_UNUSED_SYMBOL_GPL(sym) -#endif - -#endif - enum module_state { MODULE_STATE_LIVE, @@ -581,11 +520,6 @@ int unregister_module_notifier(struct notifier_block * nb); extern void print_modules(void); #else /* !CONFIG_MODULES... */ -#define EXPORT_SYMBOL(sym) -#define EXPORT_SYMBOL_GPL(sym) -#define EXPORT_SYMBOL_GPL_FUTURE(sym) -#define EXPORT_UNUSED_SYMBOL(sym) -#define EXPORT_UNUSED_SYMBOL_GPL(sym) /* Given an address, look for it in the exception tables. */ static inline const struct exception_table_entry * -- cgit v1.2.3 From 639938eb606e94af498c589feae2f0b8a5c285d1 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Tue, 30 Aug 2011 11:24:44 -0400 Subject: module.h: relocate MODULE_PARM_DESC into moduleparam.h There are files which use module_param and MODULE_PARM_DESC back to back. They only include moduleparam.h which makes sense, but the implicit presence of module.h everywhere hid the fact that MODULE_PARM_DESC wasn't in moduleparam.h at all. Relocate the macro to moduleparam.h so that the moduleparam infrastructure can be used independently of module.h Signed-off-by: Paul Gortmaker --- include/linux/module.h | 5 ----- include/linux/moduleparam.h | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/linux/module.h b/include/linux/module.h index 9f0ddc808a8..3cb7839a60b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -135,11 +135,6 @@ extern const struct gtype##_id __mod_##gtype##_table \ /* What your module does. */ #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description) -/* One for each parameter, describing how to use it. Some files do - multiple of these per line, so can't just use MODULE_INFO. */ -#define MODULE_PARM_DESC(_parm, desc) \ - __MODULE_INFO(parm, _parm, #_parm ":" desc) - #define MODULE_DEVICE_TABLE(type,name) \ MODULE_GENERIC_TABLE(type##_device,name) diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index fffb10bd551..7939f636c8b 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h @@ -31,6 +31,11 @@ static const char __module_cat(name,__LINE__)[] \ #define __MODULE_PARM_TYPE(name, _type) \ __MODULE_INFO(parmtype, name##type, #name ":" _type) +/* One for each parameter, describing how to use it. Some files do + multiple of these per line, so can't just use MODULE_INFO. */ +#define MODULE_PARM_DESC(_parm, desc) \ + __MODULE_INFO(parm, _parm, #_parm ":" desc) + struct kernel_param; struct kernel_param_ops { -- cgit v1.2.3 From 63c9744b9a53b8113b6d33ca361452b28f2ec391 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 10 Jul 2011 13:22:07 -0400 Subject: xen: Add export.h for THIS_MODULE/EXPORT_SYMBOL to various xen users. Things like THIS_MODULE and EXPORT_SYMBOL were simply everywhere because module.h was also everywhere. But we are fixing the latter. So we need to call out the real users in advance. Signed-off-by: Paul Gortmaker --- include/xen/xenbus.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/xen/xenbus.h b/include/xen/xenbus.h index aceeca799fd..553a7a21af5 100644 --- a/include/xen/xenbus.h +++ b/include/xen/xenbus.h @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From ced55d4ef7d6988bd0608423cf1e2225777f45cc Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 17 Jul 2011 16:24:35 -0400 Subject: regulator: Fix implicit use of notifier.h by driver.h This was implicitly appearing by way of module.h -- but when we fix that, we'll get this: In file included from drivers/regulator/dummy.c:21: include/linux/regulator/driver.h:197: error: field 'notifier' has incomplete type make[3]: *** [drivers/regulator/dummy.o] Error 1 Signed-off-by: Paul Gortmaker --- include/linux/regulator/driver.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 12a1aa04b72..52c89ae32f6 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -16,6 +16,7 @@ #define __LINUX_REGULATOR_DRIVER_H_ #include +#include #include struct regulator_dev; -- cgit v1.2.3 From 51d7815e4b8da275868e52f837e53e8f6231578c Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 14:19:59 -0400 Subject: vermagic: delete unused include of This file consists of nothing other than things like: #ifdef CONFIG_FOO #define .... There is no reason for it to require module.h Signed-off-by: Paul Gortmaker --- include/linux/vermagic.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index cf97b5b9d1f..6f8fbcf10df 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h @@ -1,5 +1,4 @@ #include -#include /* Simply sanity version stamp for modules. */ #ifdef CONFIG_SMP -- cgit v1.2.3 From 4eae0cc4f42a8f630e16c23e141ea7b85787d3c4 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 11:41:46 -0400 Subject: sysdev.h: dont include for no reason 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. There doesn't appear to be any module specifics in this file. The obvious people who were relying on the presence of the vast amount of stuff module.h sucked in have been fixed. If other files are implicitly relying on it, then lets see who they are and fix them too. Signed-off-by: Paul Gortmaker --- include/linux/sysdev.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h index d35e783a598..20f63d3e614 100644 --- a/include/linux/sysdev.h +++ b/include/linux/sysdev.h @@ -22,7 +22,6 @@ #define _SYSDEV_H_ #include -#include #include -- cgit v1.2.3 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') 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') 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 8a24454869a6f8e9d7968f88f78830f285089433 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 15:58:15 -0400 Subject: device_cgroup.h: delete needless include There is nothing modular in this file, and no reason to drag in all the extra headers that module.h brings with it, since it just slows down compiles. Signed-off-by: Paul Gortmaker --- include/linux/device_cgroup.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h index 7aad1f44086..8b64221b432 100644 --- a/include/linux/device_cgroup.h +++ b/include/linux/device_cgroup.h @@ -1,4 +1,3 @@ -#include #include #ifdef CONFIG_CGROUP_DEVICE -- cgit v1.2.3 From ddac6021fcc1768218c8b0453705801628289ba8 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 29 Aug 2011 10:52:50 -0400 Subject: miscdevice.h: delete unnecessary inclusion of module.h This file has a define MODULE_ALIAS_MISCDEV which in turn will use the MODULE_ALIAS define, but only if the former is explicitly used by modular device driver code (and such code should be already including module.h). Delete the include, since module.h is such a giant thing that we don't want it implicitly sneaking into compiles where it isn't specifically required. Signed-off-by: Paul Gortmaker --- include/linux/miscdevice.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index c309b1ecdc1..8526e91d764 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -1,6 +1,5 @@ #ifndef _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H -#include #include /* -- cgit v1.2.3 From feede37ec34deafcbc17dd0862a77ecf8b873762 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 15:49:02 -0400 Subject: acpi: remove module.h include from platform/aclinux.h This file had an include of module.h which was probably added in relation to this line: #define ACPI_EXPORT_SYMBOL(symbol) EXPORT_SYMBOL(symbol); However, we really expect symbol exporters to grab export.h themselves, and since this is only a define, we can remove the module.h include without aclinux.h itself causing any compile issues. Signed-off-by: Paul Gortmaker --- include/acpi/platform/aclinux.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h index f72403c4b51..f4b2effe033 100644 --- a/include/acpi/platform/aclinux.h +++ b/include/acpi/platform/aclinux.h @@ -55,7 +55,6 @@ #include #include -#include #include #include #include -- cgit v1.2.3 From 7755c47123a927de480826f4448a0c215a639f12 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 15:58:15 -0400 Subject: of_platform.h: delete needless include There is nothing modular in this file, and no reason to drag in all the 357 headers that module.h brings with it, since it just slows down compiles. Signed-off-by: Paul Gortmaker --- include/linux/of_platform.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/linux/of_platform.h b/include/linux/of_platform.h index 5a6f458a4bb..040ce2f6e8d 100644 --- a/include/linux/of_platform.h +++ b/include/linux/of_platform.h @@ -12,7 +12,6 @@ */ #ifdef CONFIG_OF_DEVICE -#include #include #include #include -- cgit v1.2.3 From d0a9940289a74378c19078fac5b9858fd114dff7 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sat, 29 Oct 2011 10:17:06 -0400 Subject: of: fix implicit use of errno.h in include/linux/of.h It shows up as a build failure on MIPS, as it is used in three of_property function stubs. include/linux/of.h:275: error: 'ENOSYS' undeclared (first use in this function) include/linux/of.h:282: error: 'ENOSYS' undeclared (first use in this function) include/linux/of.h:295: error: 'ENOSYS' undeclared (first use in this function) Signed-off-by: Paul Gortmaker --- include/linux/of.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/of.h b/include/linux/of.h index 5dbe263462a..c1f5118c59b 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -23,6 +23,7 @@ #include #include +#include typedef u32 phandle; typedef u32 ihandle; -- cgit v1.2.3 From bb2eac66ee0e8023432e8b0ff13b75e47be199e9 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 17 Jul 2011 17:11:26 -0400 Subject: stop_machine.h: fix implicit use of smp.h for smp_processor_id This will show up on MIPS when we fix all the implicit header presences that are because of module.h being everywhere. In file included from kernel/trace/ftrace.c:16: include/linux/stop_machine.h: In function 'stop_one_cpu': include/linux/stop_machine.h:50: error: implicit declaration of function 'smp_processor_id' include/linux/stop_machine.h: In function 'stop_cpus': include/linux/stop_machine.h:80: error: implicit declaration of function 'raw_smp_processor_id' Signed-off-by: Paul Gortmaker --- include/linux/stop_machine.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 2d04ea91676..c170edc3bf5 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -3,6 +3,7 @@ #include #include +#include #include #include -- cgit v1.2.3 From 1986c93f09c98628d68bec773c16322fb5b88c38 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 29 Aug 2011 15:22:17 -0400 Subject: miscdevice.h: fix up implicit use of lists and types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By removing the implicit presence of module.h from this file, we will see things like: In file included from fs/dlm/user.c:9: include/linux/miscdevice.h:50: error: field ‘list’ has incomplete type include/linux/miscdevice.h:54: error: expected specifier-qualifier-list before ‘mode_t’ Call out lists.h and types.h for inclusion to fix each of the above respectively. Signed-off-by: Paul Gortmaker --- include/linux/miscdevice.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h index 8526e91d764..c41d7270c6c 100644 --- a/include/linux/miscdevice.h +++ b/include/linux/miscdevice.h @@ -1,6 +1,8 @@ #ifndef _LINUX_MISCDEVICE_H #define _LINUX_MISCDEVICE_H #include +#include +#include /* * These allocations are managed by device@lanana.org. If you use an -- cgit v1.2.3 From a8efa9d6bf00fbe9597dd3352dc062a998bf9b15 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 29 Jul 2011 16:55:11 +1000 Subject: linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h The implicit presence of module.h and all its sub-includes was masking these implicit header usages: include/linux/dmaengine.h:684: warning: 'struct page' declared inside parameter list include/linux/dmaengine.h:684: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/dmaengine.h:687: warning: 'struct page' declared inside parameter list include/linux/dmaengine.h:736:2: error: implicit declaration of function 'bitmap_zero' With input from Stephen Rothwell Signed-off-by: Paul Gortmaker --- include/linux/dmaengine.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 8fbf40e0713..1ceff5ae9d3 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -24,6 +24,8 @@ #include #include #include +#include +#include struct scatterlist; -- cgit v1.2.3 From 246359d37985000b8403487e46867c4eb610af72 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 27 May 2011 07:08:41 -0400 Subject: pm_runtime.h: explicitly requires notifier.h This file was getting notifier.h via device.h --> module.h but the module.h inclusion is going away, so add notifier.h directly. Signed-off-by: Paul Gortmaker --- include/linux/pm_runtime.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 70b284024d9..d8d90361964 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -10,6 +10,7 @@ #define _LINUX_PM_RUNTIME_H #include +#include #include #include -- cgit v1.2.3 From e2ffa376f67a0778891e26026e36605e5dd2fa4d Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 17 Jul 2011 17:05:31 -0400 Subject: uwb.h: fix implicit use of asm/page.h for PAGE_SIZE Once we clean up the implicit presence of module.h (and all its sub-includes), we'll see an implicit dependency on page.h for the PAGE_SIZE define. So fix it in advance. Signed-off-by: Paul Gortmaker --- include/linux/uwb.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/linux/uwb.h b/include/linux/uwb.h index b0c564ec216..7dbbee9741b 100644 --- a/include/linux/uwb.h +++ b/include/linux/uwb.h @@ -33,6 +33,7 @@ #include #include #include +#include struct uwb_dev; struct uwb_beca_e; -- cgit v1.2.3 From 7c926402a7e8c9b279968fd94efec8700ba3859e Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Thu, 26 May 2011 15:34:12 -0400 Subject: crypto.h: remove unused crypto_tfm_alg_modname() inline The (which is in turn in common headers like tcp.h) wants to use module_name() in an inline fcn. But having all of along for the ride is overkill and slows down compiles by a measureable amount, since it in turn includes lots of headers. Since the inline is never used anywhere in the kernel[1], we can just remove it, and then also remove the module.h include as well. In all the many crypto modules, there were some relying on crypto.h including module.h -- for them we now explicitly call out module.h for inclusion. [1] git grep shows some staging drivers also define the same static inline, but they also never ever use it. Signed-off-by: Paul Gortmaker --- include/linux/crypto.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'include') diff --git a/include/linux/crypto.h b/include/linux/crypto.h index e5e468e9133..1e51f9a491a 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -18,7 +18,6 @@ #define _LINUX_CRYPTO_H #include -#include #include #include #include @@ -505,11 +504,6 @@ static inline int crypto_tfm_alg_priority(struct crypto_tfm *tfm) return tfm->__crt_alg->cra_priority; } -static inline const char *crypto_tfm_alg_modname(struct crypto_tfm *tfm) -{ - return module_name(tfm->__crt_alg->cra_module); -} - static inline u32 crypto_tfm_alg_type(struct crypto_tfm *tfm) { return tfm->__crt_alg->cra_flags & CRYPTO_ALG_TYPE_MASK; -- cgit v1.2.3 From eb5589a8f0dab7e29021344228856339e6a1249c Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Fri, 27 May 2011 09:02:11 -0400 Subject: include: convert various register fcns to macros to avoid include chaining The original implementations reference THIS_MODULE in an inline. We could include , but it is better to avoid chaining. Fortunately someone else already thought of this, and made a similar inline into a #define in for device_schedule_callback(), [see commit 523ded71de0] so follow that precedent here. Also bubble up any __must_check that were used on the prev. wrapper inline functions up one to the real __register functions, to preserve any prev. sanity checks that were used in those instances. Signed-off-by: Paul Gortmaker --- include/linux/bcma/bcma.h | 7 +++---- include/linux/device.h | 12 ++++++++---- include/linux/gameport.h | 17 ++++++++--------- include/linux/hid.h | 9 +++++---- include/linux/i2c.h | 7 +++---- include/linux/pci_hotplug.h | 10 +++------- include/linux/serio.h | 20 +++++++++++--------- include/linux/ssb/ssb.h | 7 +++---- include/linux/uio_driver.h | 10 +++++----- include/linux/usb.h | 9 +++++---- include/linux/uwb/umc.h | 7 +++---- 11 files changed, 57 insertions(+), 58 deletions(-) (limited to 'include') diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 5dbd7055cb8..4d4b59de946 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h @@ -170,10 +170,9 @@ struct bcma_driver { }; extern int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); -static inline int bcma_driver_register(struct bcma_driver *drv) -{ - return __bcma_driver_register(drv, THIS_MODULE); -} +#define bcma_driver_register(drv) \ + __bcma_driver_register(drv, THIS_MODULE) + extern void bcma_driver_unregister(struct bcma_driver *drv); struct bcma_bus { diff --git a/include/linux/device.h b/include/linux/device.h index 85e78fc7d7f..61f29f6a403 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -723,10 +723,14 @@ extern int dev_set_drvdata(struct device *dev, void *data); */ extern struct device *__root_device_register(const char *name, struct module *owner); -static inline struct device *root_device_register(const char *name) -{ - return __root_device_register(name, THIS_MODULE); -} + +/* + * This is a macro to avoid include problems with THIS_MODULE, + * just as per what is done for device_schedule_callback() above. + */ +#define root_device_register(name) \ + __root_device_register(name, THIS_MODULE) + extern void root_device_unregister(struct device *root); static inline void *dev_get_platdata(const struct device *dev) diff --git a/include/linux/gameport.h b/include/linux/gameport.h index b65a6f47277..e74073e9dd8 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h @@ -71,10 +71,9 @@ void gameport_close(struct gameport *gameport); #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) void __gameport_register_port(struct gameport *gameport, struct module *owner); -static inline void gameport_register_port(struct gameport *gameport) -{ - __gameport_register_port(gameport, THIS_MODULE); -} +/* use a define to avoid include chaining to get THIS_MODULE */ +#define gameport_register_port(gameport) \ + __gameport_register_port(gameport, THIS_MODULE) void gameport_unregister_port(struct gameport *gameport); @@ -145,12 +144,12 @@ static inline void gameport_unpin_driver(struct gameport *gameport) mutex_unlock(&gameport->drv_mutex); } -int __gameport_register_driver(struct gameport_driver *drv, +int __must_check __gameport_register_driver(struct gameport_driver *drv, struct module *owner, const char *mod_name); -static inline int __must_check gameport_register_driver(struct gameport_driver *drv) -{ - return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); -} + +/* use a define to avoid include chaining to get THIS_MODULE & friends */ +#define gameport_register_driver(drv) \ + __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME) void gameport_unregister_driver(struct gameport_driver *drv); diff --git a/include/linux/hid.h b/include/linux/hid.h index deed5f9a1e1..c235e4e8767 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -697,10 +697,11 @@ extern void hid_destroy_device(struct hid_device *); extern int __must_check __hid_register_driver(struct hid_driver *, struct module *, const char *mod_name); -static inline int __must_check hid_register_driver(struct hid_driver *driver) -{ - return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); -} + +/* use a define to avoid include chaining to get THIS_MODULE & friends */ +#define hid_register_driver(driver) \ + __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) + extern void hid_unregister_driver(struct hid_driver *); extern 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 38a21c3edd2..1be303bfc25 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -451,10 +451,9 @@ extern int i2c_add_numbered_adapter(struct i2c_adapter *); extern int i2c_register_driver(struct module *, struct i2c_driver *); extern void i2c_del_driver(struct i2c_driver *); -static inline int i2c_add_driver(struct i2c_driver *driver) -{ - return i2c_register_driver(THIS_MODULE, driver); -} +/* use a define to avoid include chaining to get THIS_MODULE */ +#define i2c_add_driver(driver) \ + i2c_register_driver(THIS_MODULE, driver) extern struct i2c_client *i2c_use_client(struct i2c_client *client); extern void i2c_release_client(struct i2c_client *client); diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 5d09cbafa7d..45fc162cbdc 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); extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, struct hotplug_slot_info *info); -static inline int pci_hp_register(struct hotplug_slot *slot, - struct pci_bus *pbus, - int devnr, const char *name) -{ - return __pci_hp_register(slot, pbus, devnr, name, - THIS_MODULE, KBUILD_MODNAME); -} +/* use a define to avoid include chaining to get THIS_MODULE & friends */ +#define pci_hp_register(slot, pbus, devnr, name) \ + __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME) /* PCI Setting Record (Type 0) */ struct hpp_type0 { diff --git a/include/linux/serio.h b/include/linux/serio.h index be7dfb0f12d..ca82861b0e4 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h @@ -79,19 +79,21 @@ void serio_reconnect(struct serio *serio); irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags); void __serio_register_port(struct serio *serio, struct module *owner); -static inline void serio_register_port(struct serio *serio) -{ - __serio_register_port(serio, THIS_MODULE); -} + +/* use a define to avoid include chaining to get THIS_MODULE */ +#define serio_register_port(serio) \ + __serio_register_port(serio, THIS_MODULE) void serio_unregister_port(struct serio *serio); void serio_unregister_child_port(struct serio *serio); -int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); -static inline int __must_check serio_register_driver(struct serio_driver *drv) -{ - return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); -} +int __must_check __serio_register_driver(struct serio_driver *drv, + struct module *owner, const char *mod_name); + +/* use a define to avoid include chaining to get THIS_MODULE & friends */ +#define serio_register_driver(drv) \ + __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME) + void serio_unregister_driver(struct serio_driver *drv); static 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 f10ed7b4a71..061e560251b 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h @@ -231,10 +231,9 @@ struct ssb_driver { #define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); -static inline int ssb_driver_register(struct ssb_driver *drv) -{ - return __ssb_driver_register(drv, THIS_MODULE); -} +#define ssb_driver_register(drv) \ + __ssb_driver_register(drv, THIS_MODULE) + extern void ssb_driver_unregister(struct ssb_driver *drv); diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index fd99ff9298c..73898189a97 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h @@ -101,11 +101,11 @@ extern int __must_check __uio_register_device(struct module *owner, struct device *parent, struct uio_info *info); -static inline int __must_check - uio_register_device(struct device *parent, struct uio_info *info) -{ - return __uio_register_device(THIS_MODULE, parent, info); -} + +/* use a define to avoid include chaining to get THIS_MODULE */ +#define uio_register_device(parent, info) \ + __uio_register_device(THIS_MODULE, parent, info) + extern void uio_unregister_device(struct uio_info *info); extern void uio_event_notify(struct uio_info *info); diff --git a/include/linux/usb.h b/include/linux/usb.h index 6f49a1b39fa..d3d0c137433 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -946,10 +946,11 @@ struct usb_class_driver { */ extern int usb_register_driver(struct usb_driver *, struct module *, const char *); -static inline int usb_register(struct usb_driver *driver) -{ - return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); -} + +/* use a define to avoid include chaining to get THIS_MODULE & friends */ +#define usb_register(driver) \ + usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) + extern void usb_deregister(struct usb_driver *); extern int usb_register_device_driver(struct usb_device_driver *, diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h index 7b4842028ca..891d1d5f394 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, * umc_driver_register - register a UMC capabiltity driver. * @umc_drv: pointer to the driver. */ -static inline int __must_check umc_driver_register(struct umc_driver *umc_drv) -{ - return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME); -} +#define umc_driver_register(umc_drv) \ + __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME) + void umc_driver_unregister(struct umc_driver *umc_drv); /* -- 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') 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') 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') 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') 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 From ec53cf23c0ddb0c29950b9a4ac46964c4c6c6c2f Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Mon, 19 Sep 2011 20:33:19 -0400 Subject: irq: don't put module.h into irq.h for tracking irqgen modules. Recent commit "irq: Track the owner of irq descriptor" in commit ID b6873807a7143b7 placed module.h into linux/irq.h but we are trying to limit module.h inclusion to just C files that really need it, due to its size and number of children includes. This targets just reversing that include. Add in the basic "struct module" since that is all we really need to ensure things compile. In theory, b687380 should have added the module.h include to the irqdesc.h header as well, but the implicit module.h everywhere presence masked this from showing up. So give it the "struct module" as well. As for the C files, irqdesc.c is only using THIS_MODULE, so it does not need module.h - give it export.h instead. The C file irq/manage.c is now (as of b687380) using try_module_get and module_put and so it needs module.h (which it already has). Also convert the irq_alloc_descs variants to macros, since all they really do is is call the __irq_alloc_descs primitive. This avoids including export.h and no debug info is lost. Signed-off-by: Paul Gortmaker --- include/linux/irq.h | 32 ++++++++++++-------------------- include/linux/irqdesc.h | 1 + 2 files changed, 13 insertions(+), 20 deletions(-) (limited to 'include') diff --git a/include/linux/irq.h b/include/linux/irq.h index 59e49c80cc2..bff29c58da2 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -23,13 +23,13 @@ #include #include #include -#include #include #include #include struct seq_file; +struct module; struct irq_desc; struct irq_data; typedef 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) int __irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, int node, struct module *owner); -static inline int irq_alloc_descs(int irq, unsigned int from, unsigned int cnt, - int node) -{ - return __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE); -} +/* use macros to avoid needing export.h for THIS_MODULE */ +#define irq_alloc_descs(irq, from, cnt, node) \ + __irq_alloc_descs(irq, from, cnt, node, THIS_MODULE) -void irq_free_descs(unsigned int irq, unsigned int cnt); -int irq_reserve_irqs(unsigned int from, unsigned int cnt); +#define irq_alloc_desc(node) \ + irq_alloc_descs(-1, 0, 1, node) -static inline int irq_alloc_desc(int node) -{ - return irq_alloc_descs(-1, 0, 1, node); -} +#define irq_alloc_desc_at(at, node) \ + irq_alloc_descs(at, at, 1, node) -static inline int irq_alloc_desc_at(unsigned int at, int node) -{ - return irq_alloc_descs(at, at, 1, node); -} +#define irq_alloc_desc_from(from, node) \ + irq_alloc_descs(-1, from, 1, node) -static inline int irq_alloc_desc_from(unsigned int from, int node) -{ - return irq_alloc_descs(-1, from, 1, node); -} +void irq_free_descs(unsigned int irq, unsigned int cnt); +int irq_reserve_irqs(unsigned int from, unsigned int cnt); static inline void irq_free_desc(unsigned int irq) { diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 6b69c2c9dff..f1e2527006b 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -11,6 +11,7 @@ struct irq_affinity_notify; struct proc_dir_entry; struct timer_rand_state; +struct module; /** * struct irq_desc - interrupt descriptor * @irq_data: per irq and chip data passed down to chip functions -- cgit v1.2.3 From 67b84999b1a8b1af5625b1eabe92146c5eb42932 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 18 Sep 2011 13:36:07 -0400 Subject: Revert "tracing: Include module.h in define_trace.h" This reverts commit 3a9f987b3141f086de27832514aad9f50a53f754. With all the files that are real modules now having module.h explicitly called out for inclusion, and no reliance on any implicit presence of module.h assumed, we should no longer need this workaround. Signed-off-by: Paul Gortmaker --- include/trace/define_trace.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'include') diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h index da39b22636f..b0b4eb24d59 100644 --- a/include/trace/define_trace.h +++ b/include/trace/define_trace.h @@ -21,16 +21,6 @@ #undef CREATE_TRACE_POINTS #include -/* - * module.h includes tracepoints, and because ftrace.h - * pulls in module.h: - * trace/ftrace.h -> linux/ftrace_event.h -> linux/perf_event.h -> - * linux/ftrace.h -> linux/module.h - * we must include module.h here before we play with any of - * the TRACE_EVENT() macros, otherwise the tracepoints included - * by module.h may break the build. - */ -#include #undef TRACE_EVENT #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \ -- cgit v1.2.3