主题 : 有关arch_initcall宏修饰的问题 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 5613
精华: 0
发帖: 20
金钱: 100 两
威望: 20 点
综合积分: 40 分
注册时间: 2009-04-30
最后登录: 2017-09-13
楼主  发表于: 2010-09-08 12:34

 有关arch_initcall宏修饰的问题

多个被arch_initcall修饰的函数有没有一定顺序?还是按照link的先后来随机排列的?
我在2.6.35.4原始的mini2440 kernel里发现一个问题:
arch_initcall(customize_machine);
arch_initcall(s3c_arch_init);
如果第一个先调用,就会发生chip->config->set_pull这个函数指针没有初始化赋值,是个0指针。
而chip->config->set_pull初始化在s3c_arch_init函数里调用s3c2440_init来初始化的,
复制代码
  1.     s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_1up;
  2.     s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_1up;
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-09-08 13:24
多个被arch_initcall修饰的函数有没有一定顺序?还是按照link的先后来随机排列的?

按照link的顺序,看System.map里__initcall_<function name>3的symbol排列的顺序
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."