All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] mips: audit and remove needless module.h use from core
@ 2016-08-21 19:58 ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Gortmaker, James Hogan, kvm, Paolo Bonzini,
	Radim Krčmář,
	Ralf Baechle

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 <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>

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(-)

-- 
2.8.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/5] mips: audit and remove needless module.h use from core
@ 2016-08-21 19:58 ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Gortmaker, James Hogan, kvm, Paolo Bonzini,
	Radim Krčmář,
	Ralf Baechle

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 <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>

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(-)

-- 
2.8.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] mips/kernel: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index 58ad63d7eb42..9c7f3e136d50 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -1,5 +1,6 @@
 /*
  * Support for n32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle (ralf@linux-mips.org)
  *
  * 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 (ralf@linux-mips.org)");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 49fb881481f7..1ab34322dd97 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -1,5 +1,6 @@
 /*
  * Support for o32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle (ralf@linux-mips.org)
  *
  * 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 (ralf@linux-mips.org)");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 46c227fc98f5..f5c68483c98e 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -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>
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 0b29646bcee7..50fb62544df7 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -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>
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index c3372cac6db2..ffe3b9e67c94 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -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>
 
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index f95f094f36e4..5931bafada70 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/5] mips/kernel: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
index 58ad63d7eb42..9c7f3e136d50 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -1,5 +1,6 @@
 /*
  * Support for n32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle (ralf@linux-mips.org)
  *
  * 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 (ralf@linux-mips.org)");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
index 49fb881481f7..1ab34322dd97 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
@@ -1,5 +1,6 @@
 /*
  * Support for o32 Linux/MIPS ELF binaries.
+ * Author: Ralf Baechle (ralf@linux-mips.org)
  *
  * 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 (ralf@linux-mips.org)");
-
-#undef MODULE_DESCRIPTION
-#undef MODULE_AUTHOR
-
 #undef TASK_SIZE
 #define TASK_SIZE TASK_SIZE32
 
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c
index 46c227fc98f5..f5c68483c98e 100644
--- a/arch/mips/kernel/branch.c
+++ b/arch/mips/kernel/branch.c
@@ -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>
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 0b29646bcee7..50fb62544df7 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -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>
diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
index c3372cac6db2..ffe3b9e67c94 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -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>
 
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index f95f094f36e4..5931bafada70 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] mips/mm: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index cd72805b64a7..82889922e5b8 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -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>
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index bf04c6c479a4..208199e2d55b 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -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>
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b2eadd6fa9a1..755259c54976 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -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>
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 9560ad731120..d56a855828c2 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -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>
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index d7258a103439..f13f51003bd8 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -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>
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 2c3749d98f04..8fa31b3c7012 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -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>
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index 8d5008cbdc0f..1f189627440f 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -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>
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 353037699512..d08ea3ff0f53 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -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>
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index c41953ca6605..6f804f5960ab 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -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>
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index e8b335c16295..d4aec9656495 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/5] mips/mm: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index cd72805b64a7..82889922e5b8 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -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>
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index bf04c6c479a4..208199e2d55b 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -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>
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index b2eadd6fa9a1..755259c54976 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -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>
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 9560ad731120..d56a855828c2 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -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>
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index d7258a103439..f13f51003bd8 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -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>
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 2c3749d98f04..8fa31b3c7012 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -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>
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index 8d5008cbdc0f..1f189627440f 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -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>
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 353037699512..d08ea3ff0f53 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -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>
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c
index c41953ca6605..6f804f5960ab 100644
--- a/arch/mips/mm/page.c
+++ b/arch/mips/mm/page.c
@@ -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>
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index e8b335c16295..d4aec9656495 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] mips/lib: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
index 927dc94a030f..c3e22053d13e 100644
--- a/arch/mips/lib/ashldi3.c
+++ b/arch/mips/lib/ashldi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c
index 9fdf1a598428..17456024873d 100644
--- a/arch/mips/lib/ashrdi3.c
+++ b/arch/mips/lib/ashrdi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c
index e3e77aa52c95..a8114148f82a 100644
--- a/arch/mips/lib/bswapdi.c
+++ b/arch/mips/lib/bswapdi.c
@@ -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)
 {
diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c
index 530a8afe6fda..106fd978317d 100644
--- a/arch/mips/lib/bswapsi.c
+++ b/arch/mips/lib/bswapsi.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/compiler.h>
 
 unsigned int notrace __bswapsi2(unsigned int u)
 {
diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c
index 06857da96993..9d849d8743c9 100644
--- a/arch/mips/lib/cmpdi2.c
+++ b/arch/mips/lib/cmpdi2.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 21d27c6819a2..2307a3cb2714 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -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>
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c
index fd35daa45314..a629077fd7b9 100644
--- a/arch/mips/lib/iomap-pci.c
+++ b/arch/mips/lib/iomap-pci.c
@@ -7,7 +7,7 @@
  *     written by Ralf Baechle <ralf@linux-mips.org>
  */
 #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,
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
index 8e7e378ce51c..9daa92428e23 100644
--- a/arch/mips/lib/iomap.c
+++ b/arch/mips/lib/iomap.c
@@ -6,7 +6,7 @@
  * (C) Copyright 2007 MIPS Technologies, Inc.
  *     written by Ralf Baechle <ralf@linux-mips.org>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/io.h>
 
 /*
diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c
index 364547449c65..221167c1be55 100644
--- a/arch/mips/lib/lshrdi3.c
+++ b/arch/mips/lib/lshrdi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c
index bd599f58234c..08067fa538f2 100644
--- a/arch/mips/lib/ucmpdi2.c
+++ b/arch/mips/lib/ucmpdi2.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/5] mips/lib: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/lib/ashldi3.c b/arch/mips/lib/ashldi3.c
index 927dc94a030f..c3e22053d13e 100644
--- a/arch/mips/lib/ashldi3.c
+++ b/arch/mips/lib/ashldi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/ashrdi3.c b/arch/mips/lib/ashrdi3.c
index 9fdf1a598428..17456024873d 100644
--- a/arch/mips/lib/ashrdi3.c
+++ b/arch/mips/lib/ashrdi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/bswapdi.c b/arch/mips/lib/bswapdi.c
index e3e77aa52c95..a8114148f82a 100644
--- a/arch/mips/lib/bswapdi.c
+++ b/arch/mips/lib/bswapdi.c
@@ -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)
 {
diff --git a/arch/mips/lib/bswapsi.c b/arch/mips/lib/bswapsi.c
index 530a8afe6fda..106fd978317d 100644
--- a/arch/mips/lib/bswapsi.c
+++ b/arch/mips/lib/bswapsi.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/compiler.h>
 
 unsigned int notrace __bswapsi2(unsigned int u)
 {
diff --git a/arch/mips/lib/cmpdi2.c b/arch/mips/lib/cmpdi2.c
index 06857da96993..9d849d8743c9 100644
--- a/arch/mips/lib/cmpdi2.c
+++ b/arch/mips/lib/cmpdi2.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/delay.c b/arch/mips/lib/delay.c
index 21d27c6819a2..2307a3cb2714 100644
--- a/arch/mips/lib/delay.c
+++ b/arch/mips/lib/delay.c
@@ -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>
diff --git a/arch/mips/lib/iomap-pci.c b/arch/mips/lib/iomap-pci.c
index fd35daa45314..a629077fd7b9 100644
--- a/arch/mips/lib/iomap-pci.c
+++ b/arch/mips/lib/iomap-pci.c
@@ -7,7 +7,7 @@
  *     written by Ralf Baechle <ralf@linux-mips.org>
  */
 #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,
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
index 8e7e378ce51c..9daa92428e23 100644
--- a/arch/mips/lib/iomap.c
+++ b/arch/mips/lib/iomap.c
@@ -6,7 +6,7 @@
  * (C) Copyright 2007 MIPS Technologies, Inc.
  *     written by Ralf Baechle <ralf@linux-mips.org>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/io.h>
 
 /*
diff --git a/arch/mips/lib/lshrdi3.c b/arch/mips/lib/lshrdi3.c
index 364547449c65..221167c1be55 100644
--- a/arch/mips/lib/lshrdi3.c
+++ b/arch/mips/lib/lshrdi3.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
diff --git a/arch/mips/lib/ucmpdi2.c b/arch/mips/lib/ucmpdi2.c
index bd599f58234c..08067fa538f2 100644
--- a/arch/mips/lib/ucmpdi2.c
+++ b/arch/mips/lib/ucmpdi2.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include "libgcc.h"
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] mips/pci: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 7db963deec73..bdf87b43633f 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -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>
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 2013dad700df..1e23c8d587bd 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -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>
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index b9deab17ccf2..f18f887f481d 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -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,
diff --git a/arch/mips/pci/pci-mt7620.c b/arch/mips/pci/pci-mt7620.c
index eb39826a62c3..628c5132b3d8 100644
--- a/arch/mips/pci/pci-mt7620.c
+++ b/arch/mips/pci/pci-mt7620.c
@@ -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,
diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c
index f2a1050168d9..d6360fe73d05 100644
--- a/arch/mips/pci/pci-rt2880.c
+++ b/arch/mips/pci/pci-rt2880.c
@@ -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,
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index 53a42b07008b..3520e9b414e7 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -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,
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 99f3db4f0a9b..9f672ceb089b 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/5] mips/pci: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips; +Cc: Paul Gortmaker, Ralf Baechle

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.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/pci/pci-ar71xx.c b/arch/mips/pci/pci-ar71xx.c
index 7db963deec73..bdf87b43633f 100644
--- a/arch/mips/pci/pci-ar71xx.c
+++ b/arch/mips/pci/pci-ar71xx.c
@@ -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>
diff --git a/arch/mips/pci/pci-ar724x.c b/arch/mips/pci/pci-ar724x.c
index 2013dad700df..1e23c8d587bd 100644
--- a/arch/mips/pci/pci-ar724x.c
+++ b/arch/mips/pci/pci-ar724x.c
@@ -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>
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index b9deab17ccf2..f18f887f481d 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -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,
diff --git a/arch/mips/pci/pci-mt7620.c b/arch/mips/pci/pci-mt7620.c
index eb39826a62c3..628c5132b3d8 100644
--- a/arch/mips/pci/pci-mt7620.c
+++ b/arch/mips/pci/pci-mt7620.c
@@ -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,
diff --git a/arch/mips/pci/pci-rt2880.c b/arch/mips/pci/pci-rt2880.c
index f2a1050168d9..d6360fe73d05 100644
--- a/arch/mips/pci/pci-rt2880.c
+++ b/arch/mips/pci/pci-rt2880.c
@@ -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,
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index 53a42b07008b..3520e9b414e7 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -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,
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 99f3db4f0a9b..9f672ceb089b 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Gortmaker, Paolo Bonzini, Radim Krčmář,
	James Hogan, Ralf Baechle, kvm

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 <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/kvm/commpage.c b/arch/mips/kvm/commpage.c
index a36b77e1705c..f43629979a0e 100644
--- a/arch/mips/kvm/commpage.c
+++ b/arch/mips/kvm/commpage.c
@@ -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>
diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c
index d280894915ed..b36c8ddc03ea 100644
--- a/arch/mips/kvm/dyntrans.c
+++ b/arch/mips/kvm/dyntrans.c
@@ -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>
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index e788515f766b..68fd666f8cb9 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -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>
diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
index ad28dac6b7e9..e88403b3dcdd 100644
--- a/arch/mips/kvm/interrupt.c
+++ b/arch/mips/kvm/interrupt.c
@@ -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>
diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
index 091553942bcb..21d80274ccff 100644
--- a/arch/mips/kvm/trap_emul.c
+++ b/arch/mips/kvm/trap_emul.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h
@ 2016-08-21 19:58   ` Paul Gortmaker
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Gortmaker @ 2016-08-21 19:58 UTC (permalink / raw)
  To: linux-mips
  Cc: Paul Gortmaker, Paolo Bonzini, Radim Krčmář,
	James Hogan, Ralf Baechle, kvm

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 <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: kvm@vger.kernel.org
Cc: linux-mips@linux-mips.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/arch/mips/kvm/commpage.c b/arch/mips/kvm/commpage.c
index a36b77e1705c..f43629979a0e 100644
--- a/arch/mips/kvm/commpage.c
+++ b/arch/mips/kvm/commpage.c
@@ -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>
diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c
index d280894915ed..b36c8ddc03ea 100644
--- a/arch/mips/kvm/dyntrans.c
+++ b/arch/mips/kvm/dyntrans.c
@@ -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>
diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
index e788515f766b..68fd666f8cb9 100644
--- a/arch/mips/kvm/emulate.c
+++ b/arch/mips/kvm/emulate.c
@@ -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>
diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
index ad28dac6b7e9..e88403b3dcdd 100644
--- a/arch/mips/kvm/interrupt.c
+++ b/arch/mips/kvm/interrupt.c
@@ -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>
diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
index 091553942bcb..21d80274ccff 100644
--- a/arch/mips/kvm/trap_emul.c
+++ b/arch/mips/kvm/trap_emul.c
@@ -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>
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h
  2016-08-21 19:58   ` Paul Gortmaker
  (?)
@ 2016-08-22 12:14   ` James Hogan
  2016-08-29 11:59     ` Paolo Bonzini
  -1 siblings, 1 reply; 14+ messages in thread
From: James Hogan @ 2016-08-22 12:14 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-mips, Paolo Bonzini, Radim Krčmář,
	Ralf Baechle, kvm

[-- Attachment #1: Type: text/plain, Size: 3775 bytes --]

On Sun, Aug 21, 2016 at 03:58:17PM -0400, Paul Gortmaker wrote:
> 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 <pbonzini@redhat.com>
> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: kvm@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

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

Acked-by: James Hogan <james.hogan@imgtec.com>

Cheers
James

> ---
>  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(-)
> 
> diff --git a/arch/mips/kvm/commpage.c b/arch/mips/kvm/commpage.c
> index a36b77e1705c..f43629979a0e 100644
> --- a/arch/mips/kvm/commpage.c
> +++ b/arch/mips/kvm/commpage.c
> @@ -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>
> diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c
> index d280894915ed..b36c8ddc03ea 100644
> --- a/arch/mips/kvm/dyntrans.c
> +++ b/arch/mips/kvm/dyntrans.c
> @@ -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>
> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
> index e788515f766b..68fd666f8cb9 100644
> --- a/arch/mips/kvm/emulate.c
> +++ b/arch/mips/kvm/emulate.c
> @@ -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>
> diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
> index ad28dac6b7e9..e88403b3dcdd 100644
> --- a/arch/mips/kvm/interrupt.c
> +++ b/arch/mips/kvm/interrupt.c
> @@ -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>
> diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
> index 091553942bcb..21d80274ccff 100644
> --- a/arch/mips/kvm/trap_emul.c
> +++ b/arch/mips/kvm/trap_emul.c
> @@ -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>
> -- 
> 2.8.4
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] mips/kvm: Audit and remove any unnecessary uses of module.h
  2016-08-22 12:14   ` James Hogan
@ 2016-08-29 11:59     ` Paolo Bonzini
  0 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2016-08-29 11:59 UTC (permalink / raw)
  To: James Hogan, Paul Gortmaker
  Cc: linux-mips, Radim Krčmář, Ralf Baechle, kvm



On 22/08/2016 14:14, James Hogan wrote:
> On Sun, Aug 21, 2016 at 03:58:17PM -0400, Paul Gortmaker wrote:
>> 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 <pbonzini@redhat.com>
>> Cc: "Radim Krčmář" <rkrcmar@redhat.com>
>> Cc: James Hogan <james.hogan@imgtec.com>
>> Cc: Ralf Baechle <ralf@linux-mips.org>
>> Cc: kvm@vger.kernel.org
>> Cc: linux-mips@linux-mips.org
>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> 
> Thanks, looks good and builds fine with KVM enabled for me.
> 
> Acked-by: James Hogan <james.hogan@imgtec.com>

Please merge through the MIPS tree.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

> Cheers
> James
> 
>> ---
>>  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(-)
>>
>> diff --git a/arch/mips/kvm/commpage.c b/arch/mips/kvm/commpage.c
>> index a36b77e1705c..f43629979a0e 100644
>> --- a/arch/mips/kvm/commpage.c
>> +++ b/arch/mips/kvm/commpage.c
>> @@ -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>
>> diff --git a/arch/mips/kvm/dyntrans.c b/arch/mips/kvm/dyntrans.c
>> index d280894915ed..b36c8ddc03ea 100644
>> --- a/arch/mips/kvm/dyntrans.c
>> +++ b/arch/mips/kvm/dyntrans.c
>> @@ -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>
>> diff --git a/arch/mips/kvm/emulate.c b/arch/mips/kvm/emulate.c
>> index e788515f766b..68fd666f8cb9 100644
>> --- a/arch/mips/kvm/emulate.c
>> +++ b/arch/mips/kvm/emulate.c
>> @@ -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>
>> diff --git a/arch/mips/kvm/interrupt.c b/arch/mips/kvm/interrupt.c
>> index ad28dac6b7e9..e88403b3dcdd 100644
>> --- a/arch/mips/kvm/interrupt.c
>> +++ b/arch/mips/kvm/interrupt.c
>> @@ -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>
>> diff --git a/arch/mips/kvm/trap_emul.c b/arch/mips/kvm/trap_emul.c
>> index 091553942bcb..21d80274ccff 100644
>> --- a/arch/mips/kvm/trap_emul.c
>> +++ b/arch/mips/kvm/trap_emul.c
>> @@ -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>
>> -- 
>> 2.8.4
>>

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-08-29 11:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-21 19:58 [PATCH 0/5] mips: audit and remove needless module.h use from core Paul Gortmaker
2016-08-21 19:58 ` Paul Gortmaker
2016-08-21 19:58 ` [PATCH 1/5] mips/kernel: Audit and remove any unnecessary uses of module.h Paul Gortmaker
2016-08-21 19:58   ` Paul Gortmaker
2016-08-21 19:58 ` [PATCH 2/5] mips/mm: " Paul Gortmaker
2016-08-21 19:58   ` Paul Gortmaker
2016-08-21 19:58 ` [PATCH 3/5] mips/lib: " Paul Gortmaker
2016-08-21 19:58   ` Paul Gortmaker
2016-08-21 19:58 ` [PATCH 4/5] mips/pci: " Paul Gortmaker
2016-08-21 19:58   ` Paul Gortmaker
2016-08-21 19:58 ` [PATCH 5/5] mips/kvm: " Paul Gortmaker
2016-08-21 19:58   ` Paul Gortmaker
2016-08-22 12:14   ` James Hogan
2016-08-29 11:59     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.