Skip to contentSkip to conversation

mips: audit and remove needless module.h use from core

PATCH In review Paul Gortmaker 3 participants 8 messages Aug 21, 2016 – Aug 29, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover mips: audit and remove needless module.h use from core

Originally module.h provided support for both 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 header; roughly five years ago[1].

We dealt with the immediate fallout of that change back then, but we did not go through and "downgrade" all the non-modular module.h users to export.h, once the merge of that change enabled us to do so.

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.

Consider the following pseudo patch to introduce a no-op source that just includes module.h:

    diff --git a/init/Makefile b/init/Makefile
    --- a/init/Makefile
    +++ b/init/Makefile
    @@ -2,7 +2,7 @@

    -obj-y                          := main.o version.o mounts.o
    +obj-y                          := main.o version.o mounts.o foo.o

    diff --git a/init/foo.c b/init/foo.c
    new file mode 100644
    --- /dev/null
    +++ b/init/foo.c
    @@ -0,0 +1 @@
    +#include <linux/module.h>

With that in place, we then can see the impact with this:

   paul@builder:~/git/linux-head$ make O=../x86_64-build/ init/foo.i
   make[1]: Entering directory '/home/paul/git/x86_64-build'
     CPP     init/foo.i
   paul@builder:~/git/linux-head$ ls -lh ../x86_64-build/init/foo.i 
   -rw-rw-r-- 1 paul paul 754K Jul 12 20:04 ../x86_64-build/init/foo.i

So, with every module.h include, we guarantee a minimum of 3/4 of a MB of text output from cpp as the baseline of header preamble to process.

Repeating the same experiment with <linux/init.h> and the result is less than 12kB; with <linux/export.h> it is only about 1/2kB; with both it still is less than 12kB. Presumably the numbers are similar for !x86.

In this series we manage to remove about 40 includes of module.h that just simply don't need to exist anymore in core MIPS files (kernel, lib, pci, mm, kvm).

Since module.h might be the implicit source for init.h (for __init) and for export.h (for EXPORT_SYMBOL) we consider each instance for the requirement of either and replace as needed. Some additional implicit include issues were also fixed up as they appeared during build coverage.

The series was done on a per directory level for the larger dirs and then we will tackle the platform specific files in a subsequent series. This seemed like a better solution than one giant commit that would not get easily reviewed.

The risk here is entirely on introducing build failures -- there is no changes to generated code, so if build coverage is exhaustive, the risk should be zero.

To that end, I have done all[mod/no/yes]config, and each mips defconfig (a couple aren't supported by my toolchain however) with these changes on a recent linux-next tree.

Paul.

[1] https://lwn.net/Articles/453517/

---

Cc James Hogan <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc "Radim Krčmář" <[email protected]>
Cc Ralf Baechle <[email protected]>

Paul Gortmaker (5):
mips/kernel: Audit and remove any unnecessary uses of module.h mips/mm: Audit and remove any unnecessary uses of module.h mips/lib: Audit and remove any unnecessary uses of module.h mips/pci: Audit and remove any unnecessary uses of module.h mips/kvm: Audit and remove any unnecessary uses of module.h

 arch/mips/kernel/binfmt_elfn32.c      | 8 +-------
 arch/mips/kernel/binfmt_elfo32.c      | 8 +-------
 arch/mips/kernel/branch.c             | 2 +-
 arch/mips/kernel/linux32.c            | 1 -
 arch/mips/kernel/mips-r2-to-r6-emul.c | 1 -
 arch/mips/kernel/smp.c                | 2 +-
 arch/mips/kvm/commpage.c              | 1 -
 arch/mips/kvm/dyntrans.c              | 1 -
 arch/mips/kvm/emulate.c               | 1 -
 arch/mips/kvm/interrupt.c             | 1 -
 arch/mips/kvm/trap_emul.c             | 1 -
 arch/mips/lib/ashldi3.c               | 2 +-
 arch/mips/lib/ashrdi3.c               | 2 +-
 arch/mips/lib/bswapdi.c               | 3 ++-
 arch/mips/lib/bswapsi.c               | 3 ++-
 arch/mips/lib/cmpdi2.c                | 2 +-
 arch/mips/lib/delay.c                 | 2 +-
 arch/mips/lib/iomap-pci.c             | 2 +-
 arch/mips/lib/iomap.c                 | 2 +-
 arch/mips/lib/lshrdi3.c               | 2 +-
 arch/mips/lib/ucmpdi2.c               | 2 +-
 arch/mips/mm/c-r4k.c                  | 2 +-
 arch/mips/mm/cache.c                  | 2 +-
 arch/mips/mm/dma-default.c            | 2 +-
 arch/mips/mm/fault.c                  | 1 -
 arch/mips/mm/highmem.c                | 3 ++-
 arch/mips/mm/init.c                   | 2 +-
 arch/mips/mm/ioremap.c                | 2 +-
 arch/mips/mm/mmap.c                   | 2 +-
 arch/mips/mm/page.c                   | 1 -
 arch/mips/mm/tlb-r4k.c                | 2 +-
 arch/mips/pci/pci-ar71xx.c            | 2 +-
 arch/mips/pci/pci-ar724x.c            | 2 +-
 arch/mips/pci/pci-lantiq.c            | 2 --
 arch/mips/pci/pci-mt7620.c            | 2 --
 arch/mips/pci/pci-rt2880.c            | 2 --
 arch/mips/pci/pci-rt3883.c            | 2 --
 arch/mips/pci/pcie-octeon.c           | 2 +-
 38 files changed, 28 insertions(+), 54 deletions(-)
Signature · 1 line
2.8.4
#1 lore raw

PATCH 1/5 mips/kernel: Audit and remove any 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. The advantage in doing so 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 obj-y/bool instance for the presence of either and replace as needed.

In the case of the n32/o32 files, we have to get rid of a couple no-op MODULE_ tags to facilitate the module.h removal. They piggy back off the fs/ elf binary support, which is also a bool Kconfig.

---
 arch/mips/kernel/binfmt_elfn32.c      | 8 +-------
 arch/mips/kernel/binfmt_elfo32.c      | 8 +-------
 arch/mips/kernel/branch.c             | 2 +-
 arch/mips/kernel/linux32.c            | 1 -
 arch/mips/kernel/mips-r2-to-r6-emul.c | 1 -
 arch/mips/kernel/smp.c                | 2 +-
 6 files changed, 4 insertions(+), 18 deletions(-)
arch/mips/kernel/binfmt_elfn32.c +1 -7
index 58ad63d7eb42..9c7f3e136d50 100644
@@ -1,5 +1,6 @@
 /*
  * Support for n32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle ([email protected])
  *
  * Copyright (C) 1999, 2001 Ralf Baechle
  * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
@@ -37,7 +38,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 #define ELF_ET_DYN_BASE		(TASK32_SIZE / 3 * 2)
 
 #include <asm/processor.h>
-#include <linux/module.h>
 #include <linux/elfcore.h>
 #include <linux/compat.h>
 #include <linux/math64.h>
@@ -96,12 +96,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
 
 #define ELF_CORE_EFLAGS EF_MIPS_ABI2
 
-MODULE_DESCRIPTION("Binary format loader for compatibility with n32 Linux/MIPS binaries");
-MODULE_AUTHOR("Ralf Baechle ([email protected])");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
arch/mips/kernel/binfmt_elfo32.c +1 -7
index 49fb881481f7..1ab34322dd97 100644
@@ -1,5 +1,6 @@
 /*
  * Support for o32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle ([email protected])
  *
  * Copyright (C) 1999, 2001 Ralf Baechle
  * Copyright (C) 1999, 2001 Silicon Graphics, Inc.
@@ -42,7 +43,6 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
 
 #include <asm/processor.h>
 
-#include <linux/module.h>
 #include <linux/elfcore.h>
 #include <linux/compat.h>
 #include <linux/math64.h>
@@ -99,12 +99,6 @@ jiffies_to_compat_timeval(unsigned long jiffies, struct compat_timeval *value)
 	value->tv_usec = rem / NSEC_PER_USEC;
 }
 
-MODULE_DESCRIPTION("Binary format loader for compatibility with o32 Linux/MIPS binaries");
-MODULE_AUTHOR("Ralf Baechle ([email protected])");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
arch/mips/kernel/branch.c +1 -1
index 46c227fc98f5..f5c68483c98e 100644
@@ -9,7 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/signal.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/branch.h>
 #include <asm/cpu.h>
 #include <asm/cpu-features.h>
arch/mips/kernel/linux32.c +0 -1
index 0b29646bcee7..50fb62544df7 100644
@@ -26,7 +26,6 @@
 #include <linux/utsname.h>
 #include <linux/personality.h>
 #include <linux/dnotify.h>
-#include <linux/module.h>
 #include <linux/binfmts.h>
 #include <linux/security.h>
 #include <linux/compat.h>
arch/mips/kernel/mips-r2-to-r6-emul.c +0 -1
index c3372cac6db2..ffe3b9e67c94 100644
@@ -15,7 +15,6 @@
 #include <linux/debugfs.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/ptrace.h>
 #include <linux/seq_file.h>
 
arch/mips/kernel/smp.c +1 -1
index f95f094f36e4..5931bafada70 100644
@@ -25,7 +25,7 @@
 #include <linux/smp.h>
 #include <linux/spinlock.h>
 #include <linux/threads.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/time.h>
 #include <linux/timex.h>
 #include <linux/sched.h>
Signature · 1 line
2.8.4
#2 lore raw

PATCH 2/5 mips/mm: Audit and remove any unnecessary uses of module.h

In reply to Paul Gortmaker

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. The advantage in doing so 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 obj-y/bool instance for the presence of either and replace as needed.

---
 arch/mips/mm/c-r4k.c       | 2 +-
 arch/mips/mm/cache.c       | 2 +-
 arch/mips/mm/dma-default.c | 2 +-
 arch/mips/mm/fault.c       | 1 -
 arch/mips/mm/highmem.c     | 3 ++-
 arch/mips/mm/init.c        | 2 +-
 arch/mips/mm/ioremap.c     | 2 +-
 arch/mips/mm/mmap.c        | 2 +-
 arch/mips/mm/page.c        | 1 -
 arch/mips/mm/tlb-r4k.c     | 2 +-
 10 files changed, 9 insertions(+), 10 deletions(-)
arch/mips/mm/c-r4k.c +1 -1
index cd72805b64a7..82889922e5b8 100644
@@ -17,7 +17,7 @@
 #include <linux/sched.h>
 #include <linux/smp.h>
 #include <linux/mm.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/bitops.h>
 
 #include <asm/bcache.h>
arch/mips/mm/cache.c +1 -1
index bf04c6c479a4..208199e2d55b 100644
@@ -10,7 +10,7 @@
 #include <linux/fcntl.h>
 #include <linux/kernel.h>
 #include <linux/linkage.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
arch/mips/mm/dma-default.c +1 -1
index b2eadd6fa9a1..755259c54976 100644
@@ -11,7 +11,7 @@
 #include <linux/types.h>
 #include <linux/dma-mapping.h>
 #include <linux/mm.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/scatterlist.h>
 #include <linux/string.h>
 #include <linux/gfp.h>
arch/mips/mm/fault.c +0 -1
index 9560ad731120..d56a855828c2 100644
@@ -18,7 +18,6 @@
 #include <linux/mman.h>
 #include <linux/mm.h>
 #include <linux/smp.h>
-#include <linux/module.h>
 #include <linux/kprobes.h>
 #include <linux/perf_event.h>
 #include <linux/uaccess.h>
arch/mips/mm/highmem.c +2 -1
index d7258a103439..f13f51003bd8 100644
@@ -1,5 +1,6 @@
 #include <linux/compiler.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/highmem.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
arch/mips/mm/init.c +1 -1
index 2c3749d98f04..8fa31b3c7012 100644
@@ -10,7 +10,7 @@
  */
 #include <linux/bug.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
arch/mips/mm/ioremap.c +1 -1
index 8d5008cbdc0f..1f189627440f 100644
@@ -6,7 +6,7 @@
  * (C) Copyright 1995 1996 Linus Torvalds
  * (C) Copyright 2001, 2002 Ralf Baechle
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/addrspace.h>
 #include <asm/byteorder.h>
 #include <linux/sched.h>
arch/mips/mm/mmap.c +1 -1
index 353037699512..d08ea3ff0f53 100644
@@ -10,7 +10,7 @@
 #include <linux/errno.h>
 #include <linux/mm.h>
 #include <linux/mman.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/personality.h>
 #include <linux/random.h>
 #include <linux/sched.h>
arch/mips/mm/page.c +0 -1
index c41953ca6605..6f804f5960ab 100644
@@ -12,7 +12,6 @@
 #include <linux/sched.h>
 #include <linux/smp.h>
 #include <linux/mm.h>
-#include <linux/module.h>
 #include <linux/proc_fs.h>
 
 #include <asm/bugs.h>
arch/mips/mm/tlb-r4k.c +1 -1
index e8b335c16295..d4aec9656495 100644
@@ -14,7 +14,7 @@
 #include <linux/smp.h>
 #include <linux/mm.h>
 #include <linux/hugetlb.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <asm/cpu.h>
 #include <asm/cpu-type.h>
Signature · 1 line
2.8.4
#3 lore raw

PATCH 3/5 mips/lib: Audit and remove any unnecessary uses of module.h

In reply to Paul Gortmaker

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. The advantage in doing so 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 obj-y/bool instance for the presence of either and replace as needed.

The compiler.h additions are for an implict presence of the "notrace" which module.h brought in but export.h does not.

---
 arch/mips/lib/ashldi3.c   | 2 +-
 arch/mips/lib/ashrdi3.c   | 2 +-
 arch/mips/lib/bswapdi.c   | 3 ++-
 arch/mips/lib/bswapsi.c   | 3 ++-
 arch/mips/lib/cmpdi2.c    | 2 +-
 arch/mips/lib/delay.c     | 2 +-
 arch/mips/lib/iomap-pci.c | 2 +-
 arch/mips/lib/iomap.c     | 2 +-
 arch/mips/lib/lshrdi3.c   | 2 +-
 arch/mips/lib/ucmpdi2.c   | 2 +-
 10 files changed, 12 insertions(+), 10 deletions(-)
arch/mips/lib/ashldi3.c +1 -1
index 927dc94a030f..c3e22053d13e 100644
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
arch/mips/lib/ashrdi3.c +1 -1
index 9fdf1a598428..17456024873d 100644
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
arch/mips/lib/bswapdi.c +2 -1
index e3e77aa52c95..a8114148f82a 100644
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/compiler.h>
 
 unsigned long long notrace __bswapdi2(unsigned long long u)
 {
arch/mips/lib/bswapsi.c +2 -1
index 530a8afe6fda..106fd978317d 100644
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/compiler.h>
 
 unsigned int notrace __bswapsi2(unsigned int u)
 {
arch/mips/lib/cmpdi2.c +1 -1
index 06857da96993..9d849d8743c9 100644
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
arch/mips/lib/delay.c +1 -1
index 21d27c6819a2..2307a3cb2714 100644
@@ -8,7 +8,7 @@
  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  * Copyright (C) 2007, 2014 Maciej W. Rozycki
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/param.h>
 #include <linux/smp.h>
 #include <linux/stringify.h>
arch/mips/lib/iomap-pci.c +1 -1
index fd35daa45314..a629077fd7b9 100644
@@ -7,7 +7,7 @@
  *     written by Ralf Baechle <[email protected]>
  */
 #include <linux/pci.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/io.h>
 
 void __iomem *__pci_ioport_map(struct pci_dev *dev,
arch/mips/lib/iomap.c +1 -1
index 8e7e378ce51c..9daa92428e23 100644
@@ -6,7 +6,7 @@
  * (C) Copyright 2007 MIPS Technologies, Inc.
  *     written by Ralf Baechle <[email protected]>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/io.h>
 
 /*
arch/mips/lib/lshrdi3.c +1 -1
index 364547449c65..221167c1be55 100644
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
arch/mips/lib/ucmpdi2.c +1 -1
index bd599f58234c..08067fa538f2 100644
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
Signature · 1 line
2.8.4
#4 lore raw

PATCH 4/5 mips/pci: Audit and remove any unnecessary uses of module.h

In reply to Paul Gortmaker

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. The advantage in doing so 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 obj-y/bool instance for the presence of either and replace as needed.

We also needed to remove the no-op MODULE_DEVICE_TABLE usage in several instances to permit removal of the module.h include. The files in these instances were all controlled by bool Kconfig.

In one instance, module_param was being used so we transition the module.h include onto a moduleparam.h include.

---
 arch/mips/pci/pci-ar71xx.c  | 2 +-
 arch/mips/pci/pci-ar724x.c  | 2 +-
 arch/mips/pci/pci-lantiq.c  | 2 --
 arch/mips/pci/pci-mt7620.c  | 2 --
 arch/mips/pci/pci-rt2880.c  | 2 --
 arch/mips/pci/pci-rt3883.c  | 2 --
 arch/mips/pci/pcie-octeon.c | 2 +-
 7 files changed, 3 insertions(+), 11 deletions(-)
arch/mips/pci/pci-ar71xx.c +1 -1
index 7db963deec73..bdf87b43633f 100644
@@ -18,7 +18,7 @@
 #include <linux/pci.h>
 #include <linux/pci_regs.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
arch/mips/pci/pci-ar724x.c +1 -1
index 2013dad700df..1e23c8d587bd 100644
@@ -11,7 +11,7 @@
 
 #include <linux/irq.h>
 #include <linux/pci.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <asm/mach-ath79/ath79.h>
 #include <asm/mach-ath79/ar71xx_regs.h>
arch/mips/pci/pci-lantiq.c +0 -2
index b9deab17ccf2..f18f887f481d 100644
@@ -13,7 +13,6 @@
 #include <linux/delay.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
 #include <linux/clk.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
@@ -234,7 +233,6 @@ static const struct of_device_id ltq_pci_match[] = {
 	{ .compatible = "lantiq,pci-xway" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, ltq_pci_match);
 
 static struct platform_driver ltq_pci_driver = {
 	.probe = ltq_pci_probe,
arch/mips/pci/pci-mt7620.c +0 -2
index eb39826a62c3..628c5132b3d8 100644
@@ -15,7 +15,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_pci.h>
@@ -407,7 +406,6 @@ static const struct of_device_id mt7620_pci_ids[] = {
 	{ .compatible = "mediatek,mt7620-pci" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, mt7620_pci_ids);
 
 static struct platform_driver mt7620_pci_driver = {
 	.probe = mt7620_pci_probe,
arch/mips/pci/pci-rt2880.c +0 -2
index f2a1050168d9..d6360fe73d05 100644
@@ -16,7 +16,6 @@
 #include <linux/pci.h>
 #include <linux/io.h>
 #include <linux/init.h>
-#include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/of_irq.h>
 #include <linux/of_pci.h>
@@ -260,7 +259,6 @@ static const struct of_device_id rt288x_pci_match[] = {
 	{ .compatible = "ralink,rt288x-pci" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, rt288x_pci_match);
 
 static struct platform_driver rt288x_pci_driver = {
 	.probe = rt288x_pci_probe,
arch/mips/pci/pci-rt3883.c +0 -2
index 53a42b07008b..3520e9b414e7 100644
@@ -16,7 +16,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_irq.h>
 #include <linux/of_pci.h>
@@ -580,7 +579,6 @@ static const struct of_device_id rt3883_pci_ids[] = {
 	{ .compatible = "ralink,rt3883-pci" },
 	{},
 };
-MODULE_DEVICE_TABLE(of, rt3883_pci_ids);
 
 static struct platform_driver rt3883_pci_driver = {
 	.probe = rt3883_pci_probe,
arch/mips/pci/pcie-octeon.c +1 -1
index 99f3db4f0a9b..9f672ceb089b 100644
@@ -11,7 +11,7 @@
 #include <linux/interrupt.h>
 #include <linux/time.h>
 #include <linux/delay.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 
 #include <asm/octeon/octeon.h>
 #include <asm/octeon/cvmx-npei-defs.h>
Signature · 1 line
2.8.4
#5 lore raw

PATCH 5/5 mips/kvm: Audit and remove any unnecessary uses of module.h

In reply to Paul Gortmaker

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 kvm where it is 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 this case, we did not need to add either to any files.

Cc Paolo Bonzini <[email protected]>
Cc "Radim Krčmář" <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
---
 arch/mips/kvm/commpage.c  | 1 -
 arch/mips/kvm/dyntrans.c  | 1 -
 arch/mips/kvm/emulate.c   | 1 -
 arch/mips/kvm/interrupt.c | 1 -
 arch/mips/kvm/trap_emul.c | 1 -
 5 files changed, 5 deletions(-)
arch/mips/kvm/commpage.c +0 -1
index a36b77e1705c..f43629979a0e 100644
@@ -12,7 +12,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/dyntrans.c +0 -1
index d280894915ed..b36c8ddc03ea 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/highmem.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/emulate.c +0 -1
index e788515f766b..68fd666f8cb9 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/ktime.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/interrupt.c +0 -1
index ad28dac6b7e9..e88403b3dcdd 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/trap_emul.c +0 -1
index 091553942bcb..21d80274ccff 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 
 #include <linux/kvm_host.h>
Signature · 1 line
2.8.4
Acked-by on v1 5/5
#6 lore raw

Re: [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h

Quoted 21 lines · Paul Gortmaker

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 kvm where it is 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 this case, we did not need to add either to any files.

Quoted 7 lines
Cc Paolo Bonzini <[email protected]>
Cc "Radim Krčmář" <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>

Thanks, looks good and builds fine with KVM enabled for me.

Cheers
James

Quoted 71 lines
---
 arch/mips/kvm/commpage.c  | 1 -
 arch/mips/kvm/dyntrans.c  | 1 -
 arch/mips/kvm/emulate.c   | 1 -
 arch/mips/kvm/interrupt.c | 1 -
 arch/mips/kvm/trap_emul.c | 1 -
 5 files changed, 5 deletions(-)
arch/mips/kvm/commpage.c +0 -1
index a36b77e1705c..f43629979a0e 100644
@@ -12,7 +12,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/dyntrans.c +0 -1
index d280894915ed..b36c8ddc03ea 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/highmem.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/emulate.c +0 -1
index e788515f766b..68fd666f8cb9 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/ktime.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/interrupt.c +0 -1
index ad28dac6b7e9..e88403b3dcdd 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/trap_emul.c +0 -1
index 091553942bcb..21d80274ccff 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 
 #include <linux/kvm_host.h>
Signature · 1 line
2.8.4
maintainer Acked-by
#7 lore raw

Re: [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h

Quoted 30 lines · James Hogan
Quoted 21 lines · Paul Gortmaker

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 kvm where it is 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 this case, we did not need to add either to any files.

Quoted 7 lines
Cc Paolo Bonzini <[email protected]>
Cc "Radim Krčmář" <[email protected]>
Cc James Hogan <[email protected]>
Cc Ralf Baechle <[email protected]>
Quoted 3 lines

Thanks, looks good and builds fine with KVM enabled for me.

Please merge through the MIPS tree.

Quoted 74 lines

Cheers
James

Quoted 71 lines
---
 arch/mips/kvm/commpage.c  | 1 -
 arch/mips/kvm/dyntrans.c  | 1 -
 arch/mips/kvm/emulate.c   | 1 -
 arch/mips/kvm/interrupt.c | 1 -
 arch/mips/kvm/trap_emul.c | 1 -
 5 files changed, 5 deletions(-)
arch/mips/kvm/commpage.c +0 -1
index a36b77e1705c..f43629979a0e 100644
@@ -12,7 +12,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/dyntrans.c +0 -1
index d280894915ed..b36c8ddc03ea 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/highmem.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/emulate.c +0 -1
index e788515f766b..68fd666f8cb9 100644
@@ -13,7 +13,6 @@
 #include <linux/err.h>
 #include <linux/ktime.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/interrupt.c +0 -1
index ad28dac6b7e9..e88403b3dcdd 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/bootmem.h>
arch/mips/kvm/trap_emul.c +0 -1
index 091553942bcb..21d80274ccff 100644
@@ -11,7 +11,6 @@
 
 #include <linux/errno.h>
 #include <linux/err.h>
-#include <linux/module.h>
 #include <linux/vmalloc.h>
 
 #include <linux/kvm_host.h>
Signature · 1 line
2.8.4