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 the
  16         * same cacheline
  17         */
  18        struct hlist_node       entry;
  19        unsigned long           expires;
  20        void                    (*function)(unsigned long);
  21        unsigned long           data;
  22        u32                     flags;
  23
  24#ifdef CONFIG_LOCKDEP
  25        struct lockdep_map      lockdep_map;
  26#endif
  27};
使用流程:
    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 the
  14         * same cacheline
  15         */
  16        struct hlist_node       entry;
  17        unsigned long           expires;
  18        void                    (*function)(struct timer_list *);
  19        u32                     flags;
  20
  21#ifdef CONFIG_LOCKDEP
  22        struct lockdep_map      lockdep_map;
  23#endif
  24};

使用方法;

 DEFINE_TIMER(_name, _function)

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值