linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] x86: audit and remove needless module.h includes
@ 2016-07-14  0:18 Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
                   ` (8 more replies)
  0 siblings, 9 replies; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel

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.

In this series we manage to remove about 120 includes of module.h that
just simply don't need to exist anymore in arch/x86.

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 tackle the remainder in the final commit.  This seemed like
a better solution than one giant commit, since it covers some distinct
subsystems like kvm and xen for ease of review for those folks.

There is no urgency to get this in tree, it can easily wait three
weeks.  That said, 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 allmodconfig, allyesconfig and allnoconfig
for both 32 bit and 64 bit x86 with these changes on the linux-next
from today, which presumably has an up to date copy of tip in it.

Paul.

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

---

Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm@vger.kernel.org
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org

Paul Gortmaker (8):
  x86: don't use module.h just for AUTHOR / LICENSE tags
  x86: mm: audit and remove any unnecessary uses of module.h
  x86: kernel: audit and remove any unnecessary uses of module.h
  x86: lib: audit and remove any unnecessary uses of module.h
  x86: platform: audit and remove any unnecessary uses of module.h
  x86: xen: audit and remove any unnecessary uses of module.h
  x86: kvm: audit and remove any unnecessary uses of module.h
  x86: audit and remove any remaining unnecessary uses of module.h

 arch/x86/crypto/glue_helper.c           | 4 +---
 arch/x86/events/amd/ibs.c               | 3 ++-
 arch/x86/events/amd/iommu.c             | 2 +-
 arch/x86/events/core.c                  | 3 ++-
 arch/x86/events/intel/uncore.c          | 2 ++
 arch/x86/events/intel/uncore.h          | 1 -
 arch/x86/include/asm/livepatch.h        | 1 -
 arch/x86/include/asm/topology.h         | 1 +
 arch/x86/kernel/acpi/boot.c             | 2 +-
 arch/x86/kernel/acpi/cstate.c           | 2 +-
 arch/x86/kernel/amd_gart_64.c           | 1 -
 arch/x86/kernel/amd_nb.c                | 2 +-
 arch/x86/kernel/apic/apic.c             | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c     | 2 +-
 arch/x86/kernel/apic/apic_noop.c        | 1 -
 arch/x86/kernel/apic/hw_nmi.c           | 2 +-
 arch/x86/kernel/apic/io_apic.c          | 2 +-
 arch/x86/kernel/apic/ipi.c              | 1 -
 arch/x86/kernel/apic/probe_32.c         | 2 +-
 arch/x86/kernel/apic/probe_64.c         | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c      | 2 +-
 arch/x86/kernel/cpu/common.c            | 2 +-
 arch/x86/kernel/cpu/hypervisor.c        | 3 ++-
 arch/x86/kernel/cpu/intel.c             | 2 +-
 arch/x86/kernel/cpu/match.c             | 2 +-
 arch/x86/kernel/cpu/mshyperv.c          | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c      | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c      | 2 +-
 arch/x86/kernel/cpu/mtrr/if.c           | 1 -
 arch/x86/kernel/cpu/mtrr/main.c         | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c  | 2 +-
 arch/x86/kernel/cpu/vmware.c            | 3 ++-
 arch/x86/kernel/crash.c                 | 2 +-
 arch/x86/kernel/dumpstack.c             | 3 ++-
 arch/x86/kernel/dumpstack_32.c          | 2 +-
 arch/x86/kernel/dumpstack_64.c          | 2 +-
 arch/x86/kernel/hw_breakpoint.c         | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c         | 2 +-
 arch/x86/kernel/i8253.c                 | 2 +-
 arch/x86/kernel/io_delay.c              | 2 +-
 arch/x86/kernel/irq_32.c                | 1 -
 arch/x86/kernel/irq_64.c                | 1 -
 arch/x86/kernel/kdebugfs.c              | 2 +-
 arch/x86/kernel/kvm.c                   | 2 +-
 arch/x86/kernel/mpparse.c               | 1 -
 arch/x86/kernel/paravirt-spinlocks.c    | 2 +-
 arch/x86/kernel/paravirt.c              | 3 ++-
 arch/x86/kernel/pci-swiotlb.c           | 2 +-
 arch/x86/kernel/pmem.c                  | 2 +-
 arch/x86/kernel/process.c               | 3 ++-
 arch/x86/kernel/process_32.c            | 2 +-
 arch/x86/kernel/process_64.c            | 2 +-
 arch/x86/kernel/reboot.c                | 2 +-
 arch/x86/kernel/setup.c                 | 2 +-
 arch/x86/kernel/setup_percpu.c          | 2 +-
 arch/x86/kernel/smpboot.c               | 2 +-
 arch/x86/kernel/stacktrace.c            | 2 +-
 arch/x86/kernel/test_rodata.c           | 5 -----
 arch/x86/kernel/traps.c                 | 2 +-
 arch/x86/kernel/tsc.c                   | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c        | 2 +-
 arch/x86/kernel/x86_init.c              | 2 +-
 arch/x86/kvm/cpuid.c                    | 2 +-
 arch/x86/kvm/emulate.c                  | 1 -
 arch/x86/kvm/iommu.c                    | 2 +-
 arch/x86/kvm/irq.c                      | 2 +-
 arch/x86/kvm/lapic.c                    | 2 +-
 arch/x86/kvm/mmu.c                      | 3 ++-
 arch/x86/kvm/x86.c                      | 3 ++-
 arch/x86/lib/cache-smp.c                | 2 +-
 arch/x86/lib/cpu.c                      | 3 ++-
 arch/x86/lib/csum-partial_64.c          | 2 +-
 arch/x86/lib/csum-wrappers_64.c         | 2 +-
 arch/x86/lib/delay.c                    | 2 +-
 arch/x86/lib/memcpy_32.c                | 2 +-
 arch/x86/lib/mmx_32.c                   | 2 +-
 arch/x86/lib/msr-reg-export.c           | 2 +-
 arch/x86/lib/msr-smp.c                  | 2 +-
 arch/x86/lib/msr.c                      | 2 +-
 arch/x86/lib/string_32.c                | 2 +-
 arch/x86/lib/usercopy.c                 | 2 +-
 arch/x86/lib/usercopy_32.c              | 2 +-
 arch/x86/lib/usercopy_64.c              | 2 +-
 arch/x86/mm/amdtopology.c               | 1 -
 arch/x86/mm/dump_pagetables.c           | 6 +-----
 arch/x86/mm/highmem_32.c                | 2 +-
 arch/x86/mm/init_32.c                   | 1 -
 arch/x86/mm/init_64.c                   | 1 -
 arch/x86/mm/iomap_32.c                  | 2 +-
 arch/x86/mm/ioremap.c                   | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c       | 1 -
 arch/x86/mm/kmemcheck/shadow.c          | 2 +-
 arch/x86/mm/kmmio.c                     | 2 +-
 arch/x86/mm/mmio-mod.c                  | 2 +-
 arch/x86/mm/numa.c                      | 1 -
 arch/x86/mm/numa_32.c                   | 2 +-
 arch/x86/mm/pat.c                       | 1 -
 arch/x86/mm/pat_rbtree.c                | 1 -
 arch/x86/mm/pf_in.c                     | 1 -
 arch/x86/mm/pgtable_32.c                | 1 -
 arch/x86/mm/physaddr.c                  | 2 +-
 arch/x86/mm/srat.c                      | 2 +-
 arch/x86/mm/tlb.c                       | 2 +-
 arch/x86/pci/xen.c                      | 2 +-
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 2 +-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 arch/x86/um/delay.c                     | 2 +-
 arch/x86/xen/debugfs.c                  | 1 -
 arch/x86/xen/enlighten.c                | 2 +-
 arch/x86/xen/mmu.c                      | 3 ++-
 arch/x86/xen/p2m.c                      | 2 +-
 arch/x86/xen/platform-pci-unplug.c      | 2 +-
 arch/x86/xen/setup.c                    | 2 +-
 121 files changed, 112 insertions(+), 131 deletions(-)

-- 
2.8.4

Paul Gortmaker (8):
  x86: don't use module.h just for AUTHOR / LICENSE tags
  x86: mm: audit and remove any unnecessary uses of module.h
  x86: kernel: audit and remove any unnecessary uses of module.h
  x86: lib: audit and remove any unnecessary uses of module.h
  x86: platform: audit and remove any unnecessary uses of module.h
  x86: xen: audit and remove any unnecessary uses of module.h
  x86: kvm: audit and remove any unnecessary uses of module.h
  x86: audit and remove any remaining unnecessary uses of module.h

 arch/x86/crypto/glue_helper.c           | 4 +---
 arch/x86/events/amd/ibs.c               | 3 ++-
 arch/x86/events/amd/iommu.c             | 2 +-
 arch/x86/events/core.c                  | 3 ++-
 arch/x86/events/intel/uncore.c          | 2 ++
 arch/x86/events/intel/uncore.h          | 1 -
 arch/x86/include/asm/livepatch.h        | 1 -
 arch/x86/include/asm/topology.h         | 1 +
 arch/x86/kernel/acpi/boot.c             | 2 +-
 arch/x86/kernel/acpi/cstate.c           | 2 +-
 arch/x86/kernel/amd_gart_64.c           | 1 -
 arch/x86/kernel/amd_nb.c                | 2 +-
 arch/x86/kernel/apic/apic.c             | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c     | 2 +-
 arch/x86/kernel/apic/apic_noop.c        | 1 -
 arch/x86/kernel/apic/hw_nmi.c           | 2 +-
 arch/x86/kernel/apic/io_apic.c          | 2 +-
 arch/x86/kernel/apic/ipi.c              | 1 -
 arch/x86/kernel/apic/probe_32.c         | 2 +-
 arch/x86/kernel/apic/probe_64.c         | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c      | 2 +-
 arch/x86/kernel/cpu/common.c            | 2 +-
 arch/x86/kernel/cpu/hypervisor.c        | 3 ++-
 arch/x86/kernel/cpu/intel.c             | 2 +-
 arch/x86/kernel/cpu/match.c             | 2 +-
 arch/x86/kernel/cpu/mshyperv.c          | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c      | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c      | 2 +-
 arch/x86/kernel/cpu/mtrr/if.c           | 1 -
 arch/x86/kernel/cpu/mtrr/main.c         | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c  | 2 +-
 arch/x86/kernel/cpu/vmware.c            | 3 ++-
 arch/x86/kernel/crash.c                 | 2 +-
 arch/x86/kernel/dumpstack_32.c          | 2 +-
 arch/x86/kernel/dumpstack_64.c          | 2 +-
 arch/x86/kernel/hw_breakpoint.c         | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c         | 3 ++-
 arch/x86/kernel/i8253.c                 | 2 +-
 arch/x86/kernel/io_delay.c              | 2 +-
 arch/x86/kernel/irq_32.c                | 1 -
 arch/x86/kernel/irq_64.c                | 1 -
 arch/x86/kernel/kdebugfs.c              | 2 +-
 arch/x86/kernel/kvm.c                   | 2 +-
 arch/x86/kernel/mpparse.c               | 1 -
 arch/x86/kernel/paravirt-spinlocks.c    | 2 +-
 arch/x86/kernel/paravirt.c              | 3 ++-
 arch/x86/kernel/pci-swiotlb.c           | 2 +-
 arch/x86/kernel/pmem.c                  | 2 +-
 arch/x86/kernel/process.c               | 3 ++-
 arch/x86/kernel/process_32.c            | 2 +-
 arch/x86/kernel/process_64.c            | 2 +-
 arch/x86/kernel/reboot.c                | 2 +-
 arch/x86/kernel/setup.c                 | 2 +-
 arch/x86/kernel/setup_percpu.c          | 2 +-
 arch/x86/kernel/smpboot.c               | 2 +-
 arch/x86/kernel/stacktrace.c            | 2 +-
 arch/x86/kernel/test_rodata.c           | 5 -----
 arch/x86/kernel/traps.c                 | 2 +-
 arch/x86/kernel/tsc.c                   | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c        | 2 +-
 arch/x86/kernel/x86_init.c              | 2 +-
 arch/x86/kvm/cpuid.c                    | 2 +-
 arch/x86/kvm/emulate.c                  | 1 -
 arch/x86/kvm/iommu.c                    | 2 +-
 arch/x86/kvm/irq.c                      | 2 +-
 arch/x86/kvm/lapic.c                    | 2 +-
 arch/x86/kvm/mmu.c                      | 3 ++-
 arch/x86/kvm/x86.c                      | 3 ++-
 arch/x86/lib/cache-smp.c                | 2 +-
 arch/x86/lib/cpu.c                      | 3 ++-
 arch/x86/lib/csum-partial_64.c          | 2 +-
 arch/x86/lib/csum-wrappers_64.c         | 2 +-
 arch/x86/lib/delay.c                    | 2 +-
 arch/x86/lib/memcpy_32.c                | 2 +-
 arch/x86/lib/mmx_32.c                   | 2 +-
 arch/x86/lib/msr-reg-export.c           | 2 +-
 arch/x86/lib/msr-smp.c                  | 2 +-
 arch/x86/lib/msr.c                      | 3 ++-
 arch/x86/lib/string_32.c                | 2 +-
 arch/x86/lib/usercopy.c                 | 2 +-
 arch/x86/lib/usercopy_32.c              | 2 +-
 arch/x86/lib/usercopy_64.c              | 2 +-
 arch/x86/mm/amdtopology.c               | 1 -
 arch/x86/mm/dump_pagetables.c           | 6 +-----
 arch/x86/mm/highmem_32.c                | 2 +-
 arch/x86/mm/init_32.c                   | 1 -
 arch/x86/mm/init_64.c                   | 1 -
 arch/x86/mm/iomap_32.c                  | 2 +-
 arch/x86/mm/ioremap.c                   | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c       | 1 -
 arch/x86/mm/kmemcheck/shadow.c          | 2 +-
 arch/x86/mm/kmmio.c                     | 2 +-
 arch/x86/mm/mmio-mod.c                  | 2 +-
 arch/x86/mm/numa.c                      | 1 -
 arch/x86/mm/numa_32.c                   | 2 +-
 arch/x86/mm/pat.c                       | 1 -
 arch/x86/mm/pat_rbtree.c                | 1 -
 arch/x86/mm/pf_in.c                     | 1 -
 arch/x86/mm/pgtable_32.c                | 1 -
 arch/x86/mm/physaddr.c                  | 2 +-
 arch/x86/mm/srat.c                      | 2 +-
 arch/x86/mm/tlb.c                       | 2 +-
 arch/x86/pci/xen.c                      | 2 +-
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 5 ++++-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 arch/x86/um/delay.c                     | 2 +-
 arch/x86/xen/debugfs.c                  | 1 -
 arch/x86/xen/enlighten.c                | 2 +-
 arch/x86/xen/mmu.c                      | 3 ++-
 arch/x86/xen/p2m.c                      | 2 +-
 arch/x86/xen/platform-pci-unplug.c      | 2 +-
 arch/x86/xen/setup.c                    | 2 +-
 120 files changed, 115 insertions(+), 130 deletions(-)

-- 
2.8.4

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

* [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14  0:22   ` Arjan van de Ven
  2016-07-14 18:43   ` [tip:x86/headers] x86: Don't " tip-bot for Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 2/8] x86: mm: audit and remove any unnecessary uses of module.h Paul Gortmaker
                   ` (7 subsequent siblings)
  8 siblings, 2 replies; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Arjan van de Ven, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86

The Kconfig controlling compilation of these files are:

arch/x86/Kconfig.debug:config DEBUG_RODATA_TEST
arch/x86/Kconfig.debug: bool "Testcase for the marking rodata read-only"

arch/x86/Kconfig.debug:config X86_PTDUMP_CORE
arch/x86/Kconfig.debug: def_bool n

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/kernel/test_rodata.c | 5 -----
 arch/x86/mm/dump_pagetables.c | 6 +-----
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/arch/x86/kernel/test_rodata.c b/arch/x86/kernel/test_rodata.c
index cb4a01b41e27..222e84e2432e 100644
--- a/arch/x86/kernel/test_rodata.c
+++ b/arch/x86/kernel/test_rodata.c
@@ -9,7 +9,6 @@
  * as published by the Free Software Foundation; version 2
  * of the License.
  */
-#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/sections.h>
 #include <asm/asm.h>
@@ -74,7 +73,3 @@ int rodata_test(void)
 
 	return 0;
 }
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Testcase for marking rodata as read-only");
-MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 9a17250bcbe0..ea9c49adaa1f 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -14,7 +14,7 @@
 
 #include <linux/debugfs.h>
 #include <linux/mm.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/seq_file.h>
 
 #include <asm/pgtable.h>
@@ -454,8 +454,4 @@ static int __init pt_dump_init(void)
 
 	return 0;
 }
-
 __initcall(pt_dump_init);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
-MODULE_DESCRIPTION("Kernel debugging helper that dumps pagetables");
-- 
2.8.4

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

* [PATCH 2/8] x86: mm: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14 18:43   ` [tip:x86/headers] x86/mm: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 3/8] x86: kernel: audit " Paul Gortmaker
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

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 accordingly where needed.

Note that some bool/obj-y instances remain since module.h is
the header for some exception table entry stuff, and for things
like __init_or_module (code that is tossed when MODULES=n).

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/mm/amdtopology.c         | 1 -
 arch/x86/mm/highmem_32.c          | 2 +-
 arch/x86/mm/init_32.c             | 1 -
 arch/x86/mm/init_64.c             | 1 -
 arch/x86/mm/iomap_32.c            | 2 +-
 arch/x86/mm/ioremap.c             | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c | 1 -
 arch/x86/mm/kmemcheck/shadow.c    | 2 +-
 arch/x86/mm/kmmio.c               | 2 +-
 arch/x86/mm/mmio-mod.c            | 2 +-
 arch/x86/mm/numa.c                | 1 -
 arch/x86/mm/numa_32.c             | 2 +-
 arch/x86/mm/pat.c                 | 1 -
 arch/x86/mm/pat_rbtree.c          | 1 -
 arch/x86/mm/pf_in.c               | 1 -
 arch/x86/mm/pgtable_32.c          | 1 -
 arch/x86/mm/physaddr.c            | 2 +-
 arch/x86/mm/srat.c                | 2 +-
 arch/x86/mm/tlb.c                 | 2 +-
 19 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c
index 2ca15b59fb3f..ba47524f56e8 100644
--- a/arch/x86/mm/amdtopology.c
+++ b/arch/x86/mm/amdtopology.c
@@ -9,7 +9,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/string.h>
-#include <linux/module.h>
 #include <linux/nodemask.h>
 #include <linux/memblock.h>
 #include <linux/bootmem.h>
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index a6d739258137..6d18b70ed5a9 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -1,5 +1,5 @@
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/swap.h> /* for totalram_pages */
 #include <linux/bootmem.h>
 
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 84df150ee77e..cf8059016ec8 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -5,7 +5,6 @@
  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  */
 
-#include <linux/module.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 7bf1ddb54537..b35cfa58d991 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -27,7 +27,6 @@
 #include <linux/pfn.h>
 #include <linux/poison.h>
 #include <linux/dma-mapping.h>
-#include <linux/module.h>
 #include <linux/memory.h>
 #include <linux/memory_hotplug.h>
 #include <linux/memremap.h>
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index 9c0ff045fdd4..ada98b39b8ad 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -18,7 +18,7 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/highmem.h>
 
 static int is_io_mapping_possible(resource_size_t base, unsigned long size)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index f0894910bdd7..7aaa2635862d 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -9,7 +9,6 @@
 #include <linux/bootmem.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/mmiotrace.h>
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b4f2e7e9e907..4515bae36bbe 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/kmemcheck.h>
 #include <linux/mm.h>
-#include <linux/module.h>
 #include <linux/page-flags.h>
 #include <linux/percpu.h>
 #include <linux/ptrace.h>
diff --git a/arch/x86/mm/kmemcheck/shadow.c b/arch/x86/mm/kmemcheck/shadow.c
index aec124214d97..c2638a7d2c10 100644
--- a/arch/x86/mm/kmemcheck/shadow.c
+++ b/arch/x86/mm/kmemcheck/shadow.c
@@ -1,5 +1,5 @@
 #include <linux/kmemcheck.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 
 #include <asm/page.h>
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index ddb2244b06a1..afc47f5c9531 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -11,7 +11,7 @@
 #include <linux/rculist.h>
 #include <linux/spinlock.h>
 #include <linux/hash.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/uaccess.h>
 #include <linux/ptrace.h>
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 0057a7accfb1..bef36622e408 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -24,7 +24,7 @@
 
 #define DEBUG 1
 
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 968ac028c34e..fb682108f4dc 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -8,7 +8,6 @@
 #include <linux/memblock.h>
 #include <linux/mmzone.h>
 #include <linux/ctype.h>
-#include <linux/module.h>
 #include <linux/nodemask.h>
 #include <linux/sched.h>
 #include <linux/topology.h>
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 47b6436e41c2..6b7ce6279133 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -24,7 +24,7 @@
 
 #include <linux/bootmem.h>
 #include <linux/memblock.h>
-#include <linux/module.h>
+#include <linux/init.h>
 
 #include "numa_internal.h"
 
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index db00e3e2f3dc..ecb1b69c1651 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -11,7 +11,6 @@
 #include <linux/bootmem.h>
 #include <linux/debugfs.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/pfn_t.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index 2f7702253ccf..de391b7bc19a 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -11,7 +11,6 @@
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/rbtree_augmented.h>
 #include <linux/sched.h>
 #include <linux/gfp.h>
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 9f0614daea85..a235869532bc 100644
--- a/arch/x86/mm/pf_in.c
+++ b/arch/x86/mm/pf_in.c
@@ -26,7 +26,6 @@
  *  Bjorn Steinbrink (B.Steinbrink@gmx.de), 2007
  */
 
-#include <linux/module.h>
 #include <linux/ptrace.h> /* struct pt_regs */
 #include "pf_in.h"
 
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 75cc0978d45d..388d28e3fdbe 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -8,7 +8,6 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
-#include <linux/module.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
diff --git a/arch/x86/mm/physaddr.c b/arch/x86/mm/physaddr.c
index e666cbbb9261..cfc3b9121ce4 100644
--- a/arch/x86/mm/physaddr.c
+++ b/arch/x86/mm/physaddr.c
@@ -1,6 +1,6 @@
 #include <linux/bootmem.h>
 #include <linux/mmdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 
 #include <asm/page.h>
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index b1ecff460a46..35fe69529bc1 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -13,7 +13,7 @@
 #include <linux/acpi.h>
 #include <linux/mmzone.h>
 #include <linux/bitmap.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/topology.h>
 #include <linux/mm.h>
 #include <asm/proto.h>
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 5643fd0b1a7d..4dbe65622810 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -4,7 +4,7 @@
 #include <linux/spinlock.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/cpu.h>
 
 #include <asm/tlbflush.h>
-- 
2.8.4

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

* [PATCH 3/8] x86: kernel: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 2/8] x86: mm: audit and remove any unnecessary uses of module.h Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14 18:43   ` [tip:x86/headers] x86/kernel: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 4/8] x86: lib: audit " Paul Gortmaker
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

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.  Build testing
revealed some implicit header usage that was fixed up accordingly.

Note that some bool/obj-y instances remain since module.h is
the header for some exception table entry stuff, and for things
like __init_or_module (code that is tossed when MODULES=n).

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/include/asm/topology.h        | 1 +
 arch/x86/kernel/acpi/boot.c            | 2 +-
 arch/x86/kernel/acpi/cstate.c          | 2 +-
 arch/x86/kernel/amd_gart_64.c          | 1 -
 arch/x86/kernel/amd_nb.c               | 2 +-
 arch/x86/kernel/apic/apic.c            | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c    | 2 +-
 arch/x86/kernel/apic/apic_noop.c       | 1 -
 arch/x86/kernel/apic/hw_nmi.c          | 2 +-
 arch/x86/kernel/apic/io_apic.c         | 2 +-
 arch/x86/kernel/apic/ipi.c             | 1 -
 arch/x86/kernel/apic/probe_32.c        | 2 +-
 arch/x86/kernel/apic/probe_64.c        | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c     | 2 +-
 arch/x86/kernel/cpu/common.c           | 2 +-
 arch/x86/kernel/cpu/hypervisor.c       | 3 ++-
 arch/x86/kernel/cpu/intel.c            | 2 +-
 arch/x86/kernel/cpu/match.c            | 2 +-
 arch/x86/kernel/cpu/mshyperv.c         | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c     | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c     | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c | 2 +-
 arch/x86/kernel/cpu/vmware.c           | 3 ++-
 arch/x86/kernel/crash.c                | 2 +-
 arch/x86/kernel/dumpstack_32.c         | 2 +-
 arch/x86/kernel/dumpstack_64.c         | 2 +-
 arch/x86/kernel/hw_breakpoint.c        | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c        | 3 ++-
 arch/x86/kernel/i8253.c                | 2 +-
 arch/x86/kernel/io_delay.c             | 2 +-
 arch/x86/kernel/irq_32.c               | 1 -
 arch/x86/kernel/irq_64.c               | 1 -
 arch/x86/kernel/kdebugfs.c             | 2 +-
 arch/x86/kernel/kvm.c                  | 2 +-
 arch/x86/kernel/mpparse.c              | 1 -
 arch/x86/kernel/paravirt-spinlocks.c   | 2 +-
 arch/x86/kernel/paravirt.c             | 3 ++-
 arch/x86/kernel/pci-swiotlb.c          | 2 +-
 arch/x86/kernel/pmem.c                 | 2 +-
 arch/x86/kernel/process.c              | 3 ++-
 arch/x86/kernel/process_32.c           | 2 +-
 arch/x86/kernel/process_64.c           | 2 +-
 arch/x86/kernel/reboot.c               | 2 +-
 arch/x86/kernel/setup.c                | 2 +-
 arch/x86/kernel/setup_percpu.c         | 2 +-
 arch/x86/kernel/smpboot.c              | 2 +-
 arch/x86/kernel/stacktrace.c           | 2 +-
 arch/x86/kernel/traps.c                | 2 +-
 arch/x86/kernel/tsc.c                  | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c       | 2 +-
 arch/x86/kernel/x86_init.c             | 2 +-
 51 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index 43e87a3dd95c..cf75871d2f81 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -36,6 +36,7 @@
 #include <linux/cpumask.h>
 
 #include <asm/mpspec.h>
+#include <asm/percpu.h>
 
 /* Mappings between logical cpu number and node number */
 DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 9414f84584e4..6f3a9adf45da 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -28,7 +28,7 @@
 #include <linux/acpi_pmtmr.h>
 #include <linux/efi.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/dmi.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 4b28159e0421..bdfad642123f 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -5,7 +5,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/cpu.h>
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index 8e3842fc8bea..42d27a62a404 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -20,7 +20,6 @@
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/pci.h>
-#include <linux/module.h>
 #include <linux/topology.h>
 #include <linux/interrupt.h>
 #include <linux/bitmap.h>
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index e45ec2b4e15e..4fdf6230d93c 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -9,7 +9,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/errno.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/spinlock.h>
 #include <asm/amd_nb.h>
 
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 89a5bcee79a8..d1a5fb2e570c 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -23,7 +23,7 @@
 #include <linux/bootmem.h>
 #include <linux/ftrace.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/syscore_ops.h>
 #include <linux/delay.h>
 #include <linux/timex.h>
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 1d0a8bac17be..7ec3db95fc08 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -15,7 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/hardirq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/smp.h>
 #include <asm/apic.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 8a6ce344fe9c..b0c96c4e637a 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -11,7 +11,6 @@
 
 #include <linux/threads.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 7788ce643bf4..f29501e1a5c1 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -16,7 +16,7 @@
 #include <linux/notifier.h>
 #include <linux/kprobes.h>
 #include <linux/nmi.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/delay.h>
 
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index f072b9572634..7491f417a8e4 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -39,7 +39,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/compiler.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/syscore_ops.h>
 #include <linux/freezer.h>
 #include <linux/kthread.h>
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 2a0f225afebd..3a205d4a12d0 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -8,7 +8,6 @@
 #include <linux/mc146818rtc.h>
 #include <linux/cache.h>
 #include <linux/cpu.h>
-#include <linux/module.h>
 
 #include <asm/smp.h>
 #include <asm/mtrr.h>
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index b04eeec2950c..6bd2b1ddb44b 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -8,7 +8,7 @@
  */
 #include <linux/threads.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 1793dba7a741..d4880a327181 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -11,7 +11,7 @@
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index d6c355fe9e86..45c575f0aa9f 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -12,7 +12,7 @@
 #include <linux/proc_fs.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <linux/sched.h>
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index d8f84250f139..d8a4d25348b5 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2,7 +2,7 @@
 #include <linux/linkage.h>
 #include <linux/bitops.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/percpu.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 73d391ae452f..27e46658ebe3 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -21,7 +21,8 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <asm/processor.h>
 #include <asm/hypervisor.h>
 
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index c1a89bc026ac..f380b61d9a7a 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -5,7 +5,7 @@
 #include <linux/smp.h>
 #include <linux/sched.h>
 #include <linux/thread_info.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/uaccess.h>
 
 #include <asm/cpufeature.h>
diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
index fbb5e90557a5..e42117d5f4d7 100644
--- a/arch/x86/kernel/cpu/match.c
+++ b/arch/x86/kernel/cpu/match.c
@@ -1,7 +1,7 @@
 #include <asm/cpu_device_id.h>
 #include <asm/cpufeature.h>
 #include <linux/cpu.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 
 /**
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 10c11b4da31d..8f44c5a50ab8 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -13,7 +13,8 @@
 #include <linux/types.h>
 #include <linux/time.h>
 #include <linux/clocksource.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/hardirq.h>
 #include <linux/efi.h>
 #include <linux/interrupt.h>
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index 31e951ce6dff..3b442b64c72d 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -17,7 +17,6 @@
  * License along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/smp.h>
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 16e37a2581ac..fdc55215d44d 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -4,7 +4,7 @@
  */
 #define DEBUG
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/mm.h>
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 2e8caf03f593..181eabecae25 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -12,7 +12,7 @@
  */
 
 #include <linux/percpu.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/smp.h>
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 8cac429b6a1d..1ff0598d309c 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -22,7 +22,8 @@
  */
 
 #include <linux/dmi.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <asm/div64.h>
 #include <asm/x86_init.h>
 #include <asm/hypervisor.h>
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 330543332c0f..544d5107d352 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -20,7 +20,7 @@
 #include <linux/delay.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 948d77da3881..09675712eba8 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -7,7 +7,7 @@
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
 #include <linux/sysfs.h>
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index a81e1ef73bf2..6f97bfdd1cea 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -7,7 +7,7 @@
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
 #include <linux/sysfs.h>
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index 2bcfb5f2bc44..8771766d46b6 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -36,13 +36,14 @@
 #include <linux/percpu.h>
 #include <linux/kdebug.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
 
 #include <asm/hw_breakpoint.h>
 #include <asm/processor.h>
 #include <asm/debugreg.h>
+#include <asm/user.h>
 
 /* Per cpu debug control register value */
 DEFINE_PER_CPU(unsigned long, cpu_dr7);
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index d40ee8a38fed..1f9b878ef5ef 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/spinlock_types.h>
 
 #include <asm/checksum.h>
 #include <asm/pgtable.h>
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index efb82f07b29c..6ebe00cb4a3b 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -3,7 +3,7 @@
  *
  */
 #include <linux/clockchips.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/timex.h>
 #include <linux/i8253.h>
 
diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c
index a979b5bd2fc0..50c89e8a95f2 100644
--- a/arch/x86/kernel/io_delay.c
+++ b/arch/x86/kernel/io_delay.c
@@ -6,7 +6,7 @@
  * outb_p/inb_p API uses.
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/dmi.h>
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c627bf8d98ad..1f38d9a4d9de 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -8,7 +8,6 @@
  * io_apic.c.)
  */
 
-#include <linux/module.h>
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 206d0b90a3ab..4a7903714065 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -11,7 +11,6 @@
 #include <linux/kernel_stat.h>
 #include <linux/interrupt.h>
 #include <linux/seq_file.h>
-#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/ftrace.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index dc1404bf8e4b..bdb83e431d89 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -8,7 +8,7 @@
  */
 #include <linux/debugfs.h>
 #include <linux/uaccess.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/stat.h>
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index 1ef5e48b3a36..1726c4c12336 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -21,7 +21,7 @@
  */
 
 #include <linux/context_tracking.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kvm_para.h>
 #include <linux/cpu.h>
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 97340f2c437c..068c4a929de6 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -16,7 +16,6 @@
 #include <linux/mc146818rtc.h>
 #include <linux/bitops.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
 #include <linux/smp.h>
 #include <linux/pci.h>
 
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 33ee3e0efd65..1939a0269377 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -3,7 +3,7 @@
  * compiled in a FTRACE-compatible way.
  */
 #include <linux/spinlock.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/jump_label.h>
 
 #include <asm/paravirt.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 59222a21ef0e..b8e4680a2e0b 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -19,7 +19,8 @@
 */
 
 #include <linux/errno.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/efi.h>
 #include <linux/bcd.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index 7c577a178859..5069ef560d83 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -2,7 +2,7 @@
 
 #include <linux/pci.h>
 #include <linux/cache.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/swiotlb.h>
 #include <linux/bootmem.h>
 #include <linux/dma-mapping.h>
diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c
index 92f70147a9a6..0c5315d322c8 100644
--- a/arch/x86/kernel/pmem.c
+++ b/arch/x86/kernel/pmem.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2015, Intel Corporation.
  */
 #include <linux/platform_device.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 
 static int found(u64 start, u64 end, void *data)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 96becbbb52e0..61b703c179d3 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -7,7 +7,8 @@
 #include <linux/prctl.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/pm.h>
 #include <linux/tick.h>
 #include <linux/random.h>
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9f950917528b..d86be29c38c7 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -25,7 +25,7 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/mc146818rtc.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kallsyms.h>
 #include <linux/ptrace.h>
 #include <linux/personality.h>
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 6e789ca1f841..63236d8f84bf 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -26,7 +26,7 @@
 #include <linux/user.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/notifier.h>
 #include <linux/kprobes.h>
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index fe98493932ad..559447ff5db2 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -1,6 +1,6 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/pm.h>
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 07776f486608..bcabb8803c2f 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -36,7 +36,7 @@
 #include <linux/console.h>
 #include <linux/root_dev.h>
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/efi.h>
 #include <linux/init.h>
 #include <linux/edd.h>
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 8ce03678166e..e9118ea2f3b4 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -1,7 +1,7 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <linux/percpu.h>
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 2ed0ec1353f8..4d0c1d115702 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -43,7 +43,7 @@
 
 #include <linux/init.h>
 #include <linux/smp.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/percpu.h>
 #include <linux/bootmem.h>
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 9ee98eefc44d..4738f5e0f2ab 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -5,7 +5,7 @@
  */
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/uaccess.h>
 #include <asm/stacktrace.h>
 
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 00f03d82e69a..b70ca12dd389 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -21,7 +21,7 @@
 #include <linux/kdebug.h>
 #include <linux/kgdb.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/uprobes.h>
 #include <linux/string.h>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 2a952fcb1516..73a4261b5650 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -3,7 +3,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/timer.h>
 #include <linux/acpi_pmtmr.h>
 #include <linux/cpufreq.h>
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index f1aebfb49c36..f6d30fedcc03 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -1,7 +1,7 @@
 /* Exports for assembly files.
    All C exports should go in the respective C files. */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/smp.h>
 
 #include <net/checksum.h>
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 06e0d7afbe87..0bd9f1287f39 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -5,7 +5,7 @@
  */
 #include <linux/init.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/pci.h>
 
 #include <asm/bios_ebda.h>
-- 
2.8.4

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

* [PATCH 4/8] x86: lib: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (2 preceding siblings ...)
  2016-07-14  0:18 ` [PATCH 3/8] x86: kernel: audit " Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14 18:44   ` [tip:x86/headers] x86/lib: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 5/8] x86: platform: audit " Paul Gortmaker
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

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.  Build testing
revealed a couple implicit header usage issues that were fixed.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/lib/cache-smp.c        | 2 +-
 arch/x86/lib/cpu.c              | 3 ++-
 arch/x86/lib/csum-partial_64.c  | 2 +-
 arch/x86/lib/csum-wrappers_64.c | 2 +-
 arch/x86/lib/delay.c            | 2 +-
 arch/x86/lib/memcpy_32.c        | 2 +-
 arch/x86/lib/mmx_32.c           | 2 +-
 arch/x86/lib/msr-reg-export.c   | 2 +-
 arch/x86/lib/msr-smp.c          | 2 +-
 arch/x86/lib/msr.c              | 3 ++-
 arch/x86/lib/string_32.c        | 2 +-
 arch/x86/lib/usercopy.c         | 2 +-
 arch/x86/lib/usercopy_32.c      | 2 +-
 arch/x86/lib/usercopy_64.c      | 2 +-
 14 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index a3c668875038..216a629a4a1a 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -1,5 +1,5 @@
 #include <linux/smp.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 static void __wbinvd(void *dummy)
 {
diff --git a/arch/x86/lib/cpu.c b/arch/x86/lib/cpu.c
index aa417a97511c..d6f848d1211d 100644
--- a/arch/x86/lib/cpu.c
+++ b/arch/x86/lib/cpu.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/export.h>
 
 unsigned int x86_family(unsigned int sig)
 {
diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
index 9845371c5c36..9a7fe6a70491 100644
--- a/arch/x86/lib/csum-partial_64.c
+++ b/arch/x86/lib/csum-partial_64.c
@@ -6,7 +6,7 @@
  */
  
 #include <linux/compiler.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/checksum.h>
 
 static inline unsigned short from32to16(unsigned a) 
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
index 28a6654f0d08..f8dc05d0881e 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -5,7 +5,7 @@
  * Wrappers of assembly checksum functions for x86-64.
  */
 #include <asm/checksum.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/smap.h>
 
 /**
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index 2f07c291dcc8..073d1f1a620b 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -11,7 +11,7 @@
  *	we have to worry about.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/timex.h>
 #include <linux/preempt.h>
diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c
index a404b4b75533..cad12634d6bd 100644
--- a/arch/x86/lib/memcpy_32.c
+++ b/arch/x86/lib/memcpy_32.c
@@ -1,5 +1,5 @@
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #undef memcpy
 #undef memset
diff --git a/arch/x86/lib/mmx_32.c b/arch/x86/lib/mmx_32.c
index e5e3ed8dc079..c2311a678332 100644
--- a/arch/x86/lib/mmx_32.c
+++ b/arch/x86/lib/mmx_32.c
@@ -18,7 +18,7 @@
  */
 #include <linux/hardirq.h>
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/types.h>
 
diff --git a/arch/x86/lib/msr-reg-export.c b/arch/x86/lib/msr-reg-export.c
index 8d6ef78b5d01..ff29e8d39414 100644
--- a/arch/x86/lib/msr-reg-export.c
+++ b/arch/x86/lib/msr-reg-export.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/msr.h>
 
 EXPORT_SYMBOL(rdmsr_safe_regs);
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
index 518532e6a3fa..ce68b6a9d7d1 100644
--- a/arch/x86/lib/msr-smp.c
+++ b/arch/x86/lib/msr-smp.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/preempt.h>
 #include <linux/smp.h>
 #include <asm/msr.h>
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 004c861b1648..d1dee753b949 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/percpu.h>
 #include <linux/preempt.h>
 #include <asm/msr.h>
 #define CREATE_TRACE_POINTS
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c
index bd59090825db..dc0ad12f80bb 100644
--- a/arch/x86/lib/string_32.c
+++ b/arch/x86/lib/string_32.c
@@ -11,7 +11,7 @@
  */
 
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #ifdef __HAVE_ARCH_STRCPY
 char *strcpy(char *dest, const char *src)
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index e342586db6e4..b4908789484e 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -5,7 +5,7 @@
  */
 
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <asm/word-at-a-time.h>
 #include <linux/sched.h>
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index b559d9238781..3bc7baf2a711 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -8,7 +8,7 @@
 #include <linux/mm.h>
 #include <linux/highmem.h>
 #include <linux/blkdev.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/backing-dev.h>
 #include <linux/interrupt.h>
 #include <asm/uaccess.h>
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index 0a42327a59d7..e1e0364cb9dd 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -5,7 +5,7 @@
  * Copyright 1997 Linus Torvalds
  * Copyright 2002 Andi Kleen <ak@suse.de>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/uaccess.h>
 
 /*
-- 
2.8.4

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

* [PATCH 5/8] x86: platform: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (3 preceding siblings ...)
  2016-07-14  0:18 ` [PATCH 4/8] x86: lib: audit " Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14 18:44   ` [tip:x86/headers] x86/platform: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:18 ` [PATCH 6/8] x86: xen: audit " Paul Gortmaker
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

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.

One module.h was converted to moduleparam.h since the file had
multiple module_param() in it, and another file had an instance of
MODULE_DEVICE_TABLE deleted, since that is a no-op when builtin.

Finally, the 32 bit build coverage of olpc_ofw revealed a couple
implicit includes, which were pretty self evident to fix based on
what gcc was complaining about.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 5 ++++-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 10 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index 701fd5843c87..7ab4d3fc7433 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -11,7 +11,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/reboot.h>
 #include <linux/serial_reg.h>
 #include <linux/serial_8250.h>
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index fbbd0867ca5c..1b02a4e03000 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -24,7 +24,7 @@
 #include <linux/spinlock.h>
 #include <linux/bootmem.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mc146818rtc.h>
 #include <linux/efi.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
index abbf49c6e9d3..ce119d2ba0d0 100644
--- a/arch/x86/platform/intel-mid/intel-mid.c
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -20,7 +20,7 @@
 #include <linux/scatterlist.h>
 #include <linux/sfi.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/notifier.h>
 
 #include <asm/setup.h>
diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c
index 5bc90dd102d4..c901a3423772 100644
--- a/arch/x86/platform/intel-mid/pwr.c
+++ b/arch/x86/platform/intel-mid/pwr.c
@@ -21,10 +21,9 @@
 
 #include <linux/delay.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mutex.h>
 #include <linux/pci.h>
 
@@ -407,7 +406,6 @@ static const struct pci_device_id mid_pwr_pci_ids[] = {
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&mid_info },
 	{}
 };
-MODULE_DEVICE_TABLE(pci, mid_pwr_pci_ids);
 
 static struct pci_driver mid_pwr_pci_driver = {
 	.name		= "intel_mid_pwr",
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 5ee360a951ce..54761592d5ac 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -24,7 +24,7 @@
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/notifier.h>
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 27376081ddec..7c3077e58fa0 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -12,7 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/string.h>
diff --git a/arch/x86/platform/olpc/olpc_ofw.c b/arch/x86/platform/olpc/olpc_ofw.c
index e7604f62870d..f1aab8cdb33f 100644
--- a/arch/x86/platform/olpc/olpc_ofw.c
+++ b/arch/x86/platform/olpc/olpc_ofw.c
@@ -1,9 +1,12 @@
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/spinlock_types.h>
 #include <linux/init.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/io.h>
+#include <asm/cpufeature.h>
+#include <asm/special_insns.h>
 #include <asm/pgtable.h>
 #include <asm/olpc_ofw.h>
 
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c
index baf16e72e668..952191bea75c 100644
--- a/arch/x86/platform/ts5500/ts5500.c
+++ b/arch/x86/platform/ts5500/ts5500.c
@@ -23,7 +23,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_data/gpio-ts5500.h>
 #include <linux/platform_data/max197.h>
 #include <linux/platform_device.h>
diff --git a/arch/x86/platform/uv/uv_irq.c b/arch/x86/platform/uv/uv_irq.c
index e1c24631afbb..776c6592136c 100644
--- a/arch/x86/platform/uv/uv_irq.c
+++ b/arch/x86/platform/uv/uv_irq.c
@@ -8,7 +8,7 @@
  * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/rbtree.h>
 #include <linux/slab.h>
 #include <linux/irq.h>
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 8dd80050d705..cd5173a2733f 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -24,7 +24,7 @@
 #include <linux/kdb.h>
 #include <linux/kexec.h>
 #include <linux/kgdb.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/nmi.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
-- 
2.8.4

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

* [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (4 preceding siblings ...)
  2016-07-14  0:18 ` [PATCH 5/8] x86: platform: audit " Paul Gortmaker
@ 2016-07-14  0:18 ` Paul Gortmaker
  2016-07-14  3:59   ` Juergen Gross
  2016-07-14 18:45   ` [tip:x86/headers] x86/xen: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:19 ` [PATCH 7/8] x86: kvm: audit " Paul Gortmaker
                   ` (2 subsequent siblings)
  8 siblings, 2 replies; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Boris Ostrovsky, David Vrabel, Juergen Gross,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, xen-devel

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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/xen/debugfs.c             | 1 -
 arch/x86/xen/enlighten.c           | 2 +-
 arch/x86/xen/mmu.c                 | 3 ++-
 arch/x86/xen/p2m.c                 | 2 +-
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 arch/x86/xen/setup.c               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index c8377fb26cdf..1daff5545c0a 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -1,7 +1,6 @@
 #include <linux/init.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include "debugfs.h"
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 575cea4bab94..88845bb50b7b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kprobes.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/page-flags.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 67433714b791..7d5afdb417cc 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -43,7 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/bug.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index dd2a49a8aacc..37129db76d33 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -60,7 +60,7 @@
  */
 
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/hash.h>
 #include <linux/sched.h>
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 9586ff32810c..d37a0c7f82cb 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -21,7 +21,7 @@
 
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <xen/platform_pci.h>
 #include "xen-ops.h"
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e345891450c3..176425233e4d 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -4,7 +4,7 @@
  * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/pm.h>
-- 
2.8.4

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

* [PATCH 7/8] x86: kvm: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (5 preceding siblings ...)
  2016-07-14  0:18 ` [PATCH 6/8] x86: xen: audit " Paul Gortmaker
@ 2016-07-14  0:19 ` Paul Gortmaker
  2016-07-14  7:42   ` Paolo Bonzini
  2016-07-14 18:45   ` [tip:x86/headers] x86/kvm: Audit " tip-bot for Paul Gortmaker
  2016-07-14  0:19 ` [PATCH 8/8] x86: audit and remove any remaining " Paul Gortmaker
  2016-07-14 13:04 ` [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar
  8 siblings, 2 replies; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Paolo Bonzini, Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, 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.

Several instances got replaced with moduleparam.h since that was
really all that was required for those particular files.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/kvm/cpuid.c   | 2 +-
 arch/x86/kvm/emulate.c | 1 -
 arch/x86/kvm/iommu.c   | 2 +-
 arch/x86/kvm/irq.c     | 2 +-
 arch/x86/kvm/lapic.c   | 2 +-
 arch/x86/kvm/mmu.c     | 3 ++-
 arch/x86/kvm/x86.c     | 3 ++-
 7 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 7597b42a8a88..a6885de298e1 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -13,7 +13,7 @@
  */
 
 #include <linux/kvm_host.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/vmalloc.h>
 #include <linux/uaccess.h>
 #include <asm/fpu/internal.h> /* For use_eager_fpu.  Ugh! */
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a2f24af3c999..4e95d3eb2955 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -22,7 +22,6 @@
 
 #include <linux/kvm_host.h>
 #include "kvm_cache_regs.h"
-#include <linux/module.h>
 #include <asm/kvm_emulate.h>
 #include <linux/stringify.h>
 #include <asm/debugreg.h>
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
index 4f2010c5feba..b181426f67b4 100644
--- a/arch/x86/kvm/iommu.c
+++ b/arch/x86/kvm/iommu.c
@@ -25,7 +25,7 @@
 
 #include <linux/list.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/iommu.h>
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 95fcc7b13866..60d91c9d160c 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -20,7 +20,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kvm_host.h>
 
 #include "irq.h"
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index e40eea557c42..b921540a0a02 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -25,7 +25,7 @@
 #include <linux/smp.h>
 #include <linux/hrtimer.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/math64.h>
 #include <linux/slab.h>
 #include <asm/processor.h>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 837bf23c5b06..4b50a3da050d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -29,7 +29,8 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/export.h>
 #include <linux/swap.h>
 #include <linux/hugetlb.h>
 #include <linux/compiler.h>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 96cefd5d3224..93aadbc2f6b0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -36,7 +36,8 @@
 #include <linux/kvm.h>
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/moduleparam.h>
 #include <linux/mman.h>
 #include <linux/highmem.h>
 #include <linux/iommu.h>
-- 
2.8.4

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

* [PATCH 8/8] x86: audit and remove any remaining unnecessary uses of module.h
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (6 preceding siblings ...)
  2016-07-14  0:19 ` [PATCH 7/8] x86: kvm: audit " Paul Gortmaker
@ 2016-07-14  0:19 ` Paul Gortmaker
  2016-07-14 18:45   ` [tip:x86/headers] x86: Audit " tip-bot for Paul Gortmaker
  2016-07-14 13:04 ` [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar
  8 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14  0:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.

This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.  In the case of
some of these which are modular, we can extend that to also include
files that are building basic support functionality but not related
to loading or registering the final module; such files also have
no need whatsoever for module.h

The advantage in removing such instances is that module.h itself
sources about 15 other headers; adding significantly to what we feed
cpp, and it can obscure what headers we are effectively using.

Since module.h was the source for init.h (for __init) and for
export.h (for EXPORT_SYMBOL) we consider each instance for the
presence of either and replace as needed.

In the case of crypto/glue_helper.c we delete a redundant instance
of MODULE_LICENSE in order to delete module.h -- the license info
is already present at the top of the file.

The uncore change warrants a mention too; it is uncore.c that uses
module.h and not uncore.h; hence the relocation done there.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 arch/x86/crypto/glue_helper.c    | 4 +---
 arch/x86/events/amd/ibs.c        | 3 ++-
 arch/x86/events/amd/iommu.c      | 2 +-
 arch/x86/events/core.c           | 3 ++-
 arch/x86/events/intel/uncore.c   | 2 ++
 arch/x86/events/intel/uncore.h   | 1 -
 arch/x86/include/asm/livepatch.h | 1 -
 arch/x86/kernel/cpu/mtrr/if.c    | 1 -
 arch/x86/kernel/cpu/mtrr/main.c  | 2 +-
 arch/x86/pci/xen.c               | 2 +-
 arch/x86/um/delay.c              | 2 +-
 11 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/x86/crypto/glue_helper.c b/arch/x86/crypto/glue_helper.c
index 6a85598931b5..3cc4cad4c363 100644
--- a/arch/x86/crypto/glue_helper.c
+++ b/arch/x86/crypto/glue_helper.c
@@ -25,7 +25,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <crypto/b128ops.h>
 #include <crypto/lrw.h>
 #include <crypto/xts.h>
@@ -397,5 +397,3 @@ void glue_xts_crypt_128bit_one(void *ctx, u128 *dst, const u128 *src, le128 *iv,
 	u128_xor(dst, dst, (u128 *)&ivblk);
 }
 EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit_one);
-
-MODULE_LICENSE("GPL");
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index feb90f6730e8..2d40247d8c68 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -7,7 +7,8 @@
  */
 
 #include <linux/perf_event.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/pci.h>
 #include <linux/ptrace.h>
 #include <linux/syscore_ops.h>
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 6011a573dd64..b28200dea715 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -12,7 +12,7 @@
  */
 
 #include <linux/perf_event.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/cpumask.h>
 #include <linux/slab.h>
 
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index dfebbde2a4cc..d38c55ad3c4b 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -17,7 +17,8 @@
 #include <linux/notifier.h>
 #include <linux/hardirq.h>
 #include <linux/kprobes.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/kdebug.h>
 #include <linux/sched.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 59b4974c697f..6dec1f202eae 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1,3 +1,5 @@
+#include <linux/module.h>
+
 #include <asm/cpu_device_id.h>
 #include <asm/intel-family.h>
 #include "uncore.h"
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index d6063e438158..78b9c23e2d8d 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -1,4 +1,3 @@
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <asm/apicdef.h>
diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
index a7f9181f63f3..ed80003ce3e2 100644
--- a/arch/x86/include/asm/livepatch.h
+++ b/arch/x86/include/asm/livepatch.h
@@ -22,7 +22,6 @@
 #define _ASM_X86_LIVEPATCH_H
 
 #include <asm/setup.h>
-#include <linux/module.h>
 #include <linux/ftrace.h>
 
 static inline int klp_check_compiler_support(void)
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index d76f13d6d8d6..6d9b45549109 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -2,7 +2,6 @@
 #include <linux/seq_file.h>
 #include <linux/uaccess.h>
 #include <linux/proc_fs.h>
-#include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/slab.h>
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 5c367d9cde87..24e87e74990d 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -38,7 +38,7 @@
 #include <linux/stop_machine.h>
 #include <linux/kvm_para.h>
 #include <linux/uaccess.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mutex.h>
 #include <linux/init.h>
 #include <linux/sort.h>
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 99ddab79215e..3a483cb5ac81 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -9,7 +9,7 @@
  *           Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  *           Stefano Stabellini <stefano.stabellini@eu.citrix.com>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/acpi.h>
diff --git a/arch/x86/um/delay.c b/arch/x86/um/delay.c
index f3fe1a688f7e..a8fb7ca4822b 100644
--- a/arch/x86/um/delay.c
+++ b/arch/x86/um/delay.c
@@ -7,7 +7,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <asm/param.h>
-- 
2.8.4

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

* Re: [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags
  2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
@ 2016-07-14  0:22   ` Arjan van de Ven
  2016-07-14 18:43   ` [tip:x86/headers] x86: Don't " tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: Arjan van de Ven @ 2016-07-14  0:22 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

On 7/13/2016 5:18 PM, Paul Gortmaker wrote:
> The Kconfig controlling compilation of these files are:
>
> arch/x86/Kconfig.debug:config DEBUG_RODATA_TEST
> arch/x86/Kconfig.debug: bool "Testcase for the marking rodata read-only"
>
> arch/x86/Kconfig.debug:config X86_PTDUMP_CORE
> arch/x86/Kconfig.debug: def_bool n
>
> ...meaning that it currently is not being built as a module by anyone.
>
> Lets remove the couple traces of modular infrastructure use, so that
> when reading the driver there is no doubt it is builtin-only.
>
> We delete the MODULE_LICENSE tag etc. since all that information
> is already contained at the top of the file in the comments.
>
> Cc: Arjan van de Ven <arjan@linux.intel.com>

Acked-by: Arjan van de Ven <arjan@linux.intel.com>

original these were tested as modules, but they really shouldn't be modules
in the normal kernel (and aren't per Kconfig)

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

* Re: [PATCH 6/8] x86: xen: audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 6/8] x86: xen: audit " Paul Gortmaker
@ 2016-07-14  3:59   ` Juergen Gross
  2016-07-14 18:45   ` [tip:x86/headers] x86/xen: Audit " tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: Juergen Gross @ 2016-07-14  3:59 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Boris Ostrovsky, David Vrabel, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, x86, xen-devel

On 14/07/16 02:18, 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.  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: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>

Acked-by: Juergen Gross <jgross@suse.com>

Juergen

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

* Re: [PATCH 7/8] x86: kvm: audit and remove any unnecessary uses of module.h
  2016-07-14  0:19 ` [PATCH 7/8] x86: kvm: audit " Paul Gortmaker
@ 2016-07-14  7:42   ` Paolo Bonzini
  2016-07-14 18:45   ` [tip:x86/headers] x86/kvm: Audit " tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: Paolo Bonzini @ 2016-07-14  7:42 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Radim Krčmář,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm



On 14/07/2016 02:19, Paul Gortmaker wrote:
> 
> 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

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

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

* Re: [PATCH 0/8] x86: audit and remove needless module.h includes
  2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
                   ` (7 preceding siblings ...)
  2016-07-14  0:19 ` [PATCH 8/8] x86: audit and remove any remaining " Paul Gortmaker
@ 2016-07-14 13:04 ` Ingo Molnar
  2016-07-14 15:18   ` Paul Gortmaker
  8 siblings, 1 reply; 25+ messages in thread
From: Ingo Molnar @ 2016-07-14 13:04 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel


* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> To that end, I have done allmodconfig, allyesconfig and allnoconfig
> for both 32 bit and 64 bit x86 with these changes on the linux-next
> from today, which presumably has an up to date copy of tip in it.

It does, still I get this on allnoconfig with your patches applied:

arch/x86/kernel/setup_percpu.c: In function ‘setup_percpu_segment’:
arch/x86/kernel/setup_percpu.c:159:2: error: implicit declaration of function 
‘pack_descriptor’ [-Werror=implicit-function-declaration]
  pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF,
  ^
arch/x86/kernel/setup_percpu.c:162:2: error: implicit declaration of function 
‘write_gdt_entry’ [-Werror=implicit-function-declaration]
  write_gdt_entry(get_cpu_gdt_table(cpu),
  ^
arch/x86/kernel/setup_percpu.c:162:18: error: implicit declaration of function 
‘get_cpu_gdt_table’ [-Werror=implicit-function-declaration]
  write_gdt_entry(get_cpu_gdt_table(cpu),

I'll continue testing with the setup_percpu.c change left out.

Thanks,

	Ingo

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

* Re: [PATCH 0/8] x86: audit and remove needless module.h includes
  2016-07-14 13:04 ` [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar
@ 2016-07-14 15:18   ` Paul Gortmaker
  2016-07-14 18:39     ` Ingo Molnar
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14 15:18 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel

[Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 15:04) Ingo Molnar wrote:

> 
> * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> 
> > To that end, I have done allmodconfig, allyesconfig and allnoconfig
> > for both 32 bit and 64 bit x86 with these changes on the linux-next
> > from today, which presumably has an up to date copy of tip in it.
> 
> It does, still I get this on allnoconfig with your patches applied:

Took me a while to figure out why I didn't see this; I was able to
finally reproduce it on x86-32 with allnoconfig but CONFIG_SMP=y.

> 
> arch/x86/kernel/setup_percpu.c: In function ‘setup_percpu_segment’:
> arch/x86/kernel/setup_percpu.c:159:2: error: implicit declaration of function 
> ‘pack_descriptor’ [-Werror=implicit-function-declaration]
>   pack_descriptor(&gdt, per_cpu_offset(cpu), 0xFFFFF,
>   ^
> arch/x86/kernel/setup_percpu.c:162:2: error: implicit declaration of function 
> ‘write_gdt_entry’ [-Werror=implicit-function-declaration]
>   write_gdt_entry(get_cpu_gdt_table(cpu),
>   ^
> arch/x86/kernel/setup_percpu.c:162:18: error: implicit declaration of function 
> ‘get_cpu_gdt_table’ [-Werror=implicit-function-declaration]
>   write_gdt_entry(get_cpu_gdt_table(cpu),

All three of these guys live in asm/desc.h and adding that to the top of
arch/x86/kernel/setup_percpu.c asm include list seems to fix the
reproducer I now have here.

> 
> I'll continue testing with the setup_percpu.c change left out.

Let me know if you want a resend or if you want to just add the
asm/desc.h locally or ...

Paul.
--

> 
> Thanks,
> 
> 	Ingo

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

* Re: [PATCH 0/8] x86: audit and remove needless module.h includes
  2016-07-14 15:18   ` Paul Gortmaker
@ 2016-07-14 18:39     ` Ingo Molnar
  2016-07-14 18:46       ` Paul Gortmaker
  0 siblings, 1 reply; 25+ messages in thread
From: Ingo Molnar @ 2016-07-14 18:39 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel


* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> > I'll continue testing with the setup_percpu.c change left out.
> 
> Let me know if you want a resend or if you want to just add the
> asm/desc.h locally or ...

So I tried the asm/desc.h but saw other build failures - for now gave up.
Can we do this in a separate patch?

Thanks,

	Ingo

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

* [tip:x86/headers] x86: Don't use module.h just for AUTHOR / LICENSE tags
  2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
  2016-07-14  0:22   ` Arjan van de Ven
@ 2016-07-14 18:43   ` tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, linux-kernel, mingo, paul.gortmaker, peterz, arjan, hpa, torvalds

Commit-ID:  84e629b66882f8d1b6e40060e85e5bb27c892d42
Gitweb:     http://git.kernel.org/tip/84e629b66882f8d1b6e40060e85e5bb27c892d42
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:54 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 13:04:20 +0200

x86: Don't use module.h just for AUTHOR / LICENSE tags

The Kconfig controlling compilation of these files are:

 arch/x86/Kconfig.debug:config DEBUG_RODATA_TEST
 arch/x86/Kconfig.debug: bool "Testcase for the marking rodata read-only"

 arch/x86/Kconfig.debug:config X86_PTDUMP_CORE
 arch/x86/Kconfig.debug: def_bool n

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that
when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information
is already contained at the top of the file in the comments.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-2-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/test_rodata.c | 5 -----
 arch/x86/mm/dump_pagetables.c | 6 +-----
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/arch/x86/kernel/test_rodata.c b/arch/x86/kernel/test_rodata.c
index cb4a01b..222e84e 100644
--- a/arch/x86/kernel/test_rodata.c
+++ b/arch/x86/kernel/test_rodata.c
@@ -9,7 +9,6 @@
  * as published by the Free Software Foundation; version 2
  * of the License.
  */
-#include <linux/module.h>
 #include <asm/cacheflush.h>
 #include <asm/sections.h>
 #include <asm/asm.h>
@@ -74,7 +73,3 @@ int rodata_test(void)
 
 	return 0;
 }
-
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Testcase for marking rodata as read-only");
-MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index 99bfb19..5bb27fa 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -14,7 +14,7 @@
 
 #include <linux/debugfs.h>
 #include <linux/mm.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/seq_file.h>
 
 #include <asm/pgtable.h>
@@ -446,8 +446,4 @@ static int __init pt_dump_init(void)
 
 	return 0;
 }
-
 __initcall(pt_dump_init);
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
-MODULE_DESCRIPTION("Kernel debugging helper that dumps pagetables");

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

* [tip:x86/headers] x86/mm: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 2/8] x86: mm: audit and remove any unnecessary uses of module.h Paul Gortmaker
@ 2016-07-14 18:43   ` tip-bot for Paul Gortmaker
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, linux-kernel, paul.gortmaker, peterz, hpa, mingo, tglx

Commit-ID:  4b599fedb7eeea4c995e655a938b5ec419386ddf
Gitweb:     http://git.kernel.org/tip/4b599fedb7eeea4c995e655a938b5ec419386ddf
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:55 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 13:04:20 +0200

x86/mm: 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 accordingly where needed.

Note that some bool/obj-y instances remain since module.h is
the header for some exception table entry stuff, and for things
like __init_or_module (code that is tossed when MODULES=n).

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-3-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/mm/amdtopology.c         | 1 -
 arch/x86/mm/highmem_32.c          | 2 +-
 arch/x86/mm/init_32.c             | 1 -
 arch/x86/mm/init_64.c             | 1 -
 arch/x86/mm/iomap_32.c            | 2 +-
 arch/x86/mm/ioremap.c             | 1 -
 arch/x86/mm/kmemcheck/kmemcheck.c | 1 -
 arch/x86/mm/kmemcheck/shadow.c    | 2 +-
 arch/x86/mm/kmmio.c               | 2 +-
 arch/x86/mm/mmio-mod.c            | 2 +-
 arch/x86/mm/numa.c                | 1 -
 arch/x86/mm/numa_32.c             | 2 +-
 arch/x86/mm/pat.c                 | 1 -
 arch/x86/mm/pat_rbtree.c          | 1 -
 arch/x86/mm/pf_in.c               | 1 -
 arch/x86/mm/pgtable_32.c          | 1 -
 arch/x86/mm/physaddr.c            | 2 +-
 arch/x86/mm/srat.c                | 2 +-
 arch/x86/mm/tlb.c                 | 2 +-
 19 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c
index 2ca15b59..ba47524 100644
--- a/arch/x86/mm/amdtopology.c
+++ b/arch/x86/mm/amdtopology.c
@@ -9,7 +9,6 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/string.h>
-#include <linux/module.h>
 #include <linux/nodemask.h>
 #include <linux/memblock.h>
 #include <linux/bootmem.h>
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
index a6d7392..6d18b70 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
@@ -1,5 +1,5 @@
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/swap.h> /* for totalram_pages */
 #include <linux/bootmem.h>
 
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 84df150..cf80590 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -5,7 +5,6 @@
  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  */
 
-#include <linux/module.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index bce2e5d..7042d14 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -27,7 +27,6 @@
 #include <linux/pfn.h>
 #include <linux/poison.h>
 #include <linux/dma-mapping.h>
-#include <linux/module.h>
 #include <linux/memory.h>
 #include <linux/memory_hotplug.h>
 #include <linux/memremap.h>
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
index 9c0ff04..ada98b3 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -18,7 +18,7 @@
 
 #include <asm/iomap.h>
 #include <asm/pat.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/highmem.h>
 
 static int is_io_mapping_possible(resource_size_t base, unsigned long size)
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index f089491..7aaa263 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -9,7 +9,6 @@
 #include <linux/bootmem.h>
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/mmiotrace.h>
diff --git a/arch/x86/mm/kmemcheck/kmemcheck.c b/arch/x86/mm/kmemcheck/kmemcheck.c
index b4f2e7e..4515bae 100644
--- a/arch/x86/mm/kmemcheck/kmemcheck.c
+++ b/arch/x86/mm/kmemcheck/kmemcheck.c
@@ -14,7 +14,6 @@
 #include <linux/kernel.h>
 #include <linux/kmemcheck.h>
 #include <linux/mm.h>
-#include <linux/module.h>
 #include <linux/page-flags.h>
 #include <linux/percpu.h>
 #include <linux/ptrace.h>
diff --git a/arch/x86/mm/kmemcheck/shadow.c b/arch/x86/mm/kmemcheck/shadow.c
index aec1242..c2638a7 100644
--- a/arch/x86/mm/kmemcheck/shadow.c
+++ b/arch/x86/mm/kmemcheck/shadow.c
@@ -1,5 +1,5 @@
 #include <linux/kmemcheck.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 
 #include <asm/page.h>
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index ddb2244..afc47f5 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -11,7 +11,7 @@
 #include <linux/rculist.h>
 #include <linux/spinlock.h>
 #include <linux/hash.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/uaccess.h>
 #include <linux/ptrace.h>
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 0057a7acc..bef3662 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -24,7 +24,7 @@
 
 #define DEBUG 1
 
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 9c086c5..fe939a8 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -7,7 +7,6 @@
 #include <linux/memblock.h>
 #include <linux/mmzone.h>
 #include <linux/ctype.h>
-#include <linux/module.h>
 #include <linux/nodemask.h>
 #include <linux/sched.h>
 #include <linux/topology.h>
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 47b6436..6b7ce62 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -24,7 +24,7 @@
 
 #include <linux/bootmem.h>
 #include <linux/memblock.h>
-#include <linux/module.h>
+#include <linux/init.h>
 
 #include "numa_internal.h"
 
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index fb0604f..90eb0c5 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -11,7 +11,6 @@
 #include <linux/bootmem.h>
 #include <linux/debugfs.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/pfn_t.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
index 2f77022..de391b7 100644
--- a/arch/x86/mm/pat_rbtree.c
+++ b/arch/x86/mm/pat_rbtree.c
@@ -11,7 +11,6 @@
 #include <linux/seq_file.h>
 #include <linux/debugfs.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/rbtree_augmented.h>
 #include <linux/sched.h>
 #include <linux/gfp.h>
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 9f0614d..a235869 100644
--- a/arch/x86/mm/pf_in.c
+++ b/arch/x86/mm/pf_in.c
@@ -26,7 +26,6 @@
  *  Bjorn Steinbrink (B.Steinbrink@gmx.de), 2007
  */
 
-#include <linux/module.h>
 #include <linux/ptrace.h> /* struct pt_regs */
 #include "pf_in.h"
 
diff --git a/arch/x86/mm/pgtable_32.c b/arch/x86/mm/pgtable_32.c
index 75cc097..388d28e 100644
--- a/arch/x86/mm/pgtable_32.c
+++ b/arch/x86/mm/pgtable_32.c
@@ -8,7 +8,6 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/spinlock.h>
-#include <linux/module.h>
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
diff --git a/arch/x86/mm/physaddr.c b/arch/x86/mm/physaddr.c
index e666cbb..cfc3b91 100644
--- a/arch/x86/mm/physaddr.c
+++ b/arch/x86/mm/physaddr.c
@@ -1,6 +1,6 @@
 #include <linux/bootmem.h>
 #include <linux/mmdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 
 #include <asm/page.h>
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index b5f8218..fd0e963 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -13,7 +13,7 @@
 #include <linux/acpi.h>
 #include <linux/mmzone.h>
 #include <linux/bitmap.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/topology.h>
 #include <linux/bootmem.h>
 #include <linux/memblock.h>
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 5643fd0..4dbe656 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -4,7 +4,7 @@
 #include <linux/spinlock.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/cpu.h>
 
 #include <asm/tlbflush.h>

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

* [tip:x86/headers] x86/kernel: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 3/8] x86: kernel: audit " Paul Gortmaker
@ 2016-07-14 18:43   ` tip-bot for Paul Gortmaker
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, hpa, linux-kernel, peterz, paul.gortmaker, tglx, torvalds

Commit-ID:  186f43608a5c827f8284fe4559225b4dccaa49ef
Gitweb:     http://git.kernel.org/tip/186f43608a5c827f8284fe4559225b4dccaa49ef
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:56 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:06:41 +0200

x86/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.  Build testing
revealed some implicit header usage that was fixed up accordingly.

Note that some bool/obj-y instances remain since module.h is
the header for some exception table entry stuff, and for things
like __init_or_module (code that is tossed when MODULES=n).

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-4-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/topology.h        | 1 +
 arch/x86/kernel/acpi/boot.c            | 2 +-
 arch/x86/kernel/acpi/cstate.c          | 2 +-
 arch/x86/kernel/amd_gart_64.c          | 1 -
 arch/x86/kernel/amd_nb.c               | 2 +-
 arch/x86/kernel/apic/apic.c            | 2 +-
 arch/x86/kernel/apic/apic_flat_64.c    | 2 +-
 arch/x86/kernel/apic/apic_noop.c       | 1 -
 arch/x86/kernel/apic/hw_nmi.c          | 2 +-
 arch/x86/kernel/apic/io_apic.c         | 2 +-
 arch/x86/kernel/apic/ipi.c             | 1 -
 arch/x86/kernel/apic/probe_32.c        | 2 +-
 arch/x86/kernel/apic/probe_64.c        | 2 +-
 arch/x86/kernel/apic/x2apic_uv_x.c     | 2 +-
 arch/x86/kernel/cpu/common.c           | 2 +-
 arch/x86/kernel/cpu/hypervisor.c       | 3 ++-
 arch/x86/kernel/cpu/intel.c            | 2 +-
 arch/x86/kernel/cpu/match.c            | 2 +-
 arch/x86/kernel/cpu/mshyperv.c         | 3 ++-
 arch/x86/kernel/cpu/mtrr/cleanup.c     | 1 -
 arch/x86/kernel/cpu/mtrr/generic.c     | 2 +-
 arch/x86/kernel/cpu/perfctr-watchdog.c | 2 +-
 arch/x86/kernel/cpu/vmware.c           | 3 ++-
 arch/x86/kernel/crash.c                | 2 +-
 arch/x86/kernel/dumpstack_32.c         | 2 +-
 arch/x86/kernel/dumpstack_64.c         | 2 +-
 arch/x86/kernel/hw_breakpoint.c        | 3 ++-
 arch/x86/kernel/i386_ksyms_32.c        | 3 ++-
 arch/x86/kernel/i8253.c                | 2 +-
 arch/x86/kernel/io_delay.c             | 2 +-
 arch/x86/kernel/irq_32.c               | 1 -
 arch/x86/kernel/irq_64.c               | 1 -
 arch/x86/kernel/kdebugfs.c             | 2 +-
 arch/x86/kernel/kvm.c                  | 2 +-
 arch/x86/kernel/mpparse.c              | 1 -
 arch/x86/kernel/paravirt-spinlocks.c   | 2 +-
 arch/x86/kernel/paravirt.c             | 3 ++-
 arch/x86/kernel/pci-swiotlb.c          | 2 +-
 arch/x86/kernel/pmem.c                 | 2 +-
 arch/x86/kernel/process.c              | 3 ++-
 arch/x86/kernel/process_32.c           | 2 +-
 arch/x86/kernel/process_64.c           | 2 +-
 arch/x86/kernel/reboot.c               | 2 +-
 arch/x86/kernel/setup.c                | 2 +-
 arch/x86/kernel/smpboot.c              | 2 +-
 arch/x86/kernel/stacktrace.c           | 2 +-
 arch/x86/kernel/traps.c                | 2 +-
 arch/x86/kernel/tsc.c                  | 2 +-
 arch/x86/kernel/x8664_ksyms_64.c       | 2 +-
 arch/x86/kernel/x86_init.c             | 2 +-
 50 files changed, 50 insertions(+), 49 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index c9a4ed7..16e0cf9 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -36,6 +36,7 @@
 #include <linux/cpumask.h>
 
 #include <asm/mpspec.h>
+#include <asm/percpu.h>
 
 /* Mappings between logical cpu number and node number */
 DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 9414f84..6f3a9ad 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -28,7 +28,7 @@
 #include <linux/acpi_pmtmr.h>
 #include <linux/efi.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/dmi.h>
 #include <linux/irq.h>
 #include <linux/slab.h>
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index 4b28159..bdfad64 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -5,7 +5,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/cpu.h>
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index 8e3842f..42d27a6 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -20,7 +20,6 @@
 #include <linux/string.h>
 #include <linux/spinlock.h>
 #include <linux/pci.h>
-#include <linux/module.h>
 #include <linux/topology.h>
 #include <linux/interrupt.h>
 #include <linux/bitmap.h>
diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
index e991d5c..0f0252e 100644
--- a/arch/x86/kernel/amd_nb.c
+++ b/arch/x86/kernel/amd_nb.c
@@ -9,7 +9,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/errno.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/spinlock.h>
 #include <asm/amd_nb.h>
 
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 60078a6..60244a4 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -23,7 +23,7 @@
 #include <linux/bootmem.h>
 #include <linux/ftrace.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/syscore_ops.h>
 #include <linux/delay.h>
 #include <linux/timex.h>
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
index 76f89e2..a09a926 100644
--- a/arch/x86/kernel/apic/apic_flat_64.c
+++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -15,7 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/hardirq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/smp.h>
 #include <asm/apic.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index 13d19ed..563d920 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -11,7 +11,6 @@
 
 #include <linux/threads.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 7788ce6..f29501e 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -16,7 +16,7 @@
 #include <linux/notifier.h>
 #include <linux/kprobes.h>
 #include <linux/nmi.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/delay.h>
 
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 446702e..73e5810 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -39,7 +39,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/compiler.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/syscore_ops.h>
 #include <linux/freezer.h>
 #include <linux/kthread.h>
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index 2a0f225..3a205d4 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -8,7 +8,6 @@
 #include <linux/mc146818rtc.h>
 #include <linux/cache.h>
 #include <linux/cpu.h>
-#include <linux/module.h>
 
 #include <asm/smp.h>
 #include <asm/mtrr.h>
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index f316e34..c138062 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -8,7 +8,7 @@
  */
 #include <linux/threads.h>
 #include <linux/cpumask.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/apic/probe_64.c b/arch/x86/kernel/apic/probe_64.c
index 1793dba..d4880a3 100644
--- a/arch/x86/kernel/apic/probe_64.c
+++ b/arch/x86/kernel/apic/probe_64.c
@@ -11,7 +11,7 @@
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/ctype.h>
 #include <linux/init.h>
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 2900315..9695055 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -12,7 +12,7 @@
 #include <linux/proc_fs.h>
 #include <linux/threads.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <linux/sched.h>
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 0fe6953..ccf13ab 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2,7 +2,7 @@
 #include <linux/linkage.h>
 #include <linux/bitops.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/percpu.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index 73d391a..27e4665 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -21,7 +21,8 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <asm/processor.h>
 #include <asm/hypervisor.h>
 
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index c1a89bc..f380b61 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -5,7 +5,7 @@
 #include <linux/smp.h>
 #include <linux/sched.h>
 #include <linux/thread_info.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/uaccess.h>
 
 #include <asm/cpufeature.h>
diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c
index fbb5e90..e42117d 100644
--- a/arch/x86/kernel/cpu/match.c
+++ b/arch/x86/kernel/cpu/match.c
@@ -1,7 +1,7 @@
 #include <asm/cpu_device_id.h>
 #include <asm/cpufeature.h>
 #include <linux/cpu.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 
 /**
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 10c11b4..8f44c5a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -13,7 +13,8 @@
 #include <linux/types.h>
 #include <linux/time.h>
 #include <linux/clocksource.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/hardirq.h>
 #include <linux/efi.h>
 #include <linux/interrupt.h>
diff --git a/arch/x86/kernel/cpu/mtrr/cleanup.c b/arch/x86/kernel/cpu/mtrr/cleanup.c
index 31e951c..3b442b6 100644
--- a/arch/x86/kernel/cpu/mtrr/cleanup.c
+++ b/arch/x86/kernel/cpu/mtrr/cleanup.c
@@ -17,7 +17,6 @@
  * License along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/smp.h>
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index 16e37a2..fdc5521 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -4,7 +4,7 @@
  */
 #define DEBUG
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/mm.h>
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
index 2e8caf0..181eabe 100644
--- a/arch/x86/kernel/cpu/perfctr-watchdog.c
+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
@@ -12,7 +12,7 @@
  */
 
 #include <linux/percpu.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/bitops.h>
 #include <linux/smp.h>
diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
index 8cac429..1ff0598 100644
--- a/arch/x86/kernel/cpu/vmware.c
+++ b/arch/x86/kernel/cpu/vmware.c
@@ -22,7 +22,8 @@
  */
 
 #include <linux/dmi.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <asm/div64.h>
 #include <asm/x86_init.h>
 #include <asm/hypervisor.h>
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 9ef978d..9616cf7 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -20,7 +20,7 @@
 #include <linux/delay.h>
 #include <linux/elf.h>
 #include <linux/elfcore.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index fef917e..6942297 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -7,7 +7,7 @@
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
 #include <linux/sysfs.h>
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index d558a8a..b1b0635 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -7,7 +7,7 @@
 #include <linux/uaccess.h>
 #include <linux/hardirq.h>
 #include <linux/kdebug.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/kexec.h>
 #include <linux/sysfs.h>
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index 2bcfb5f..8771766 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -36,13 +36,14 @@
 #include <linux/percpu.h>
 #include <linux/kdebug.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
 
 #include <asm/hw_breakpoint.h>
 #include <asm/processor.h>
 #include <asm/debugreg.h>
+#include <asm/user.h>
 
 /* Per cpu debug control register value */
 DEFINE_PER_CPU(unsigned long, cpu_dr7);
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index 64341aa..b776379 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
+++ b/arch/x86/kernel/i386_ksyms_32.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/spinlock_types.h>
 
 #include <asm/checksum.h>
 #include <asm/pgtable.h>
diff --git a/arch/x86/kernel/i8253.c b/arch/x86/kernel/i8253.c
index efb82f0..6ebe00c 100644
--- a/arch/x86/kernel/i8253.c
+++ b/arch/x86/kernel/i8253.c
@@ -3,7 +3,7 @@
  *
  */
 #include <linux/clockchips.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/timex.h>
 #include <linux/i8253.h>
 
diff --git a/arch/x86/kernel/io_delay.c b/arch/x86/kernel/io_delay.c
index a979b5b..50c89e8 100644
--- a/arch/x86/kernel/io_delay.c
+++ b/arch/x86/kernel/io_delay.c
@@ -6,7 +6,7 @@
  * outb_p/inb_p API uses.
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/dmi.h>
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index c627bf8..1f38d9a 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -8,7 +8,6 @@
  * io_apic.c.)
  */
 
-#include <linux/module.h>
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 206d0b9..4a79037 100644
--- a/arch/x86/kernel/irq_64.c
+++ b/arch/x86/kernel/irq_64.c
@@ -11,7 +11,6 @@
 #include <linux/kernel_stat.h>
 #include <linux/interrupt.h>
 #include <linux/seq_file.h>
-#include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/ftrace.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
index dc1404b..bdb83e4 100644
--- a/arch/x86/kernel/kdebugfs.c
+++ b/arch/x86/kernel/kdebugfs.c
@@ -8,7 +8,7 @@
  */
 #include <linux/debugfs.h>
 #include <linux/uaccess.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/stat.h>
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
index eea2a6f..0c7aa53 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
@@ -21,7 +21,7 @@
  */
 
 #include <linux/context_tracking.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kvm_para.h>
 #include <linux/cpu.h>
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 97340f2..068c4a9 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -16,7 +16,6 @@
 #include <linux/mc146818rtc.h>
 #include <linux/bitops.h>
 #include <linux/acpi.h>
-#include <linux/module.h>
 #include <linux/smp.h>
 #include <linux/pci.h>
 
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 33ee3e0..1939a02 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
@@ -3,7 +3,7 @@
  * compiled in a FTRACE-compatible way.
  */
 #include <linux/spinlock.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/jump_label.h>
 
 #include <asm/paravirt.h>
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 7b3b3f2..ad5bc95 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -19,7 +19,8 @@
 */
 
 #include <linux/errno.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/efi.h>
 #include <linux/bcd.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
index 7c577a1..5069ef5 100644
--- a/arch/x86/kernel/pci-swiotlb.c
+++ b/arch/x86/kernel/pci-swiotlb.c
@@ -2,7 +2,7 @@
 
 #include <linux/pci.h>
 #include <linux/cache.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/swiotlb.h>
 #include <linux/bootmem.h>
 #include <linux/dma-mapping.h>
diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c
index 92f7014..0c5315d 100644
--- a/arch/x86/kernel/pmem.c
+++ b/arch/x86/kernel/pmem.c
@@ -3,7 +3,7 @@
  * Copyright (c) 2015, Intel Corporation.
  */
 #include <linux/platform_device.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 
 static int found(u64 start, u64 end, void *data)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 96becbb..61b703c 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -7,7 +7,8 @@
 #include <linux/prctl.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/pm.h>
 #include <linux/tick.h>
 #include <linux/random.h>
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 9f95091..d86be29 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -25,7 +25,7 @@
 #include <linux/delay.h>
 #include <linux/reboot.h>
 #include <linux/mc146818rtc.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kallsyms.h>
 #include <linux/ptrace.h>
 #include <linux/personality.h>
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 6e789ca..63236d8 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -26,7 +26,7 @@
 #include <linux/user.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/notifier.h>
 #include <linux/kprobes.h>
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index a9b31eb..b5b936f 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -1,6 +1,6 @@
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/pm.h>
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c4e7b39..9203a6e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -36,7 +36,7 @@
 #include <linux/console.h>
 #include <linux/root_dev.h>
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/efi.h>
 #include <linux/init.h>
 #include <linux/edd.h>
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index fafe8b9..472cc6a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -43,7 +43,7 @@
 
 #include <linux/init.h>
 #include <linux/smp.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/percpu.h>
 #include <linux/bootmem.h>
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 9ee98ee..4738f5e 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -5,7 +5,7 @@
  */
 #include <linux/sched.h>
 #include <linux/stacktrace.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/uaccess.h>
 #include <asm/stacktrace.h>
 
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 00f03d8..b70ca12 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -21,7 +21,7 @@
 #include <linux/kdebug.h>
 #include <linux/kgdb.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/ptrace.h>
 #include <linux/uprobes.h>
 #include <linux/string.h>
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 38ba6de..4435687 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -3,7 +3,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/timer.h>
 #include <linux/acpi_pmtmr.h>
 #include <linux/cpufreq.h>
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index cd05942..099a4db 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
+++ b/arch/x86/kernel/x8664_ksyms_64.c
@@ -1,7 +1,7 @@
 /* Exports for assembly files.
    All C exports should go in the respective C files. */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/smp.h>
 
 #include <net/checksum.h>
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index dad5fe9..da62e55 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -5,7 +5,7 @@
  */
 #include <linux/init.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/pci.h>
 
 #include <asm/bios_ebda.h>

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

* [tip:x86/headers] x86/lib: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 4/8] x86: lib: audit " Paul Gortmaker
@ 2016-07-14 18:44   ` tip-bot for Paul Gortmaker
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: peterz, paul.gortmaker, torvalds, hpa, tglx, linux-kernel, mingo

Commit-ID:  e683014c2113d374b8716a7c938803c2f578efd5
Gitweb:     http://git.kernel.org/tip/e683014c2113d374b8716a7c938803c2f578efd5
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:57 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:06:58 +0200

x86/lib: 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.  Build testing
revealed a couple implicit header usage issues that were fixed.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-5-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/lib/cache-smp.c        | 2 +-
 arch/x86/lib/cpu.c              | 3 ++-
 arch/x86/lib/csum-partial_64.c  | 2 +-
 arch/x86/lib/csum-wrappers_64.c | 2 +-
 arch/x86/lib/delay.c            | 2 +-
 arch/x86/lib/memcpy_32.c        | 2 +-
 arch/x86/lib/mmx_32.c           | 2 +-
 arch/x86/lib/msr-reg-export.c   | 2 +-
 arch/x86/lib/msr-smp.c          | 2 +-
 arch/x86/lib/msr.c              | 3 ++-
 arch/x86/lib/string_32.c        | 2 +-
 arch/x86/lib/usercopy.c         | 2 +-
 arch/x86/lib/usercopy_32.c      | 2 +-
 arch/x86/lib/usercopy_64.c      | 2 +-
 14 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index a3c6688..216a629 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -1,5 +1,5 @@
 #include <linux/smp.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 static void __wbinvd(void *dummy)
 {
diff --git a/arch/x86/lib/cpu.c b/arch/x86/lib/cpu.c
index aa417a9..d6f848d 100644
--- a/arch/x86/lib/cpu.c
+++ b/arch/x86/lib/cpu.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/export.h>
 
 unsigned int x86_family(unsigned int sig)
 {
diff --git a/arch/x86/lib/csum-partial_64.c b/arch/x86/lib/csum-partial_64.c
index 9845371..9a7fe6a 100644
--- a/arch/x86/lib/csum-partial_64.c
+++ b/arch/x86/lib/csum-partial_64.c
@@ -6,7 +6,7 @@
  */
  
 #include <linux/compiler.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/checksum.h>
 
 static inline unsigned short from32to16(unsigned a) 
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
index 28a6654..f8dc05d 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -5,7 +5,7 @@
  * Wrappers of assembly checksum functions for x86-64.
  */
 #include <asm/checksum.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/smap.h>
 
 /**
diff --git a/arch/x86/lib/delay.c b/arch/x86/lib/delay.c
index 2f07c29..073d1f1 100644
--- a/arch/x86/lib/delay.c
+++ b/arch/x86/lib/delay.c
@@ -11,7 +11,7 @@
  *	we have to worry about.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/timex.h>
 #include <linux/preempt.h>
diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c
index a404b4b..cad1263 100644
--- a/arch/x86/lib/memcpy_32.c
+++ b/arch/x86/lib/memcpy_32.c
@@ -1,5 +1,5 @@
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #undef memcpy
 #undef memset
diff --git a/arch/x86/lib/mmx_32.c b/arch/x86/lib/mmx_32.c
index e5e3ed8..c2311a6 100644
--- a/arch/x86/lib/mmx_32.c
+++ b/arch/x86/lib/mmx_32.c
@@ -18,7 +18,7 @@
  */
 #include <linux/hardirq.h>
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/sched.h>
 #include <linux/types.h>
 
diff --git a/arch/x86/lib/msr-reg-export.c b/arch/x86/lib/msr-reg-export.c
index 8d6ef78..ff29e8d 100644
--- a/arch/x86/lib/msr-reg-export.c
+++ b/arch/x86/lib/msr-reg-export.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/msr.h>
 
 EXPORT_SYMBOL(rdmsr_safe_regs);
diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
index 518532e..ce68b6a 100644
--- a/arch/x86/lib/msr-smp.c
+++ b/arch/x86/lib/msr-smp.c
@@ -1,4 +1,4 @@
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/preempt.h>
 #include <linux/smp.h>
 #include <asm/msr.h>
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 004c861..d1dee75 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -1,4 +1,5 @@
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/percpu.h>
 #include <linux/preempt.h>
 #include <asm/msr.h>
 #define CREATE_TRACE_POINTS
diff --git a/arch/x86/lib/string_32.c b/arch/x86/lib/string_32.c
index bd59090..dc0ad12 100644
--- a/arch/x86/lib/string_32.c
+++ b/arch/x86/lib/string_32.c
@@ -11,7 +11,7 @@
  */
 
 #include <linux/string.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #ifdef __HAVE_ARCH_STRCPY
 char *strcpy(char *dest, const char *src)
diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c
index e342586..b490878 100644
--- a/arch/x86/lib/usercopy.c
+++ b/arch/x86/lib/usercopy.c
@@ -5,7 +5,7 @@
  */
 
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <asm/word-at-a-time.h>
 #include <linux/sched.h>
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index b559d92..3bc7baf 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -8,7 +8,7 @@
 #include <linux/mm.h>
 #include <linux/highmem.h>
 #include <linux/blkdev.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/backing-dev.h>
 #include <linux/interrupt.h>
 #include <asm/uaccess.h>
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
index 0a42327..e1e0364 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -5,7 +5,7 @@
  * Copyright 1997 Linus Torvalds
  * Copyright 2002 Andi Kleen <ak@suse.de>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <asm/uaccess.h>
 
 /*

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

* [tip:x86/headers] x86/platform: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 5/8] x86: platform: audit " Paul Gortmaker
@ 2016-07-14 18:44   ` tip-bot for Paul Gortmaker
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:44 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: torvalds, tglx, peterz, hpa, linux-kernel, paul.gortmaker, mingo

Commit-ID:  cc3ae7b0af27118994c1e491382b253be3b762bf
Gitweb:     http://git.kernel.org/tip/cc3ae7b0af27118994c1e491382b253be3b762bf
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:58 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:06:59 +0200

x86/platform: 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.

One module.h was converted to moduleparam.h since the file had
multiple module_param() in it, and another file had an instance of
MODULE_DEVICE_TABLE deleted, since that is a no-op when builtin.

Finally, the 32 bit build coverage of olpc_ofw revealed a couple
implicit includes, which were pretty self evident to fix based on
what gcc was complaining about.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-6-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/platform/ce4100/ce4100.c       | 2 +-
 arch/x86/platform/efi/efi_64.c          | 2 +-
 arch/x86/platform/intel-mid/intel-mid.c | 2 +-
 arch/x86/platform/intel-mid/pwr.c       | 4 +---
 arch/x86/platform/intel-mid/sfi.c       | 2 +-
 arch/x86/platform/olpc/olpc.c           | 2 +-
 arch/x86/platform/olpc/olpc_ofw.c       | 5 ++++-
 arch/x86/platform/ts5500/ts5500.c       | 2 +-
 arch/x86/platform/uv/uv_irq.c           | 2 +-
 arch/x86/platform/uv/uv_nmi.c           | 2 +-
 10 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c
index 701fd58..7ab4d3f 100644
--- a/arch/x86/platform/ce4100/ce4100.c
+++ b/arch/x86/platform/ce4100/ce4100.c
@@ -11,7 +11,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/reboot.h>
 #include <linux/serial_reg.h>
 #include <linux/serial_8250.h>
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index b226b3f..2f98445 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -24,7 +24,7 @@
 #include <linux/spinlock.h>
 #include <linux/bootmem.h>
 #include <linux/ioport.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/efi.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
diff --git a/arch/x86/platform/intel-mid/intel-mid.c b/arch/x86/platform/intel-mid/intel-mid.c
index abbf49c..ce119d2 100644
--- a/arch/x86/platform/intel-mid/intel-mid.c
+++ b/arch/x86/platform/intel-mid/intel-mid.c
@@ -20,7 +20,7 @@
 #include <linux/scatterlist.h>
 #include <linux/sfi.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/notifier.h>
 
 #include <asm/setup.h>
diff --git a/arch/x86/platform/intel-mid/pwr.c b/arch/x86/platform/intel-mid/pwr.c
index 5bc90dd..c901a34 100644
--- a/arch/x86/platform/intel-mid/pwr.c
+++ b/arch/x86/platform/intel-mid/pwr.c
@@ -21,10 +21,9 @@
 
 #include <linux/delay.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mutex.h>
 #include <linux/pci.h>
 
@@ -407,7 +406,6 @@ static const struct pci_device_id mid_pwr_pci_ids[] = {
 	{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_TANGIER), (kernel_ulong_t)&mid_info },
 	{}
 };
-MODULE_DEVICE_TABLE(pci, mid_pwr_pci_ids);
 
 static struct pci_driver mid_pwr_pci_driver = {
 	.name		= "intel_mid_pwr",
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 1555672..051d264 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -24,7 +24,7 @@
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/irq.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/notifier.h>
 #include <linux/mmc/core.h>
 #include <linux/mmc/card.h>
diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c
index 2737608..7c3077e 100644
--- a/arch/x86/platform/olpc/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
@@ -12,7 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/string.h>
diff --git a/arch/x86/platform/olpc/olpc_ofw.c b/arch/x86/platform/olpc/olpc_ofw.c
index e7604f6..f1aab8c 100644
--- a/arch/x86/platform/olpc/olpc_ofw.c
+++ b/arch/x86/platform/olpc/olpc_ofw.c
@@ -1,9 +1,12 @@
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/spinlock_types.h>
 #include <linux/init.h>
 #include <asm/page.h>
 #include <asm/setup.h>
 #include <asm/io.h>
+#include <asm/cpufeature.h>
+#include <asm/special_insns.h>
 #include <asm/pgtable.h>
 #include <asm/olpc_ofw.h>
 
diff --git a/arch/x86/platform/ts5500/ts5500.c b/arch/x86/platform/ts5500/ts5500.c
index baf16e7..952191b 100644
--- a/arch/x86/platform/ts5500/ts5500.c
+++ b/arch/x86/platform/ts5500/ts5500.c
@@ -23,7 +23,7 @@
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/leds.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_data/gpio-ts5500.h>
 #include <linux/platform_data/max197.h>
 #include <linux/platform_device.h>
diff --git a/arch/x86/platform/uv/uv_irq.c b/arch/x86/platform/uv/uv_irq.c
index e1c2463..776c659 100644
--- a/arch/x86/platform/uv/uv_irq.c
+++ b/arch/x86/platform/uv/uv_irq.c
@@ -8,7 +8,7 @@
  * Copyright (C) 2008 Silicon Graphics, Inc. All rights reserved.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/rbtree.h>
 #include <linux/slab.h>
 #include <linux/irq.h>
diff --git a/arch/x86/platform/uv/uv_nmi.c b/arch/x86/platform/uv/uv_nmi.c
index 8dd8005..cd5173a 100644
--- a/arch/x86/platform/uv/uv_nmi.c
+++ b/arch/x86/platform/uv/uv_nmi.c
@@ -24,7 +24,7 @@
 #include <linux/kdb.h>
 #include <linux/kexec.h>
 #include <linux/kgdb.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/nmi.h>
 #include <linux/sched.h>
 #include <linux/slab.h>

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

* [tip:x86/headers] x86/xen: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:18 ` [PATCH 6/8] x86: xen: audit " Paul Gortmaker
  2016-07-14  3:59   ` Juergen Gross
@ 2016-07-14 18:45   ` tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, mingo, torvalds, boris.ostrovsky, hpa,
	david.vrabel, paul.gortmaker, tglx, jgross, peterz

Commit-ID:  7a2463dcacee3f2f36c78418c201756372eeea6b
Gitweb:     http://git.kernel.org/tip/7a2463dcacee3f2f36c78418c201756372eeea6b
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:18:59 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:06:59 +0200

x86/xen: 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.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: xen-devel@lists.xenproject.org
Link: http://lkml.kernel.org/r/20160714001901.31603-7-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/xen/debugfs.c             | 1 -
 arch/x86/xen/enlighten.c           | 2 +-
 arch/x86/xen/mmu.c                 | 3 ++-
 arch/x86/xen/p2m.c                 | 2 +-
 arch/x86/xen/platform-pci-unplug.c | 2 +-
 arch/x86/xen/setup.c               | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index c8377fb..1daff55 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -1,7 +1,6 @@
 #include <linux/init.h>
 #include <linux/debugfs.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include "debugfs.h"
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 760789a..1f984ab 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -23,7 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kprobes.h>
 #include <linux/bootmem.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/page-flags.h>
 #include <linux/highmem.h>
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 6743371..7d5afdb 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -43,7 +43,8 @@
 #include <linux/debugfs.h>
 #include <linux/bug.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
 #include <linux/seq_file.h>
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index dd2a49a..37129db 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -60,7 +60,7 @@
  */
 
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/list.h>
 #include <linux/hash.h>
 #include <linux/sched.h>
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
index 9586ff3..d37a0c7 100644
--- a/arch/x86/xen/platform-pci-unplug.c
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -21,7 +21,7 @@
 
 #include <linux/init.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 
 #include <xen/platform_pci.h>
 #include "xen-ops.h"
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index e345891..1764252 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -4,7 +4,7 @@
  * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/pm.h>

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

* [tip:x86/headers] x86/kvm: Audit and remove any unnecessary uses of module.h
  2016-07-14  0:19 ` [PATCH 7/8] x86: kvm: audit " Paul Gortmaker
  2016-07-14  7:42   ` Paolo Bonzini
@ 2016-07-14 18:45   ` tip-bot for Paul Gortmaker
  1 sibling, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: pbonzini, linux-kernel, tglx, hpa, torvalds, peterz, rkrcmar,
	mingo, paul.gortmaker

Commit-ID:  1767e931e3c3024b1f0d115082179191f5d652c2
Gitweb:     http://git.kernel.org/tip/1767e931e3c3024b1f0d115082179191f5d652c2
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:19:00 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:07:00 +0200

x86/kvm: 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.  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.

Several instances got replaced with moduleparam.h since that was
really all that was required for those particular files.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm@vger.kernel.org
Link: http://lkml.kernel.org/r/20160714001901.31603-8-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kvm/cpuid.c   | 2 +-
 arch/x86/kvm/emulate.c | 1 -
 arch/x86/kvm/iommu.c   | 2 +-
 arch/x86/kvm/irq.c     | 2 +-
 arch/x86/kvm/lapic.c   | 2 +-
 arch/x86/kvm/mmu.c     | 3 ++-
 arch/x86/kvm/x86.c     | 3 ++-
 7 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 7597b42..a6885de 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -13,7 +13,7 @@
  */
 
 #include <linux/kvm_host.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/vmalloc.h>
 #include <linux/uaccess.h>
 #include <asm/fpu/internal.h> /* For use_eager_fpu.  Ugh! */
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a2f24af..4e95d3e 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -22,7 +22,6 @@
 
 #include <linux/kvm_host.h>
 #include "kvm_cache_regs.h"
-#include <linux/module.h>
 #include <asm/kvm_emulate.h>
 #include <linux/stringify.h>
 #include <asm/debugreg.h>
diff --git a/arch/x86/kvm/iommu.c b/arch/x86/kvm/iommu.c
index 3069281..95e0e64 100644
--- a/arch/x86/kvm/iommu.c
+++ b/arch/x86/kvm/iommu.c
@@ -25,7 +25,7 @@
 
 #include <linux/list.h>
 #include <linux/kvm_host.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/pci.h>
 #include <linux/stat.h>
 #include <linux/dmar.h>
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 95fcc7b..60d91c9 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -20,7 +20,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kvm_host.h>
 
 #include "irq.h"
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index a397200..57549ed 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -25,7 +25,7 @@
 #include <linux/smp.h>
 #include <linux/hrtimer.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/math64.h>
 #include <linux/slab.h>
 #include <asm/processor.h>
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index def97b3..745a5f4 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -29,7 +29,8 @@
 #include <linux/string.h>
 #include <linux/mm.h>
 #include <linux/highmem.h>
-#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/export.h>
 #include <linux/swap.h>
 #include <linux/hugetlb.h>
 #include <linux/compiler.h>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7da5dd2..919bdc7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -36,7 +36,8 @@
 #include <linux/kvm.h>
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/moduleparam.h>
 #include <linux/mman.h>
 #include <linux/highmem.h>
 #include <linux/iommu.h>

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

* [tip:x86/headers] x86: Audit and remove any remaining unnecessary uses of module.h
  2016-07-14  0:19 ` [PATCH 8/8] x86: audit and remove any remaining " Paul Gortmaker
@ 2016-07-14 18:45   ` tip-bot for Paul Gortmaker
  0 siblings, 0 replies; 25+ messages in thread
From: tip-bot for Paul Gortmaker @ 2016-07-14 18:45 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, torvalds, peterz, paul.gortmaker, tglx, mingo

Commit-ID:  eb008eb6f8b689853d6e9f4ae3ff56ea734e4319
Gitweb:     http://git.kernel.org/tip/eb008eb6f8b689853d6e9f4ae3ff56ea734e4319
Author:     Paul Gortmaker <paul.gortmaker@windriver.com>
AuthorDate: Wed, 13 Jul 2016 20:19:01 -0400
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 14 Jul 2016 15:07:00 +0200

x86: Audit and remove any remaining unnecessary uses of module.h

Historically a lot of these existed because we did not have
a distinction between what was modular code and what was providing
support to modules via EXPORT_SYMBOL and friends.  That changed
when we forked out support for the latter into the export.h file.

This means we should be able to reduce the usage of module.h
in code that is obj-y Makefile or bool Kconfig.  In the case of
some of these which are modular, we can extend that to also include
files that are building basic support functionality but not related
to loading or registering the final module; such files also have
no need whatsoever for module.h

The advantage in removing such instances is that module.h itself
sources about 15 other headers; adding significantly to what we feed
cpp, and it can obscure what headers we are effectively using.

Since module.h was the source for init.h (for __init) and for
export.h (for EXPORT_SYMBOL) we consider each instance for the
presence of either and replace as needed.

In the case of crypto/glue_helper.c we delete a redundant instance
of MODULE_LICENSE in order to delete module.h -- the license info
is already present at the top of the file.

The uncore change warrants a mention too; it is uncore.c that uses
module.h and not uncore.h; hence the relocation done there.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160714001901.31603-9-paul.gortmaker@windriver.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/crypto/glue_helper.c    | 4 +---
 arch/x86/events/amd/ibs.c        | 3 ++-
 arch/x86/events/amd/iommu.c      | 2 +-
 arch/x86/events/core.c           | 3 ++-
 arch/x86/events/intel/uncore.c   | 2 ++
 arch/x86/events/intel/uncore.h   | 1 -
 arch/x86/include/asm/livepatch.h | 1 -
 arch/x86/kernel/cpu/mtrr/if.c    | 1 -
 arch/x86/kernel/cpu/mtrr/main.c  | 2 +-
 arch/x86/pci/xen.c               | 2 +-
 arch/x86/um/delay.c              | 2 +-
 11 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/arch/x86/crypto/glue_helper.c b/arch/x86/crypto/glue_helper.c
index 6a85598..3cc4cad 100644
--- a/arch/x86/crypto/glue_helper.c
+++ b/arch/x86/crypto/glue_helper.c
@@ -25,7 +25,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <crypto/b128ops.h>
 #include <crypto/lrw.h>
 #include <crypto/xts.h>
@@ -397,5 +397,3 @@ void glue_xts_crypt_128bit_one(void *ctx, u128 *dst, const u128 *src, le128 *iv,
 	u128_xor(dst, dst, (u128 *)&ivblk);
 }
 EXPORT_SYMBOL_GPL(glue_xts_crypt_128bit_one);
-
-MODULE_LICENSE("GPL");
diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index feb90f6..2d40247 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -7,7 +7,8 @@
  */
 
 #include <linux/perf_event.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/pci.h>
 #include <linux/ptrace.h>
 #include <linux/syscore_ops.h>
diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c
index 6011a57..b28200d 100644
--- a/arch/x86/events/amd/iommu.c
+++ b/arch/x86/events/amd/iommu.c
@@ -12,7 +12,7 @@
  */
 
 #include <linux/perf_event.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/cpumask.h>
 #include <linux/slab.h>
 
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 26ced53..154e9e1 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -17,7 +17,8 @@
 #include <linux/notifier.h>
 #include <linux/hardirq.h>
 #include <linux/kprobes.h>
-#include <linux/module.h>
+#include <linux/export.h>
+#include <linux/init.h>
 #include <linux/kdebug.h>
 #include <linux/sched.h>
 #include <linux/uaccess.h>
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index fce7406..95726cd 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1,3 +1,5 @@
+#include <linux/module.h>
+
 #include <asm/cpu_device_id.h>
 #include "uncore.h"
 
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index 79766b9..05b71e9 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -1,4 +1,3 @@
-#include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <asm/apicdef.h>
diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
index a7f9181..ed80003 100644
--- a/arch/x86/include/asm/livepatch.h
+++ b/arch/x86/include/asm/livepatch.h
@@ -22,7 +22,6 @@
 #define _ASM_X86_LIVEPATCH_H
 
 #include <asm/setup.h>
-#include <linux/module.h>
 #include <linux/ftrace.h>
 
 static inline int klp_check_compiler_support(void)
diff --git a/arch/x86/kernel/cpu/mtrr/if.c b/arch/x86/kernel/cpu/mtrr/if.c
index d76f13d..6d9b455 100644
--- a/arch/x86/kernel/cpu/mtrr/if.c
+++ b/arch/x86/kernel/cpu/mtrr/if.c
@@ -2,7 +2,6 @@
 #include <linux/seq_file.h>
 #include <linux/uaccess.h>
 #include <linux/proc_fs.h>
-#include <linux/module.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 #include <linux/slab.h>
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
index 7d393ec..28f1b54 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -38,7 +38,7 @@
 #include <linux/stop_machine.h>
 #include <linux/kvm_para.h>
 #include <linux/uaccess.h>
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/mutex.h>
 #include <linux/init.h>
 #include <linux/sort.h>
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 99ddab7..3a483cb 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -9,7 +9,7 @@
  *           Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  *           Stefano Stabellini <stefano.stabellini@eu.citrix.com>
  */
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/acpi.h>
diff --git a/arch/x86/um/delay.c b/arch/x86/um/delay.c
index f3fe1a6..a8fb7ca 100644
--- a/arch/x86/um/delay.c
+++ b/arch/x86/um/delay.c
@@ -7,7 +7,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <asm/param.h>

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

* Re: [PATCH 0/8] x86: audit and remove needless module.h includes
  2016-07-14 18:39     ` Ingo Molnar
@ 2016-07-14 18:46       ` Paul Gortmaker
  2016-07-14 18:56         ` Ingo Molnar
  0 siblings, 1 reply; 25+ messages in thread
From: Paul Gortmaker @ 2016-07-14 18:46 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel

[Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 20:39) Ingo Molnar wrote:

> 
> * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> 
> > > I'll continue testing with the setup_percpu.c change left out.
> > 
> > Let me know if you want a resend or if you want to just add the
> > asm/desc.h locally or ...
> 
> So I tried the asm/desc.h but saw other build failures - for now gave up.
> Can we do this in a separate patch?

Yes of course.  In the meantime I'll investigate further and add more
configs to my testing.  Is there a list of the configs used for sanity
testing tip somewhere?

Thanks, 
Paul.
--

> 
> Thanks,
> 
> 	Ingo

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

* Re: [PATCH 0/8] x86: audit and remove needless module.h includes
  2016-07-14 18:46       ` Paul Gortmaker
@ 2016-07-14 18:56         ` Ingo Molnar
  0 siblings, 0 replies; 25+ messages in thread
From: Ingo Molnar @ 2016-07-14 18:56 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Arjan van de Ven, Boris Ostrovsky, David Vrabel,
	H. Peter Anvin, Ingo Molnar, Juergen Gross, Paolo Bonzini,
	Radim Krčmář,
	Thomas Gleixner, kvm, x86, xen-devel


* Paul Gortmaker <paul.gortmaker@windriver.com> wrote:

> [Re: [PATCH 0/8] x86: audit and remove needless module.h includes] On 14/07/2016 (Thu 20:39) Ingo Molnar wrote:
> 
> > 
> > * Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> > 
> > > > I'll continue testing with the setup_percpu.c change left out.
> > > 
> > > Let me know if you want a resend or if you want to just add the
> > > asm/desc.h locally or ...
> > 
> > So I tried the asm/desc.h but saw other build failures - for now gave up.
> > Can we do this in a separate patch?
> 
> Yes of course.  In the meantime I'll investigate further and add more
> configs to my testing.  Is there a list of the configs used for sanity
> testing tip somewhere?

No need for you to complicate your testing (unless you have enough hardware 
resources for that) - I can deal with the occasional build failure. Since I 
eventually create and boot randconfigs there's no fixed set of configs. :-/

That I enabled SMP on the "allnoconfig" (and forgot about it!) has to do with the 
fact that even my allnoconfigs are typically bootable (on one of my test systems) 
so there's a handful of pre-baked configs that always get enabled.

But other than those small perturbations I do similar testing to what you did: 
all{no|def|mod|yes}config on x86-{32|64}, plus randconfigs.

Thanks,

	Ingo

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

end of thread, other threads:[~2016-07-14 18:56 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14  0:18 [PATCH 0/8] x86: audit and remove needless module.h includes Paul Gortmaker
2016-07-14  0:18 ` [PATCH 1/8] x86: don't use module.h just for AUTHOR / LICENSE tags Paul Gortmaker
2016-07-14  0:22   ` Arjan van de Ven
2016-07-14 18:43   ` [tip:x86/headers] x86: Don't " tip-bot for Paul Gortmaker
2016-07-14  0:18 ` [PATCH 2/8] x86: mm: audit and remove any unnecessary uses of module.h Paul Gortmaker
2016-07-14 18:43   ` [tip:x86/headers] x86/mm: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:18 ` [PATCH 3/8] x86: kernel: audit " Paul Gortmaker
2016-07-14 18:43   ` [tip:x86/headers] x86/kernel: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:18 ` [PATCH 4/8] x86: lib: audit " Paul Gortmaker
2016-07-14 18:44   ` [tip:x86/headers] x86/lib: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:18 ` [PATCH 5/8] x86: platform: audit " Paul Gortmaker
2016-07-14 18:44   ` [tip:x86/headers] x86/platform: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:18 ` [PATCH 6/8] x86: xen: audit " Paul Gortmaker
2016-07-14  3:59   ` Juergen Gross
2016-07-14 18:45   ` [tip:x86/headers] x86/xen: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:19 ` [PATCH 7/8] x86: kvm: audit " Paul Gortmaker
2016-07-14  7:42   ` Paolo Bonzini
2016-07-14 18:45   ` [tip:x86/headers] x86/kvm: Audit " tip-bot for Paul Gortmaker
2016-07-14  0:19 ` [PATCH 8/8] x86: audit and remove any remaining " Paul Gortmaker
2016-07-14 18:45   ` [tip:x86/headers] x86: Audit " tip-bot for Paul Gortmaker
2016-07-14 13:04 ` [PATCH 0/8] x86: audit and remove needless module.h includes Ingo Molnar
2016-07-14 15:18   ` Paul Gortmaker
2016-07-14 18:39     ` Ingo Molnar
2016-07-14 18:46       ` Paul Gortmaker
2016-07-14 18:56         ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).