public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Vivek Yadav <vivekyadav1207731111@gmail.com>
To: skhan@linuxfoundation.org
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	Vivek <vivekyadav1207731111@gmail.com>
Subject: [PATCH 2/2] Test: Driver: Hello World module
Date: Sat, 20 Jan 2024 23:20:14 +0530	[thread overview]
Message-ID: <20240120175014.4270-1-vivekyadav1207731111@gmail.com> (raw)

From: Vivek <vivekyadav1207731111@gmail.com>

- Hello World module added with Kconfig and Makefile
Also check with `make menuconfig`.

Signed-off-by: Vivek <vivekyadav1207731111@gmail.com>
---
 drivers/HelloWorld/HelloWorld-1.c | 27 +++++++++++++++++++++++++++
 drivers/HelloWorld/Kconfig        |  9 +++++++++
 drivers/HelloWorld/Makefile       |  1 +
 drivers/Kconfig                   |  2 ++
 drivers/Makefile                  |  2 ++
 5 files changed, 41 insertions(+)
 create mode 100644 drivers/HelloWorld/HelloWorld-1.c
 create mode 100644 drivers/HelloWorld/Kconfig
 create mode 100644 drivers/HelloWorld/Makefile

diff --git a/drivers/HelloWorld/HelloWorld-1.c b/drivers/HelloWorld/HelloWorld-1.c
new file mode 100644
index 000000000000..3dd1c32c9ec6
--- /dev/null
+++ b/drivers/HelloWorld/HelloWorld-1.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/* This is test file for Linux kernel module
+ * Here I have written a simple Hello World module
+ *
+ * author : Vivek Yadav
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+static int __init hello_init_module(void)
+{
+	pr_info("Hello World 1.\n");
+	return 0;
+}
+
+static void __exit hello_cleanup_module(void)
+{
+	pr_info("Goodbye World 1.\n");
+}
+
+module_init(hello_init_module);
+module_exit(hello_cleanup_module);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Vivek Yadav");
+MODULE_DESCRIPTION("Simple Hello World Kernel Module");
diff --git a/drivers/HelloWorld/Kconfig b/drivers/HelloWorld/Kconfig
new file mode 100644
index 000000000000..27606645f577
--- /dev/null
+++ b/drivers/HelloWorld/Kconfig
@@ -0,0 +1,9 @@
+menu "Hello Module Kernel Support"
+​
+config HELLO_WORLD
+        tristate "Hello Module Driver"
+        depends on X86
+        help
+		Select this option to run a Hello World Module!
+		It is just simple driver for testing.
+endmenu
diff --git a/drivers/HelloWorld/Makefile b/drivers/HelloWorld/Makefile
new file mode 100644
index 000000000000..03c1da296446
--- /dev/null
+++ b/drivers/HelloWorld/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_HELLO_WORLD)	+= HelloWorld-1.o
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 7bdad836fc62..509ecadffa26 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -245,4 +245,6 @@ source "drivers/cdx/Kconfig"
 
 source "drivers/dpll/Kconfig"
 
+source "drivers/HelloWorld/Kconfig"
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index 37fd6ce3bd7f..13f26fa34fc7 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -198,3 +198,5 @@ obj-$(CONFIG_CDX_BUS)		+= cdx/
 obj-$(CONFIG_DPLL)		+= dpll/
 
 obj-$(CONFIG_S390)		+= s390/
+
+obj-$(CONFIG_HELLO_WORLD)	+= HelloWorld/
-- 
2.34.1


                 reply	other threads:[~2024-01-20 17:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240120175014.4270-1-vivekyadav1207731111@gmail.com \
    --to=vivekyadav1207731111@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox