Skip to content

Commit eb008eb

Browse files
Paul Gortmakeringomolnar
authored andcommitted
x86: Audit and remove any remaining unnecessary uses of module.h
Historically a lot of these existed because we did not have a distinction between what was modular code and what was providing support to modules via EXPORT_SYMBOL and friends. That changed when we forked out support for the latter into the export.h file. This means we should be able to reduce the usage of module.h in code that is obj-y Makefile or bool Kconfig. In the case of some of these which are modular, we can extend that to also include files that are building basic support functionality but not related to loading or registering the final module; such files also have no need whatsoever for module.h The advantage in removing such instances is that module.h itself sources about 15 other headers; adding significantly to what we feed cpp, and it can obscure what headers we are effectively using. Since module.h was the source for init.h (for __init) and for export.h (for EXPORT_SYMBOL) we consider each instance for the presence of either and replace as needed. In the case of crypto/glue_helper.c we delete a redundant instance of MODULE_LICENSE in order to delete module.h -- the license info is already present at the top of the file. The uncore change warrants a mention too; it is uncore.c that uses module.h and not uncore.h; hence the relocation done there. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20160714001901.31603-9-paul.gortmaker@windriver.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 1767e93 commit eb008eb

11 files changed

Lines changed: 11 additions & 12 deletions

File tree

‎arch/x86/crypto/glue_helper.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
*
2626
*/
2727

28-
#include <linux/module.h>
28+
#include <linux/export.h>
2929
#include <crypto/b128ops.h>
3030
#include <crypto/lrw.h>
3131
#include <crypto/xts.h>
@@ -397,5 +397,3 @@ void glue_xts_crypt_128bit_one(void *ctx, u128 *dst, const u128 *src, le128 *iv,
397397
u128_xor(dst, dst, (u128 *)&ivblk);
398398
}
399399
EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit_one);
400-
401-
MODULE_LICENSE("GPL");

‎arch/x86/events/amd/ibs.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
*/
88

99
#include <linux/perf_event.h>
10-
#include <linux/module.h>
10+
#include <linux/init.h>
11+
#include <linux/export.h>
1112
#include <linux/pci.h>
1213
#include <linux/ptrace.h>
1314
#include <linux/syscore_ops.h>

‎arch/x86/events/amd/iommu.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313

1414
#include <linux/perf_event.h>
15-
#include <linux/module.h>
15+
#include <linux/init.h>
1616
#include <linux/cpumask.h>
1717
#include <linux/slab.h>
1818

‎arch/x86/events/core.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
#include <linux/notifier.h>
1818
#include <linux/hardirq.h>
1919
#include <linux/kprobes.h>
20-
#include <linux/module.h>
20+
#include <linux/export.h>
21+
#include <linux/init.h>
2122
#include <linux/kdebug.h>
2223
#include <linux/sched.h>
2324
#include <linux/uaccess.h>

‎arch/x86/events/intel/uncore.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include <linux/module.h>
2+
13
#include <asm/cpu_device_id.h>
24
#include "uncore.h"
35

‎arch/x86/events/intel/uncore.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include <linux/module.h>
21
#include <linux/slab.h>
32
#include <linux/pci.h>
43
#include <asm/apicdef.h>

‎arch/x86/include/asm/livepatch.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define _ASM_X86_LIVEPATCH_H
2323

2424
#include <asm/setup.h>
25-
#include <linux/module.h>
2625
#include <linux/ftrace.h>
2726

2827
static inline int klp_check_compiler_support(void)

‎arch/x86/kernel/cpu/mtrr/if.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#include <linux/seq_file.h>
33
#include <linux/uaccess.h>
44
#include <linux/proc_fs.h>
5-
#include <linux/module.h>
65
#include <linux/ctype.h>
76
#include <linux/string.h>
87
#include <linux/slab.h>

‎arch/x86/kernel/cpu/mtrr/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include <linux/stop_machine.h>
3939
#include <linux/kvm_para.h>
4040
#include <linux/uaccess.h>
41-
#include <linux/module.h>
41+
#include <linux/export.h>
4242
#include <linux/mutex.h>
4343
#include <linux/init.h>
4444
#include <linux/sort.h>

‎arch/x86/pci/xen.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
1010
* Stefano Stabellini <stefano.stabellini@eu.citrix.com>
1111
*/
12-
#include <linux/module.h>
12+
#include <linux/export.h>
1313
#include <linux/init.h>
1414
#include <linux/pci.h>
1515
#include <linux/acpi.h>

0 commit comments

Comments
 (0)