2021-07-22 06:35:24 +08:00
|
|
|
/*
|
2021-08-08 01:24:59 +08:00
|
|
|
* hello-2.c - Demonstrating the module_init() and module_exit() macros.
|
|
|
|
* This is preferred over using init_module() and cleanup_module().
|
2021-07-22 06:35:24 +08:00
|
|
|
*/
|
2021-09-02 15:15:07 +08:00
|
|
|
#include <linux/init.h> /* Needed for the macros */
|
2021-08-17 03:02:55 +08:00
|
|
|
#include <linux/kernel.h> /* Needed for pr_info() */
|
2021-07-22 06:58:13 +08:00
|
|
|
#include <linux/module.h> /* Needed by all modules */
|
2021-07-22 06:35:24 +08:00
|
|
|
|
|
|
|
static int __init hello_2_init(void)
|
|
|
|
{
|
|
|
|
pr_info("Hello, world 2\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit hello_2_exit(void)
|
|
|
|
{
|
|
|
|
pr_info("Goodbye, world 2\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
module_init(hello_2_init);
|
|
|
|
module_exit(hello_2_exit);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|