我想在另一个驱动程序中调用do_input_boost
函数,但我找不到调用该函数的方法。
static void do_input_boost(struct kthread_work *work)
{
unsigned int i, ret;
struct cpu_sync *i_sync_info;
/* Set the input_boost_min for all CPUs in the system */
pr_debug("Setting input boost min for all CPUs\n");
for_each_possible_cpu(i) {
i_sync_info = &per_cpu(sync_info, i);
i_sync_info->input_boost_min = i_sync_info->input_boost_freq;
}
queue_delayed_work(system_power_efficient_wq,
&input_boost_rem, msecs_to_jiffies(input_boost_ms));
}
我还添加了EXPORT_SYMBOL(do_input_boost)
但找不到调用此函数的正确原型定义,比如
do_input_boost();
编辑:我添加了一个心脏和linkedin目标驱动程序
#ifdef CONFIG_CPU_BOOST
extern void do_input_boost(void);
#else
extern void do_input_boost(void)
{
}
#endif
IMO你必须删除static
,因为它限制了这个函数对当前转换单元的可见性(假设另一个驱动程序不在同一个.c
文件中)。
删除static
将使该函数成为全局函数,并且可以使用.c
声明从其他extern
文件中访问它。
让我们说我们的do_input_boost
的这个功能是在a.c
文件中定义的,你的驱动程序是在b.c
文件中(你要调用那个函数),然后:
在b.c
你会声明这个函数:extern void do_input_boost(struct kthread_work*);
然后你可以调用它。