Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1512188 > unrolled thread
| Started by | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| First post | 2016-10-30 21:40 +0100 |
| Last post | 2016-10-31 10:30 +0100 |
| Articles | 7 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 0/9] s390: remove modular usage from non-modular code Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:40 +0100
[PATCH 7/9] s390: hypfs: make inode explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:50 +0100
[PATCH 6/9] s390: hotplug: make pci_hpc explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:50 +0100
[PATCH 3/9] s390: char: make con3215 explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:50 +0100
[PATCH 5/9] s390: char: make slcp_quiesce explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:50 +0100
[PATCH 2/9] s390: char: make zcore explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-10-30 21:50 +0100
Re: [PATCH 0/9] s390: remove modular usage from non-modular code Heiko Carstens <heiko.carstens@de.ibm.com> - 2016-10-31 10:30 +0100
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:40 +0100 |
| Subject | [PATCH 0/9] s390: remove modular usage from non-modular code |
| Message-ID | <sy53A-13b-7@gated-at.bofh.it> |
My ongoing audit looking for non-modular code that needlessly uses
modular macros (vs. built-in equivalents) and/or has dead code
relating to module unloading that can never be executed led to the
creation of these s390 related commits.
For anyone new to the underlying goal of this cleanup, we are trying to
not use module support for code that can never be built as a module since:
(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be
modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn
includes nearly everything else, thus adding to CPP overhead.
(4) it gets copied/replicated into other code and spreads like weeds.
Build tested on current linux-next (allyes/allno/allmod) to ensure no
silly typos or implicit include issues that would break compilation
crept in.
---
Cc: Arnd Bergmann <arndb@de.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Paul Gortmaker (9):
s390: cio: make it explicitly non-modular
s390: char: make zcore explicitly non-modular
s390: char: make con3215 explicitly non-modular
s390: char: make sclp_tty explicitly non-modular
s390: char: make slcp_quiesce explicitly non-modular
s390: hotplug: make pci_hpc explicitly non-modular
s390: hypfs: make inode explicitly non-modular
s390: kernel: make lgr explicitly non-modular
s390: virtio: make ccw explicitly non-modular
arch/s390/hypfs/inode.c | 24 ++++--------------------
arch/s390/kernel/lgr.c | 5 +++--
drivers/pci/hotplug/s390_pci_hpc.c | 7 ++-----
drivers/s390/char/con3215.c | 12 +-----------
drivers/s390/char/sclp_quiesce.c | 4 +---
drivers/s390/char/sclp_tty.c | 3 +--
drivers/s390/char/zcore.c | 20 +-------------------
drivers/s390/cio/cmf.c | 10 ++--------
drivers/s390/cio/css.c | 6 +++---
drivers/s390/cio/device.c | 6 +++---
drivers/s390/cio/device_ops.c | 5 +++--
drivers/s390/virtio/virtio_ccw.c | 25 ++-----------------------
12 files changed, 26 insertions(+), 101 deletions(-)
--
2.10.1
[toc] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:50 +0100 |
| Subject | [PATCH 7/9] s390: hypfs: make inode explicitly non-modular |
| Message-ID | <sy5dg-16O-5@gated-at.bofh.it> |
| In reply to | #1512188 |
The Kconfig currently controlling compilation of this code is:
arch/s390/Kconfig:config S390_HYPFS_FS
arch/s390/Kconfig: def_bool y
...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.
Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.
Also note that MODULE_ALIAS is a no-op for non-modular code.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
Build testing indicated the presence of module.h was masking an
implicit include of kobject.h, hence the addition of that.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
arch/s390/hypfs/inode.c | 24 ++++--------------------
1 file changed, 4 insertions(+), 20 deletions(-)
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 09bccb224d03..cf8a2d92467f 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -3,6 +3,7 @@
*
* Copyright IBM Corp. 2006, 2008
* Author(s): Michael Holzheu <holzheu@de.ibm.com>
+ * License: GPL
*/
#define KMSG_COMPONENT "hypfs"
@@ -18,7 +19,8 @@
#include <linux/time.h>
#include <linux/parser.h>
#include <linux/sysfs.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kobject.h>
#include <linux/seq_file.h>
#include <linux/mount.h>
#include <linux/uio.h>
@@ -443,7 +445,6 @@ static struct file_system_type hypfs_type = {
.mount = hypfs_mount,
.kill_sb = hypfs_kill_super
};
-MODULE_ALIAS_FS("s390_hypfs");
static const struct super_operations hypfs_s_ops = {
.statfs = simple_statfs,
@@ -497,21 +498,4 @@ static int __init hypfs_init(void)
pr_err("Initialization of hypfs failed with rc=%i\n", rc);
return rc;
}
-
-static void __exit hypfs_exit(void)
-{
- unregister_filesystem(&hypfs_type);
- sysfs_remove_mount_point(hypervisor_kobj, "s390");
- hypfs_diag0c_exit();
- hypfs_sprp_exit();
- hypfs_vm_exit();
- hypfs_diag_exit();
- hypfs_dbfs_exit();
-}
-
-module_init(hypfs_init)
-module_exit(hypfs_exit)
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Michael Holzheu <holzheu@de.ibm.com>");
-MODULE_DESCRIPTION("s390 Hypervisor Filesystem");
+device_initcall(hypfs_init)
--
2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:50 +0100 |
| Subject | [PATCH 6/9] s390: hotplug: make pci_hpc explicitly non-modular |
| Message-ID | <sy5dg-16O-31@gated-at.bofh.it> |
| In reply to | #1512188 |
The Kconfig currently controlling compilation of this code is:
drivers/pci/hotplug/Kconfig:config HOTPLUG_PCI_S390
drivers/pci/hotplug/Kconfig: bool "System z PCI Hotplug Support"
...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 also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
We don't exchange module.h for init.h or export.h since the file
does not contain any initcalls or EXPORT of symbols.
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/pci/hotplug/s390_pci_hpc.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/hotplug/s390_pci_hpc.c b/drivers/pci/hotplug/s390_pci_hpc.c
index 50b8b7d54416..530d0e49f2ed 100644
--- a/drivers/pci/hotplug/s390_pci_hpc.c
+++ b/drivers/pci/hotplug/s390_pci_hpc.c
@@ -5,12 +5,13 @@
*
* Author(s):
* Jan Glauber <jang@linux.vnet.ibm.com>
+ *
+ * License: GPL
*/
#define KMSG_COMPONENT "zpci"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
-#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/pci.h>
@@ -21,10 +22,6 @@
#define SLOT_NAME_SIZE 10
static LIST_HEAD(s390_hotplug_slot_list);
-MODULE_AUTHOR("Jan Glauber <jang@linux.vnet.ibm.com");
-MODULE_DESCRIPTION("Hot Plug PCI Controller for System z");
-MODULE_LICENSE("GPL");
-
static int zpci_fn_configured(enum zpci_state state)
{
return state == ZPCI_FN_STATE_CONFIGURED ||
--
2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:50 +0100 |
| Subject | [PATCH 3/9] s390: char: make con3215 explicitly non-modular |
| Message-ID | <sy5dg-16O-13@gated-at.bofh.it> |
| In reply to | #1512188 |
The Kconfig currently controlling compilation of this code is:
drivers/s390/char/Kconfig:config TN3215
drivers/s390/char/Kconfig: def_bool y
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, 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 don't replace module.h with init.h since the file already has that.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/s390/char/con3215.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
index 931d10e86837..1b8d825623bd 100644
--- a/drivers/s390/char/con3215.c
+++ b/drivers/s390/char/con3215.c
@@ -9,7 +9,6 @@
* Dan Morrison, IBM Corporation <dmorriso@cse.buffalo.edu>
*/
-#include <linux/module.h>
#include <linux/types.h>
#include <linux/kdev_t.h>
#include <linux/tty.h>
@@ -1215,13 +1214,4 @@ static int __init tty3215_init(void)
tty3215_driver = driver;
return 0;
}
-
-static void __exit tty3215_exit(void)
-{
- tty_unregister_driver(tty3215_driver);
- put_tty_driver(tty3215_driver);
- ccw_driver_unregister(&raw3215_ccw_driver);
-}
-
-module_init(tty3215_init);
-module_exit(tty3215_exit);
+device_initcall(tty3215_init);
--
2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:50 +0100 |
| Subject | [PATCH 5/9] s390: char: make slcp_quiesce explicitly non-modular |
| Message-ID | <sy5dh-16O-51@gated-at.bofh.it> |
| In reply to | #1512188 |
The Makefile currently controlling compilation of this code is obj-y,
meaning that it currently is not being built as a module by anyone.
Lets remove the couple traces of modular infrastructure, 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.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/s390/char/sclp_quiesce.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c
index 475e470d9768..e4958511168a 100644
--- a/drivers/s390/char/sclp_quiesce.c
+++ b/drivers/s390/char/sclp_quiesce.c
@@ -6,7 +6,6 @@
* Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
*/
-#include <linux/module.h>
#include <linux/types.h>
#include <linux/cpumask.h>
#include <linux/smp.h>
@@ -80,5 +79,4 @@ static int __init sclp_quiesce_init(void)
{
return sclp_register(&sclp_quiesce_event);
}
-
-module_init(sclp_quiesce_init);
+device_initcall(sclp_quiesce_init);
--
2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-10-30 21:50 +0100 |
| Subject | [PATCH 2/9] s390: char: make zcore explicitly non-modular |
| Message-ID | <sy5dh-16O-55@gated-at.bofh.it> |
| In reply to | #1512188 |
The Kconfig currently controlling compilation of this code is:
arch/s390/Kconfig:config CRASH_DUMP
arch/s390/Kconfig: bool "kernel crash dumps"
...meaning that it currently is not being built as a module by anyone.
Lets remove the modular code that is essentially orphaned, so that
when reading the driver there is no doubt it is builtin-only.
Since module_init wasn't even being used by this file, the init
ordering remains unchanged with this commit.
We also delete the MODULE_LICENSE tag etc. since all that information
was (or is now) contained at the top of the file in the comments.
We don't replace module.h with init.h since the file already has that.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/s390/char/zcore.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index 16992e2a40ad..5aea89a92ff4 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -7,6 +7,7 @@
*
* Copyright IBM Corp. 2003, 2008
* Author(s): Michael Holzheu
+ * License: GPL
*/
#define KMSG_COMPONENT "zdump"
@@ -16,7 +17,6 @@
#include <linux/slab.h>
#include <linux/miscdevice.h>
#include <linux/debugfs.h>
-#include <linux/module.h>
#include <linux/memblock.h>
#include <asm/asm-offsets.h>
@@ -364,22 +364,4 @@ static int __init zcore_init(void)
diag308(DIAG308_REL_HSA, NULL);
return rc;
}
-
-static void __exit zcore_exit(void)
-{
- debug_unregister(zcore_dbf);
- sclp_sdias_exit();
- free_page((unsigned long) ipl_block);
- debugfs_remove(zcore_hsa_file);
- debugfs_remove(zcore_reipl_file);
- debugfs_remove(zcore_memmap_file);
- debugfs_remove(zcore_dir);
- diag308(DIAG308_REL_HSA, NULL);
-}
-
-MODULE_AUTHOR("Copyright IBM Corp. 2003,2008");
-MODULE_DESCRIPTION("zcore module for zfcpdump support");
-MODULE_LICENSE("GPL");
-
subsys_initcall(zcore_init);
-module_exit(zcore_exit);
--
2.10.1
[toc] | [prev] | [next] | [standalone]
| From | Heiko Carstens <heiko.carstens@de.ibm.com> |
|---|---|
| Date | 2016-10-31 10:30 +0100 |
| Message-ID | <syh4K-ri-19@gated-at.bofh.it> |
| In reply to | #1512188 |
On Sun, Oct 30, 2016 at 04:37:23PM -0400, Paul Gortmaker wrote: > My ongoing audit looking for non-modular code that needlessly uses > modular macros (vs. built-in equivalents) and/or has dead code > relating to module unloading that can never be executed led to the > creation of these s390 related commits. > > For anyone new to the underlying goal of this cleanup, we are trying to > not use module support for code that can never be built as a module since: > > (1) it is easy to accidentally write unused module_exit and remove code > (2) it can be misleading when reading the source, thinking it can be > modular when the Makefile and/or Kconfig prohibit it > (3) it requires the include of the module.h header file which in turn > includes nearly everything else, thus adding to CPP overhead. > (4) it gets copied/replicated into other code and spreads like weeds. > > Build tested on current linux-next (allyes/allno/allmod) to ensure no > silly typos or implicit include issues that would break compilation > crept in. > > Paul Gortmaker (9): > s390: cio: make it explicitly non-modular > s390: char: make zcore explicitly non-modular > s390: char: make con3215 explicitly non-modular > s390: char: make sclp_tty explicitly non-modular > s390: char: make slcp_quiesce explicitly non-modular > s390: hotplug: make pci_hpc explicitly non-modular > s390: hypfs: make inode explicitly non-modular > s390: kernel: make lgr explicitly non-modular > s390: virtio: make ccw explicitly non-modular Whole series applied. Thanks!
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web