x86: fix instances of non-modular code using modular fcns
cover x86: fix instances of non-modular code using modular fcns
In the previous merge window, we made changes to allow better delineation between modular and non-modular code in commit 0fd972a7d91d6e15393c449492a04d94c0b89351 ("module: relocate module_init from init.h to module.h"). This allows us to now ensure module code looks modular and non-modular code does not accidentally look modular without suffering build breakage from header entanglement.
Here we target x86 code that is, by nature of the Kconfig/Makefile, only available to be built-in, but implicitly presenting itself as being possibly modular by way of using modular headers and macros.
The goal here is to remove that illusion of modularity from these files, but in a way that leaves the actual runtime unchanged. We also get the side benefit of a reduced CPP overhead, since the removal of module.h from a file can reduce the number of lines emitted by 20k.
Two of the three are the trivial mapping of module_init onto the equivalent device_initcall ; the pmc_atom change is that too, but also includes the removal of a no-op MODULE_DEVICE_TABLE and a corrected comment relating to that, hence the larger diffstat there.
Paul.
---
Paul Gortmaker (3):
x86/platform: make atom/pmc_atom.c explicitly non-modular arch/x86: make mm/pageattr[-test].c explicitly non-modular arch/x86: make kernel/check.c explicitly non-modular
arch/x86/kernel/check.c | 5 ++--- arch/x86/mm/pageattr-test.c | 4 ++-- arch/x86/mm/pageattr.c | 1 - arch/x86/platform/atom/pmc_atom.c | 13 ++++--------- 4 files changed, 8 insertions(+), 15 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/3 x86/platform: make atom/pmc_atom.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
config PMC_ATOM
def_bool y
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
We leave some tags like MODULE_AUTHOR for documentation purposes.
Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We correct a comment that indicates the data was only used by that macro, as it actually is used by the code directly.
--- arch/x86/platform/atom/pmc_atom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/x86/platform/atom/pmc_atom.c +4 -9
@@ -15,7 +15,6 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/device.h>
@@ -422,10 +421,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)/* * Data for PCI driver interface * -* This data only exists for exporting the supported -* PCI ids via MODULE_DEVICE_TABLE. We do not actually -* register a pci_driver, because lpc_ich will register -* a driver on the same PCI id. +* used by pci_match_id() call below. */ static const struct pci_device_id pmc_pci_ids[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_VLV_PMC ), (kernel_ulong_t)&byt_reg_map },
@@ -433,8 +429,6 @@ static const struct pci_device_id pmc_pci_ids[] = { { 0, }, }; -MODULE_DEVICE_TABLE (pci, pmc_pci_ids); -static int __init pmc_atom_init (void ) {struct pci_dev *pdev =NULL ;
@@ -457,9 +451,10 @@ static int __init pmc_atom_init(void)return -ENODEV ; } -module_init (pmc_atom_init); -/* no module_exit, this driver shouldn't be unloaded */ +device_initcall (pmc_atom_init); +/* MODULE_AUTHOR("Aubrey Li <[email protected]>"); MODULE_DESCRIPTION("Intel Atom SOC Power Management Controller Interface"); MODULE_LICENSE("GPL v2"); +*/
Signature · 1 line
2.5.0
tip-bot for Paul Gortmaker
merge bot[tip:x86/platform] x86/platform: Make atom/ pmc_atom.c explicitly non-modular
x86/platform: Make atom/pmc_atom.c explicitly non-modular
Commit-ID: e971aa2cbac02363a29e9358de3b688001191ffd Gitweb: http://git.kernel.org/tip/e971aa2cbac02363a29e9358de3b688001191ffd Author: Paul Gortmaker <[email protected]> AuthorDate: Mon, 24 Aug 2015 19:34:53 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 25 Aug 2015 09:47:50 +0200
x86/platform: Make atom/pmc_atom.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
config PMC_ATOM
def_bool y
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the driver there is no doubt it is builtin-only.
Since module_init() translates to device_initcall() in the non-modular case, the init ordering remains unchanged with this commit.
We leave some tags like MODULE_AUTHOR() for documentation purposes.
Also note that MODULE_DEVICE_TABLE() is a no-op for non-modular code. We correct a comment that indicates the data was only used by that macro, as it actually is used by the code directly.
--- arch/x86/platform/atom/pmc_atom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
arch/x86/platform/atom/pmc_atom.c +4 -9
@@ -15,7 +15,6 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/module.h> #include <linux/init.h> #include <linux/pci.h> #include <linux/device.h>
@@ -422,10 +421,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent)/* * Data for PCI driver interface * -* This data only exists for exporting the supported -* PCI ids via MODULE_DEVICE_TABLE. We do not actually -* register a pci_driver, because lpc_ich will register -* a driver on the same PCI id. +* used by pci_match_id() call below. */ static const struct pci_device_id pmc_pci_ids[] = { {PCI_VDEVICE (INTEL ,PCI_DEVICE_ID_VLV_PMC ), (kernel_ulong_t)&byt_reg_map },
@@ -433,8 +429,6 @@ static const struct pci_device_id pmc_pci_ids[] = { { 0, }, }; -MODULE_DEVICE_TABLE (pci, pmc_pci_ids); -static int __init pmc_atom_init (void ) {struct pci_dev *pdev =NULL ;
@@ -457,9 +451,10 @@ static int __init pmc_atom_init(void)return -ENODEV ; } -module_init (pmc_atom_init); -/* no module_exit, this driver shouldn't be unloaded */ +device_initcall (pmc_atom_init); +/* MODULE_AUTHOR("Aubrey Li <[email protected]>"); MODULE_DESCRIPTION("Intel Atom SOC Power Management Controller Interface"); MODULE_LICENSE("GPL v2"); +*/
PATCH 2/3 arch/x86: make mm/pageattr[-test].c explicitly non-modular
In reply to Paul GortmakerThe file pageattr.c is obj-y and it includes pageattr-test.c based on CPA_DEBUG (a bool), meaning that no code here is currently being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the code there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
--- arch/x86/mm/pageattr-test.c | 4 ++-- arch/x86/mm/pageattr.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
arch/x86/mm/pageattr-test.c +2 -2
@@ -8,6 +8,7 @@#include <linux/kthread.h> #include <linux/random.h> #include <linux/kernel.h> +#include <linux/init.h> #include <linux/mm.h> #include <linux/vmalloc.h>
@@ -256,5 +257,4 @@ static int start_pageattr_test(void)return 0 ; } - -module_init (start_pageattr_test); +device_initcall (start_pageattr_test);
arch/x86/mm/pageattr.c +0 -1
@@ -4,7 +4,6 @@*/ #include <linux/highmem.h> #include <linux/bootmem.h> -#include <linux/module.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/interrupt.h>
Signature · 1 line
2.5.0
tip-bot for Paul Gortmaker
merge bot[tip:x86/mm] x86/mm/pat: Make mm/pageattr[-test] .c explicitly non-modular
x86/mm/pat: Make mm/pageattr[-test].c explicitly non-modular
Commit-ID: 8f45fe441a9836011672436ef007654969b28ccc Gitweb: http://git.kernel.org/tip/8f45fe441a9836011672436ef007654969b28ccc Author: Paul Gortmaker <[email protected]> AuthorDate: Mon, 24 Aug 2015 19:34:54 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 25 Aug 2015 09:48:38 +0200
x86/mm/pat: Make mm/pageattr[-test].c explicitly non-modular
The file pageattr.c is obj-y and it includes pageattr-test.c based on CPA_DEBUG (a bool), meaning that no code here is currently being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the code there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
--- arch/x86/mm/pageattr-test.c | 4 ++-- arch/x86/mm/pageattr.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-)
arch/x86/mm/pageattr-test.c +2 -2
@@ -8,6 +8,7 @@#include <linux/kthread.h> #include <linux/random.h> #include <linux/kernel.h> +#include <linux/init.h> #include <linux/mm.h> #include <linux/vmalloc.h>
@@ -256,5 +257,4 @@ static int start_pageattr_test(void)return 0 ; } - -module_init (start_pageattr_test); +device_initcall (start_pageattr_test);
arch/x86/mm/pageattr.c +0 -1
@@ -4,7 +4,6 @@*/ #include <linux/highmem.h> #include <linux/bootmem.h> -#include <linux/module.h> #include <linux/sched.h> #include <linux/mm.h> #include <linux/interrupt.h>
PATCH 3/3 arch/x86: make kernel/check.c explicitly non-modular
In reply to Paul GortmakerThe Kconfig currently controlling compilation of this code is:
arch/x86/Kconfig:config X86_CHECK_BIOS_CORRUPTIONarch/x86/Kconfig: bool "Check for low memory corruption"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the code there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
--- arch/x86/kernel/check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/check.c +2 -3
@@ -1,4 +1,4 @@ -#include <linux/module.h> +#include <linux/init.h> #include <linux/sched.h> #include <linux/kthread.h> #include <linux/workqueue.h>
@@ -163,6 +163,5 @@ static int start_periodic_check_for_corruption(void)schedule_delayed_work (&bios_check_work,0 );return 0 ; } - -module_init (start_periodic_check_for_corruption); +device_initcall (start_periodic_check_for_corruption);
Signature · 1 line
2.5.0
tip-bot for Paul Gortmaker
merge bot[tip:x86/mm] x86/mm: Make kernel/check.c explicitly non-modular
x86/mm: Make kernel/check.c explicitly non-modular
Commit-ID: 13fe86f465b72fc9328d4f5ebc33223c011852ae Gitweb: http://git.kernel.org/tip/13fe86f465b72fc9328d4f5ebc33223c011852ae Author: Paul Gortmaker <[email protected]> AuthorDate: Mon, 24 Aug 2015 19:34:55 -0400 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 25 Aug 2015 09:48:38 +0200
x86/mm: Make kernel/check.c explicitly non-modular
The Kconfig currently controlling compilation of this code is:
arch/x86/Kconfig:config X86_CHECK_BIOS_CORRUPTION
arch/x86/Kconfig: bool "Check for low memory corruption"
...meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modularity so that when reading the code there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.
--- arch/x86/kernel/check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/kernel/check.c +2 -3
@@ -1,4 +1,4 @@ -#include <linux/module.h> +#include <linux/init.h> #include <linux/sched.h> #include <linux/kthread.h> #include <linux/workqueue.h>
@@ -162,6 +162,5 @@ static int start_periodic_check_for_corruption(void)schedule_delayed_work (&bios_check_work,0 );return 0 ; } - -module_init (start_periodic_check_for_corruption); +device_initcall (start_periodic_check_for_corruption);