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 11static struct sample_hck_data data = { 12 .stat = 999, 13 .name = "sample tesst", 14}; 15 16void get_boot_config(int* info) 17{ 18 pr_info("hck sample: %s\n", __func__); 19 *info = 1; 20} 21 22void 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 31static 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 41static void __exit samplehck_exit(void) 42{ 43} 44 45module_init(samplehck_init); 46module_exit(samplehck_exit); 47MODULE_LICENSE("GPL v2"); 48MODULE_AUTHOR("zhujiaxin <zhujiaxin@huawei.com>"); 49