mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-22 15:05:54 +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.
25 lines
538 B
C
25 lines
538 B
C
/*
|
|
* hello-3.c - Illustrating the __init, __initdata and __exit macros.
|
|
*/
|
|
#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 hello3_data __initdata = 3;
|
|
|
|
static int __init hello_3_init(void)
|
|
{
|
|
pr_info("Hello, world %d\n", hello3_data);
|
|
return 0;
|
|
}
|
|
|
|
static void __exit hello_3_exit(void)
|
|
{
|
|
pr_info("Goodbye, world 3\n");
|
|
}
|
|
|
|
module_init(hello_3_init);
|
|
module_exit(hello_3_exit);
|
|
|
|
MODULE_LICENSE("GPL");
|