[PATCH 1/3] block: make genhd.c slightly more explicitly non-modular

From: Paul Gortmaker
Date: Sun Dec 13 2015 - 15:05:36 EST


The Makefile currently controlling compilation of this code is:

obj-$(CONFIG_BLOCK) := bio.o elevator.o blk-core.o blk-tag.o blk-sysfs.o \
[...]
genhd.o scsi_ioctl.o partition-generic.o ioprio.o \

...and the Kconfig is:

menuconfig BLOCK
bool "Enable the block layer" if EXPERT
default y

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

While the code uses moduleparam and other modular infrastructure that
prevents removal of module.h itself, we can at least ensure the way
it is loaded sends a clear message that it is built-in or absent.

Since module_init translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit. We
do that because the file already has subsys_initcall() usage within,
and I don't want to risk breaking ordering within the file itself.

Cc: Jens Axboe <axboe@xxxxxxxxx>
Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
---
block/genhd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index cd78712bab8e..333cd557c3a4 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1214,7 +1214,7 @@ static int __init proc_genhd_init(void)
proc_create("partitions", 0, NULL, &proc_partitions_operations);
return 0;
}
-module_init(proc_genhd_init);
+device_initcall(proc_genhd_init);
#endif /* CONFIG_PROC_FS */

dev_t blk_lookup_devt(const char *name, int partno)
--
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/