mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-12-24 04:55:14 +08:00
d85944d107
The latter might have been used along with printk() in an earlier version, but pr_info() is getting used consistently so adjust the #include comments accordingly. For the avoidance of doubt, pr_info() actually comes from printk.h, which gets #include'd by kernel.h.
24 lines
555 B
C
24 lines
555 B
C
/*
|
|
* hello-2.c - Demonstrating the module_init() and module_exit() macros.
|
|
* This is preferred over using init_module() and cleanup_module().
|
|
*/
|
|
#include <linux/init.h> /* Needed for the macros */
|
|
#include <linux/kernel.h> /* Needed for pr_info() */
|
|
#include <linux/module.h> /* Needed by all modules */
|
|
|
|
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");
|