mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-22 15:05:54 +08:00
50b8dfe6c2
Instead of using tab for indention, the style defaults to 4 spaces for the sake of compact layout.
30 lines
565 B
C
30 lines
565 B
C
#include <linux/init.h>
|
|
#include <linux/module.h>
|
|
#include <linux/workqueue.h>
|
|
|
|
static struct workqueue_struct *queue = NULL;
|
|
static struct work_struct work;
|
|
|
|
static void work_handler(struct work_struct *data)
|
|
{
|
|
pr_info("work handler function.\n");
|
|
}
|
|
|
|
int init_module()
|
|
{
|
|
queue = alloc_workqueue("HELLOWORLD", WQ_UNBOUND, 1);
|
|
INIT_WORK(&work, work_handler);
|
|
schedule_work(&work);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void cleanup_module()
|
|
{
|
|
destroy_workqueue(queue);
|
|
}
|
|
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_AUTHOR("Bob Mottram");
|
|
MODULE_DESCRIPTION("Workqueue example");
|