-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathmain.c
More file actions
29 lines (24 loc) · 716 Bytes
/
main.c
File metadata and controls
29 lines (24 loc) · 716 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "device_file.h"
#include <linux/init.h> /* module_init, module_exit */
#include <linux/module.h> /* version info, MODULE_LICENSE, MODULE_AUTHOR */
MODULE_DESCRIPTION("Simple Linux driver");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Apriorit, Inc");
static int simple_driver_init(void)
{
int result = 0;
pr_notice("Simple-driver: Initialization started\n");
result = register_device();
if (result)
{
pr_notice("Simple-driver: Failed to register character device\n");
}
return result;
}
static void simple_driver_exit(void)
{
pr_notice("Simple-driver: Exiting\n");
unregister_device();
}
module_init(simple_driver_init);
module_exit(simple_driver_exit);