[PATCH] ocfs2: audit and remove any unnecessary uses of module.h

From: Paul Gortmaker
Date: Mon Sep 19 2016 - 16:32:26 EST


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 code 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 might have been the implicit 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.

We also keep an eye out for module_param usage that doesn't have the
corresponding moduleparam.h and fix accordingly.

Cc: Mark Fasheh <mfasheh@xxxxxxxx>
Cc: Joel Becker <jlbec@xxxxxxxxxxxx>
Cc: ocfs2-devel@xxxxxxxxxxxxxx
Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
---

[I've been building this on linux-next on a regular basis for
allmodconfig for x86(32/64) ARM(32/64) ppc and mips so there
shouldn't be any unseen fallout.]


fs/ocfs2/acl.c | 1 -
fs/ocfs2/blockcheck.c | 1 -
fs/ocfs2/cluster/heartbeat.c | 2 +-
fs/ocfs2/cluster/masklog.c | 2 +-
fs/ocfs2/cluster/netdebug.c | 1 -
fs/ocfs2/cluster/sys.c | 1 -
fs/ocfs2/dlm/dlmast.c | 1 -
fs/ocfs2/dlm/dlmconvert.c | 1 -
fs/ocfs2/dlm/dlmlock.c | 2 +-
fs/ocfs2/dlm/dlmmaster.c | 1 -
fs/ocfs2/dlm/dlmrecovery.c | 1 -
fs/ocfs2/dlm/dlmthread.c | 1 -
fs/ocfs2/dlm/dlmunlock.c | 2 +-
fs/ocfs2/dlmfs/dlmfs.c | 1 +
fs/ocfs2/dlmfs/userdlm.c | 1 -
fs/ocfs2/dlmfs/userdlm.h | 1 -
fs/ocfs2/filecheck.c | 1 -
fs/ocfs2/quota_local.c | 1 -
fs/ocfs2/xattr.c | 1 -
19 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
index 2162434728c0..3ada776e0bb1 100644
--- a/fs/ocfs2/acl.c
+++ b/fs/ocfs2/acl.c
@@ -20,7 +20,6 @@
*/

#include <linux/init.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>

diff --git a/fs/ocfs2/blockcheck.c b/fs/ocfs2/blockcheck.c
index 0725e6054650..518a6d91cab5 100644
--- a/fs/ocfs2/blockcheck.c
+++ b/fs/ocfs2/blockcheck.c
@@ -23,7 +23,6 @@
#include <linux/buffer_head.h>
#include <linux/bitops.h>
#include <linux/debugfs.h>
-#include <linux/module.h>
#include <linux/fs.h>
#include <asm/byteorder.h>

diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index 636abcbd4650..af3261b47be9 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -22,7 +22,7 @@
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/jiffies.h>
-#include <linux/module.h>
+#include <linux/export.h>
#include <linux/fs.h>
#include <linux/bio.h>
#include <linux/blkdev.h>
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index dfe162f5fd4c..8c42ff64502b 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -19,7 +19,7 @@
* Boston, MA 021110-1307, USA.
*/

-#include <linux/module.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
diff --git a/fs/ocfs2/cluster/netdebug.c b/fs/ocfs2/cluster/netdebug.c
index 27d1242c8383..ee934c2376af 100644
--- a/fs/ocfs2/cluster/netdebug.c
+++ b/fs/ocfs2/cluster/netdebug.c
@@ -26,7 +26,6 @@

#ifdef CONFIG_DEBUG_FS

-#include <linux/module.h>
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/idr.h>
diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c
index b7f57271d49c..2c11ada245c0 100644
--- a/fs/ocfs2/cluster/sys.c
+++ b/fs/ocfs2/cluster/sys.c
@@ -25,7 +25,6 @@
*/

#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/fs.h>
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
index fd6bbbbd7d78..22ef17ddcd7b 100644
--- a/fs/ocfs2/dlm/dlmast.c
+++ b/fs/ocfs2/dlm/dlmast.c
@@ -25,7 +25,6 @@
*/


-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/highmem.h>
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c
index cdeafb4e7ed6..270360529610 100644
--- a/fs/ocfs2/dlm/dlmconvert.c
+++ b/fs/ocfs2/dlm/dlmconvert.c
@@ -25,7 +25,6 @@
*/


-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/highmem.h>
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c
index 66c2a491f68d..6353e7f54650 100644
--- a/fs/ocfs2/dlm/dlmlock.c
+++ b/fs/ocfs2/dlm/dlmlock.c
@@ -25,7 +25,7 @@
*/


-#include <linux/module.h>
+#include <linux/export.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 6ea06f8a7d29..e00fa41e6f9d 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -25,7 +25,6 @@
*/


-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index dd5cb8bcefd1..d2e5a4b0a907 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -25,7 +25,6 @@
*/


-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/slab.h>
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 838a06d4066a..7cc0b584249f 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -25,7 +25,6 @@
*/


-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/highmem.h>
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c
index 1082b2c3014b..fad6a5180a81 100644
--- a/fs/ocfs2/dlm/dlmunlock.c
+++ b/fs/ocfs2/dlm/dlmunlock.c
@@ -25,7 +25,7 @@
*/


-#include <linux/module.h>
+#include <linux/export.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/highmem.h>
diff --git a/fs/ocfs2/dlmfs/dlmfs.c b/fs/ocfs2/dlmfs/dlmfs.c
index ef474cdd6404..490ccc074948 100644
--- a/fs/ocfs2/dlmfs/dlmfs.c
+++ b/fs/ocfs2/dlmfs/dlmfs.c
@@ -35,6 +35,7 @@
*/

#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/fs.h>
#include <linux/pagemap.h>
#include <linux/types.h>
diff --git a/fs/ocfs2/dlmfs/userdlm.c b/fs/ocfs2/dlmfs/userdlm.c
index f70cda2f090d..668e89782be0 100644
--- a/fs/ocfs2/dlmfs/userdlm.c
+++ b/fs/ocfs2/dlmfs/userdlm.c
@@ -29,7 +29,6 @@

#include <linux/signal.h>

-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/crc32.h>
diff --git a/fs/ocfs2/dlmfs/userdlm.h b/fs/ocfs2/dlmfs/userdlm.h
index ede94a6e7fd3..3fbb50224fc3 100644
--- a/fs/ocfs2/dlmfs/userdlm.h
+++ b/fs/ocfs2/dlmfs/userdlm.h
@@ -27,7 +27,6 @@
#ifndef USERDLM_H
#define USERDLM_H

-#include <linux/module.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/workqueue.h>
diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index 2cabbcf2f28e..7211a7474d7d 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -19,7 +19,6 @@

#include <linux/list.h>
#include <linux/spinlock.h>
-#include <linux/module.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/fs.h>
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 8a54fd8a4fa5..a88c85553f02 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -6,7 +6,6 @@
#include <linux/slab.h>
#include <linux/quota.h>
#include <linux/quotaops.h>
-#include <linux/module.h>

#include <cluster/masklog.h>

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 5bb44f7a78ee..100fd2030288 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -33,7 +33,6 @@
#include <linux/falloc.h>
#include <linux/sort.h>
#include <linux/init.h>
-#include <linux/module.h>
#include <linux/string.h>
#include <linux/security.h>

--
2.8.4