* [PATCH 0/3] x86: fix instances of non-modular code using modular fcns
@ 2015-08-24 23:34 Paul Gortmaker
2015-08-24 23:34 ` [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular Paul Gortmaker
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-08-24 23:34 UTC (permalink / raw)
To: x86
Cc: linux-kernel, Paul Gortmaker, Andy Shevchenko, H. Peter Anvin,
Ingo Molnar, Thomas Gleixner
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.
---
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
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(-)
--
2.5.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular 2015-08-24 23:34 [PATCH 0/3] x86: fix instances of non-modular code using modular fcns Paul Gortmaker @ 2015-08-24 23:34 ` Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/platform] x86/platform: Make atom/ pmc_atom.c " tip-bot for Paul Gortmaker 2015-08-24 23:34 ` [PATCH 2/3] arch/x86: make mm/pageattr[-test].c " Paul Gortmaker 2015-08-24 23:34 ` [PATCH 3/3] arch/x86: make kernel/check.c " Paul Gortmaker 2 siblings, 1 reply; 7+ messages in thread From: Paul Gortmaker @ 2015-08-24 23:34 UTC (permalink / raw) To: x86 Cc: linux-kernel, Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andy Shevchenko 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. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: x86@kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> --- arch/x86/platform/atom/pmc_atom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/x86/platform/atom/pmc_atom.c b/arch/x86/platform/atom/pmc_atom.c index e814d341a703..964ff4fc61f9 100644 --- a/arch/x86/platform/atom/pmc_atom.c +++ b/arch/x86/platform/atom/pmc_atom.c @@ -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 <aubrey.li@linux.intel.com>"); MODULE_DESCRIPTION("Intel Atom SOC Power Management Controller Interface"); MODULE_LICENSE("GPL v2"); +*/ -- 2.5.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [tip:x86/platform] x86/platform: Make atom/ pmc_atom.c explicitly non-modular 2015-08-24 23:34 ` [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular Paul Gortmaker @ 2015-08-25 8:22 ` tip-bot for Paul Gortmaker 0 siblings, 0 replies; 7+ messages in thread From: tip-bot for Paul Gortmaker @ 2015-08-25 8:22 UTC (permalink / raw) To: linux-tip-commits Cc: paul.gortmaker, hpa, tglx, torvalds, andriy.shevchenko, peterz, linux-kernel, mingo Commit-ID: e971aa2cbac02363a29e9358de3b688001191ffd Gitweb: http://git.kernel.org/tip/e971aa2cbac02363a29e9358de3b688001191ffd Author: Paul Gortmaker <paul.gortmaker@windriver.com> AuthorDate: Mon, 24 Aug 2015 19:34:53 -0400 Committer: Ingo Molnar <mingo@kernel.org> 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. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.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/1440459295-21814-2-git-send-email-paul.gortmaker@windriver.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/platform/atom/pmc_atom.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/x86/platform/atom/pmc_atom.c b/arch/x86/platform/atom/pmc_atom.c index e814d34..964ff4f 100644 --- a/arch/x86/platform/atom/pmc_atom.c +++ b/arch/x86/platform/atom/pmc_atom.c @@ -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 <aubrey.li@linux.intel.com>"); MODULE_DESCRIPTION("Intel Atom SOC Power Management Controller Interface"); MODULE_LICENSE("GPL v2"); +*/ ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] arch/x86: make mm/pageattr[-test].c explicitly non-modular 2015-08-24 23:34 [PATCH 0/3] x86: fix instances of non-modular code using modular fcns Paul Gortmaker 2015-08-24 23:34 ` [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular Paul Gortmaker @ 2015-08-24 23:34 ` Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/mm] x86/mm/pat: Make mm/pageattr[-test] .c " tip-bot for Paul Gortmaker 2015-08-24 23:34 ` [PATCH 3/3] arch/x86: make kernel/check.c " Paul Gortmaker 2 siblings, 1 reply; 7+ messages in thread From: Paul Gortmaker @ 2015-08-24 23:34 UTC (permalink / raw) To: x86 Cc: linux-kernel, Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin 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. 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/pageattr-test.c | 4 ++-- arch/x86/mm/pageattr.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 8ff686aa7e8c..5f169d5d76a8 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c @@ -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); diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 727158cb3b3c..2c44c0792301 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -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> -- 2.5.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [tip:x86/mm] x86/mm/pat: Make mm/pageattr[-test] .c explicitly non-modular 2015-08-24 23:34 ` [PATCH 2/3] arch/x86: make mm/pageattr[-test].c " Paul Gortmaker @ 2015-08-25 8:22 ` tip-bot for Paul Gortmaker 0 siblings, 0 replies; 7+ messages in thread From: tip-bot for Paul Gortmaker @ 2015-08-25 8:22 UTC (permalink / raw) To: linux-tip-commits Cc: peterz, paul.gortmaker, mingo, linux-kernel, hpa, torvalds, tglx Commit-ID: 8f45fe441a9836011672436ef007654969b28ccc Gitweb: http://git.kernel.org/tip/8f45fe441a9836011672436ef007654969b28ccc Author: Paul Gortmaker <paul.gortmaker@windriver.com> AuthorDate: Mon, 24 Aug 2015 19:34:54 -0400 Committer: Ingo Molnar <mingo@kernel.org> 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. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: H. Peter Anvin <hpa@zytor.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/1440459295-21814-3-git-send-email-paul.gortmaker@windriver.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/mm/pageattr-test.c | 4 ++-- arch/x86/mm/pageattr.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 8ff686a..5f169d5 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c @@ -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); diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 727158c..2c44c07 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -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> ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] arch/x86: make kernel/check.c explicitly non-modular 2015-08-24 23:34 [PATCH 0/3] x86: fix instances of non-modular code using modular fcns Paul Gortmaker 2015-08-24 23:34 ` [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular Paul Gortmaker 2015-08-24 23:34 ` [PATCH 2/3] arch/x86: make mm/pageattr[-test].c " Paul Gortmaker @ 2015-08-24 23:34 ` Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/mm] x86/mm: Make " tip-bot for Paul Gortmaker 2 siblings, 1 reply; 7+ messages in thread From: Paul Gortmaker @ 2015-08-24 23:34 UTC (permalink / raw) To: x86 Cc: linux-kernel, Paul Gortmaker, Thomas Gleixner, Ingo Molnar, H. Peter Anvin 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. 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/check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c index 58118e207a69..145863d4d343 100644 --- a/arch/x86/kernel/check.c +++ b/arch/x86/kernel/check.c @@ -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); -- 2.5.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [tip:x86/mm] x86/mm: Make kernel/check.c explicitly non-modular 2015-08-24 23:34 ` [PATCH 3/3] arch/x86: make kernel/check.c " Paul Gortmaker @ 2015-08-25 8:22 ` tip-bot for Paul Gortmaker 0 siblings, 0 replies; 7+ messages in thread From: tip-bot for Paul Gortmaker @ 2015-08-25 8:22 UTC (permalink / raw) To: linux-tip-commits Cc: paul.gortmaker, hpa, torvalds, mingo, peterz, tglx, linux-kernel Commit-ID: 13fe86f465b72fc9328d4f5ebc33223c011852ae Gitweb: http://git.kernel.org/tip/13fe86f465b72fc9328d4f5ebc33223c011852ae Author: Paul Gortmaker <paul.gortmaker@windriver.com> AuthorDate: Mon, 24 Aug 2015 19:34:55 -0400 Committer: Ingo Molnar <mingo@kernel.org> 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. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: H. Peter Anvin <hpa@zytor.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/1440459295-21814-4-git-send-email-paul.gortmaker@windriver.com Signed-off-by: Ingo Molnar <mingo@kernel.org> --- arch/x86/kernel/check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c index 83a7995..f40cfd1 100644 --- a/arch/x86/kernel/check.c +++ b/arch/x86/kernel/check.c @@ -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); ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-25 8:23 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-08-24 23:34 [PATCH 0/3] x86: fix instances of non-modular code using modular fcns Paul Gortmaker 2015-08-24 23:34 ` [PATCH 1/3] x86/platform: make atom/pmc_atom.c explicitly non-modular Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/platform] x86/platform: Make atom/ pmc_atom.c " tip-bot for Paul Gortmaker 2015-08-24 23:34 ` [PATCH 2/3] arch/x86: make mm/pageattr[-test].c " Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/mm] x86/mm/pat: Make mm/pageattr[-test] .c " tip-bot for Paul Gortmaker 2015-08-24 23:34 ` [PATCH 3/3] arch/x86: make kernel/check.c " Paul Gortmaker 2015-08-25 8:22 ` [tip:x86/mm] x86/mm: Make " tip-bot for Paul Gortmaker
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox