唯客微博客

专注于计算机,嵌入式领域的技术

0%

Linux驱动开发杂记(0x16) - 内核定时器接口各版本的变化

2.6.13 - 2.6.14

添加

1
#define DEFINE_TIMER(_name, _function, _expires, _data)
## 2.6.14 - 2.6.15 添加
1
2
3
4
static inline void setup_timer(struct timer_list * timer,
void (*function)(unsigned long),
unsigned long data)

## 3.6 - 3.7
1
2
3
4
5
6
7
void init_timer_key(struct timer_list *timer,
const char *name,
struct lock_class_key *key);
// 改为
void init_timer_key(struct timer_list *timer, unsigned int flags,
const char *name, struct lock_class_key *key);

删除setup_timer_key

4.1 - 4.2

修改

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct timer_list {
......
struct tvec_base *base;

void (*function)(unsigned long);
unsigned long data;

int slack;
......
};
//改为
struct timer_list {
......
void (*function)(unsigned long);
unsigned long data;
u32 flags;
int slack;
......
};
## 4.7 - 4.8 1. 删除struct timer_list {}中的
1
int			slack;
2. 添加TIMER_PINNED_INITIALIZER 3. 添加init_timer_pinned ## 4.13 - 4.14 添加
1
2
3
static inline void timer_setup(struct timer_list *timer,
void (*callback)(struct timer_list *),
unsigned int flags)
1
from_timer(var, callback_timer, timer_fieldname)
## 4.14 - 4.15 修改
1
2
3
4
5
6
7
8
9
10
11
12
13
14
struct timer_list {
......
void (*function)(unsigned long);
unsigned long data;
u32 flags;
......
};
//改为
struct timer_list {
......
void (*function)(struct timer_list *);
u32 flags;
......
};
1
2
3
#define DEFINE_TIMER(_name, _function, _expires, _data)
//改为
#define DEFINE_TIMER(_name, _function)
1. 去除setup_timer函数,改为timer_setup(timer, callback, flags) 2. 去除init_timer函数
1
2
3
4
5
6
void init_timer_key(struct timer_list *timer, unsigned int flags,
const char *name, struct lock_class_key *key);
// 改为
void init_timer_key(struct timer_list *timer,
void (*func)(struct timer_list *), unsigned int flags,
const char *name, struct lock_class_key *key);

-------------本文结束感谢您的阅读-------------

本文标题:Linux驱动开发杂记(0x16) - 内核定时器接口各版本的变化

文章作者:Vinx

发布时间:2019年02月18日 - 15:39

最后更新:2023年09月18日 - 11:11

原始链接:https://blog.vinkvin.com/post/22/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。