PM: sleep: core: Switch back to async_schedule_dev()
[linux/fpc-iii.git] / lib / livepatch / test_klp_callbacks_busy.c
blob40beddf8a0e2478cf0bac93f12bd20faceb1539e
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2018 Joe Lawrence <joe.lawrence@redhat.com>
4 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6 #include <linux/module.h>
7 #include <linux/kernel.h>
8 #include <linux/workqueue.h>
9 #include <linux/delay.h>
11 static int sleep_secs;
12 module_param(sleep_secs, int, 0644);
13 MODULE_PARM_DESC(sleep_secs, "sleep_secs (default=0)");
15 static void busymod_work_func(struct work_struct *work);
16 static DECLARE_DELAYED_WORK(work, busymod_work_func);
18 static void busymod_work_func(struct work_struct *work)
20 pr_info("%s, sleeping %d seconds ...\n", __func__, sleep_secs);
21 msleep(sleep_secs * 1000);
22 pr_info("%s exit\n", __func__);
25 static int test_klp_callbacks_busy_init(void)
27 pr_info("%s\n", __func__);
28 schedule_delayed_work(&work,
29 msecs_to_jiffies(1000 * 0));
30 return 0;
33 static void test_klp_callbacks_busy_exit(void)
35 cancel_delayed_work_sync(&work);
36 pr_info("%s\n", __func__);
39 module_init(test_klp_callbacks_busy_init);
40 module_exit(test_klp_callbacks_busy_exit);
41 MODULE_LICENSE("GPL");
42 MODULE_AUTHOR("Joe Lawrence <joe.lawrence@redhat.com>");
43 MODULE_DESCRIPTION("Livepatch test: busy target module");