summaryrefslogtreecommitdiff
path: root/tests/projects/linux/driver/hello/src
diff options
context:
space:
mode:
authorririyeye <[email protected]>2024-10-22 17:44:23 +0800
committerririyeye <[email protected]>2024-10-22 17:44:23 +0800
commitfcf649a832c447b22f0ab73a721db1e3503ea2de (patch)
treef85454b0e1490f2b8716ce39a0f87b7879e37d11 /tests/projects/linux/driver/hello/src
parenta7aab9dc7e64bd2a211c4d7937a7ffd7d6993a4d (diff)
fix linux-driver build err
Diffstat (limited to 'tests/projects/linux/driver/hello/src')
-rw-r--r--tests/projects/linux/driver/hello/src/add.c1
-rw-r--r--tests/projects/linux/driver/hello/src/add.h2
-rw-r--r--tests/projects/linux/driver/hello/src/hello.c7
3 files changed, 6 insertions, 4 deletions
diff --git a/tests/projects/linux/driver/hello/src/add.c b/tests/projects/linux/driver/hello/src/add.c
index 59aab4983..72c39a6e4 100644
--- a/tests/projects/linux/driver/hello/src/add.c
+++ b/tests/projects/linux/driver/hello/src/add.c
@@ -1,3 +1,4 @@
+#include "add.h"
int add(int a, int b) {
return a + b;
}
diff --git a/tests/projects/linux/driver/hello/src/add.h b/tests/projects/linux/driver/hello/src/add.h
new file mode 100644
index 000000000..ba2df6926
--- /dev/null
+++ b/tests/projects/linux/driver/hello/src/add.h
@@ -0,0 +1,2 @@
+#pragma once
+int add(int a, int b);
diff --git a/tests/projects/linux/driver/hello/src/hello.c b/tests/projects/linux/driver/hello/src/hello.c
index 414a03bb2..c32e48f61 100644
--- a/tests/projects/linux/driver/hello/src/hello.c
+++ b/tests/projects/linux/driver/hello/src/hello.c
@@ -1,20 +1,19 @@
#include <linux/init.h>
#include <linux/module.h>
+#include "add.h"
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Ruki");
MODULE_DESCRIPTION("A simple Hello World Module");
MODULE_ALIAS("a simplest module");
-int add(int a, int b);
-
-int hello_init(void)
+static int hello_init(void)
{
printk(KERN_INFO "Hello World: %d\n", add(1, 2));
return 0;
}
-void hello_exit(void)
+static void hello_exit(void)
{
printk(KERN_INFO "Goodbye World\n");
}