tick_init 函数
来源:互联网 发布:如何查看端口带宽 h3c 编辑:程序博客网 时间:2024/05/22 06:52
static struct notifier_block tick_notifier = {
.notifier_call = tick_notify,
};
//函数所在文件
// kernel\time\tick-common.c
/**
* tick_init - initialize the tick control*
* Register the notifier with the clockevents framework
*/
void __init tick_init(void)
{
clockevents_register_notifier(&tick_notifier);
}
/**
* clockevents_register_notifier - register a clock events change listener
*/
int clockevents_register_notifier(struct notifier_block *nb)
{
unsigned long flags;
int ret;
raw_spin_lock_irqsave(&clockevents_lock, flags);
ret = raw_notifier_chain_register(&clockevents_chain, nb);
raw_spin_unlock_irqrestore(&clockevents_lock, flags);
return ret;
}
/*
* Raw notifier chain routines. There is no protection;
* the caller must provide it. Use at your own risk!
*/
/**
* raw_notifier_chain_register - Add notifier to a raw notifier chain
* @nh: Pointer to head of the raw notifier chain
* @n: New entry in notifier chain
*
* Adds a notifier to a raw notifier chain.
* All locking must be provided by the caller.
*
* Currently always returns zero.
*/
int raw_notifier_chain_register(struct raw_notifier_head *nh,
struct notifier_block *n)
{
return notifier_chain_register(&nh->head, n);
}
/*
* Notifier chain core routines. The exported routines below
* are layered on top of these, with appropriate locking added.
*/
static int notifier_chain_register(struct notifier_block **nl,
struct notifier_block *n)
{
while ((*nl) != NULL) {
if (n->priority > (*nl)->priority)
break;
nl = &((*nl)->next);
}
n->next = *nl;
rcu_assign_pointer(*nl, n);
return 0;
}
可以看到,tick_init的作用就是调用 clockevents_register_notifier 函数向 clockevents_chain 通知链注册元素: tick_notifier。这个元素的回调函数指明了,时钟事件设备信息发生变化时(例如新加入一个时钟事件设备等等),应该执行的操作,该回调函数为 tick_notify。
- tick_init 函数
- tick_init 函数分析。。。
- tick_init();
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 函数
- 一个实际问题分析及解决之七:理解websphere的classloader
- 一个实际问题分析及解决之九:什么是应用服务器
- 留~言~版
- 关于家用宽带的几点不满与想法
- Android textAppearance的属性设置及TextView属性详解
- tick_init 函数
- 常用的正则表达式-匹配中英文、字母和数字
- javadoc生成出现错误“编码 GBK 的不可映射字符
- 内核读写只读内存方法总结[Delphi描述]
- 汉化sublime text的方法
- h5学习笔记:Table
- fastDFS 入门
- Javaweb的el操作
- Android Studio引入ButterKnife 8.0.1版本