From: Prarit Bhargava <[email protected]>

For years we've had a useful kernel kernel module, dummy-module, in the
tree.

Add dummy-module to the redhat directory.

Signed-off-by: Prarit Bhargava <[email protected]>
---
 redhat/debug/dummy-module/Makefile       | 15 +++++++++
 redhat/debug/dummy-module/dummy-module.c | 39 ++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100644 redhat/debug/dummy-module/Makefile
 create mode 100644 redhat/debug/dummy-module/dummy-module.c

diff --git a/redhat/debug/dummy-module/Makefile 
b/redhat/debug/dummy-module/Makefile
new file mode 100644
index 000000000000..4c2daaad0b51
--- /dev/null
+++ b/redhat/debug/dummy-module/Makefile
@@ -0,0 +1,15 @@
+ifneq ($(KERNELRELEASE),)
+
+obj-m  := dummy-module.o
+
+else
+
+KDIR   := /lib/modules/$(shell uname -r)/build
+PWD    := $(shell pwd)
+
+default:
+       $(MAKE) -C $(KDIR) M=$(PWD)
+endif
+
+clean:
+       rm -rf *o .*.cmd .tmp* *.mod.c
diff --git a/redhat/debug/dummy-module/dummy-module.c 
b/redhat/debug/dummy-module/dummy-module.c
new file mode 100644
index 000000000000..89748e636511
--- /dev/null
+++ b/redhat/debug/dummy-module/dummy-module.c
@@ -0,0 +1,39 @@
+/*
+ * Just an skeleton module.  Useful for debugging.
+ *
+ * Written by: Prarit Bhargava <[email protected]>
+ *
+ * Please don't clutter this file with a bunch of bells-and-whistles.  It
+ * is meant to be a simple module.
+ */
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+static int dummy_arg = 0;
+
+void dummy_greetings(void)
+{
+       printk("This module has loaded.\n");
+       if (dummy_arg)
+               printk("And dummy_arg is %d.\n", dummy_arg);
+}
+
+static int init_dummy(void)
+{
+       dummy_greetings();
+       return 0;
+}
+
+static void cleanup_dummy(void)
+{
+       printk("unloading module\n");
+}
+
+module_init(init_dummy);
+module_exit(cleanup_dummy);
+
+MODULE_LICENSE("GPL");
+
+module_param(dummy_arg, int, 0444);
+MODULE_PARM_DESC(dummy_arg, "An argument for this module");
-- 
2.26.2
_______________________________________________
kernel mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]

Reply via email to