1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Sample HCK
4 *
5 */
6 #include <linux/module.h>
7 #include <linux/init.h>
8 #include <linux/slab.h>
9 #include <linux/hck/lite_hck_sample.h>
10
11 static struct sample_hck_data data = {
12 .stat = 999,
13 .name = "sample tesst",
14 };
15
get_boot_config(int * info)16 void get_boot_config(int* info)
17 {
18 pr_info("hck sample: %s\n", __func__);
19 *info = 1;
20 }
21
set_boot_stat(void * data,int info)22 void set_boot_stat(void* data, int info)
23 {
24 pr_info("hck sample: %s\n", __func__);
25 info = 2;
26 struct sample_hck_data *hdata = data;
27
28 pr_info("hck data: stat = %d, name = %s\n", hdata->stat, hdata->name);
29 }
30
samplehck_init(void)31 static int __init samplehck_init(void)
32 {
33 pr_info("hck sample register\n");
34
35 REGISTER_HCK_LITE_HOOK(get_boot_config_lhck, get_boot_config);
36 REGISTER_HCK_LITE_DATA_HOOK(set_boot_stat_lhck, set_boot_stat, &data);
37
38 return 0;
39 }
40
samplehck_exit(void)41 static void __exit samplehck_exit(void)
42 {
43 }
44
45 module_init(samplehck_init);
46 module_exit(samplehck_exit);
47 MODULE_LICENSE("GPL v2");
48 MODULE_AUTHOR("zhujiaxin <zhujiaxin@huawei.com>");
49