本文主要是介绍4.15 版本内核调用 init_timer()函数出错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
linux/include/linux/timer.h 4.15 之前版本struct timer_list {14 /*15 * All fields that change during normal runtime grouped to the16 * same cacheline17 */18 struct hlist_node entry;19 unsigned long expires;20 void (*function)(unsigned long);21 unsigned long data;22 u32 flags;2324#ifdef CONFIG_LOCKDEP25 struct lockdep_map lockdep_map;26#endif27};
使用流程:struct timer_list timer_fs; timer_fs.expires = 500; //定时器定时50秒 timer_fs.data = (unsigned long)100; //不再提供data 成员变量timer_fs.function = function;//参数类型变化init_timer(&timer_fs); //不再提供 该初始化函数 4.15 之后版本 struct timer_list {12 /*13 * All fields that change during normal runtime grouped to the14 * same cacheline15 */16 struct hlist_node entry;17 unsigned long expires;18 void (*function)(struct timer_list *);19 u32 flags;2021#ifdef CONFIG_LOCKDEP22 struct lockdep_map lockdep_map;23#endif24};
使用方法;
DEFINE_TIMER(_name, _function)
这篇关于4.15 版本内核调用 init_timer()函数出错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!