[Lkw] [PATCH] Add some code to the kernel module, just print some info msg

Matias Abel Olmedo mati.olmedo95 at gmail.com
Thu Sep 14 17:37:54 EDT 2023


---
 drivers/block/nvme-cmb.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/block/nvme-cmb.c b/drivers/block/nvme-cmb.c
index 617d2db9c..ff251a70e 100644
--- a/drivers/block/nvme-cmb.c
+++ b/drivers/block/nvme-cmb.c
@@ -1,3 +1,20 @@
 #include <linux/module.h>
 
 MODULE_LICENSE("GPL");
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+
+static int __init nvme_cmb_init(void)
+{
+	pr_info("loading nvme-cmb module\n");
+	return 0;
+}
+
+static void __exit nvme_cmb_exit(void)
+{
+	pr_info("unloading nvme-cmb module\n");
+}
+
+module_init(nvme_cmb_init);
+module_exit(nvme_cmb_exit);
-- 
2.39.2




More information about the LKW mailing list