编译智能调速器时如何修复初始值设定项中指定的未知字段'suspend'?
How to fix unknown field 'suspend' specified in initializer when compiling smartass governor?
我一直在试图找出为什么当我试图编译我的android内核它给了我这个错误的智能总督:
drivers/cpufreq/cpufreq_smartass2.c:844:2: error: unknown field 'suspend' specified in initializer
.suspend = smartass_early_suspend,
^
drivers/cpufreq/cpufreq_smartass2.c:844:13: warning: excess elements in struct initializer
error, forbidden warning: cpufreq_smartass2.c:844
make[2]: *** [drivers/cpufreq/cpufreq_smartass2.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
make: *** [drivers] Error 2
make: *** Waiting for unfinished jobs....
我检查了给我错误的行,它是一个变量的初始化,它是一个结构数据结构的成员。代码如下:
static struct early_suspend smartass_power_suspend = {
.suspend = smartass_early_suspend,
.resume = smartass_late_resume,
#ifdef CONFIG_MACH_HERO
.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1,
#endif
};
下面是完整的代码:
static void smartass_suspend(int cpu, int suspend)
{
struct smartass_info_s *this_smartass = &per_cpu(smartass_info, smp_processor_id());
struct cpufreq_policy *policy = this_smartass->cur_policy;
unsigned int new_freq;
if (!this_smartass->enable)
return;
smartass_update_min_max(this_smartass,policy,suspend);
if (!suspend) { // resume at max speed:
new_freq = validate_freq(policy,sleep_wakeup_freq);
dprintk(SMARTASS_DEBUG_JUMPS,"SmartassS: awaking at %dn",new_freq);
__cpufreq_driver_target(policy, new_freq,
CPUFREQ_RELATION_L);
} else {
// to avoid wakeup issues with quick sleep/wakeup don't change actual frequency when entering sleep
// to allow some time to settle down. Instead we just reset our statistics (and reset the timer).
// Eventually, the timer will adjust the frequency if necessary.
this_smartass->freq_change_time_in_idle =
get_cpu_idle_time_us(cpu,&this_smartass->freq_change_time);
dprintk(SMARTASS_DEBUG_JUMPS,"SmartassS: suspending at %dn",policy->cur);
}
reset_timer(smp_processor_id(),this_smartass);
}
static void smartass_early_suspend(struct early_suspend *handler) {
int i;
if (suspended || sleep_ideal_freq==0) // disable behavior for sleep_ideal_freq==0
return;
suspended = 1;
for_each_online_cpu(i)
smartass_suspend(i,1);
}
static void smartass_late_resume(struct early_suspend *handler) {
int i;
if (!suspended) // already not suspended so nothing to do
return;
suspended = 0;
for_each_online_cpu(i)
smartass_suspend(i,0);
}
static struct early_suspend smartass_power_suspend = {
.suspend = smartass_early_suspend,
.resume = smartass_late_resume,
#ifdef CONFIG_MACH_HERO
.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1,
#endif
};
代码在语法上似乎是正确的,我在这个问题上遇到了瓶颈。有人能帮忙吗?
感谢@Tsyvarev我修复了"未知字段'suspend'在初始化器中指定的问题"
在尝试添加其他调控器并尝试编译后,我收到了我添加的新调控器的错误消息
drivers/built-in.o: In function cpufreq_smartass_init':
/home/nick/android/LGD722LKernel/drivers/cpufreq/cpufreq_smartass2.c:898: undefined reference to `register_early_suspend'
链接到cpufreq_smartass2.c的完整代码
链接到earlyssuspend .h的完整代码
我已经检查了函数register_eary_suspend和它被调用的方式以及参数传递给函数的方式看起来是正确的。我认为这可能来自于制作文件,但这只是我的看法。如果有人有任何其他的想法,问题可能是什么,请分享我没有太多的内核开发经验,你的想法/建议将真正帮助我。
相关文章:
- 将结构字段的类型展开为可变模板参数
- 将位字段导出到数组
- 为了方便起见,我应该避免公开私有字段变量吗
- 当字段可以为null时,如何使用C++接口在Avro中写入数据
- 在java中读取c++字节的位字段
- 链接器找不到在虚拟类 c++ 中访问的静态字段的符号
- 私有字段对象与私有继承?
- 声明没有默认构造函数的字段
- C++内存模型和位字段的最大序列
- 声明为无效的变量或字段'...' Ardunio 编译器上的错误
- 如何在QByteArray中放置和检索位字段而不会感到痛苦?
- C++ win32 如何使密码字段可选并启用复制和粘贴?
- 如何通过UDP接收QByteArray并将其解析为位字段结构?
- 仅匹配集合中的某些字段
- 结构字段名称与 GDB 中的 STL 数组冲突
- 如何使用位字段将数据从二进制文件复制到结构中?
- 结构体和类的不同大小(),彼此具有相同的字段类型
- 如何避免在数据结构中包含存储为字段的类?
- 聚合初始化和删除的复制构造函数,也称为不可复制的 obejcts 作为字段
- 编译智能调速器时如何修复初始值设定项中指定的未知字段'suspend'?