error:implicit declaration of function "irq_to_gpio"
2013-11-27 11:27
911 查看
在Tiny210上移植egalax的IIC driver,编译时出现如题错误。提示的很清楚,驱动程序中的函数irq_to_gpio没有声明。
看了下驱动文件的头文件中包含#include<linux/gpio.h>,该头文件中有一个irq_to_gpio的原型
static inline int irq_to_gpio(unsigned irq)
{
/* irq can never have been returned from gpio_to_irq() */
WARN_ON(1); //啥都没有实现的函数,肯定没用。
return -EINVAL;
}
可以看到头文件开头几行有个条件编译,如下图,看了下.config的配置,果然该函数没被编译进内核。
然后又去平台相关的目录(arch/arm/mach-s5pv210-----我的开发板平台目录)下去搜了下,用grep -s "irq_to_gpio" ./ -r,nothing。
Documention/gpio.txt中关于这个函数的描述:
Non-error values returned from irq_to_gpio() would most commonly be used
with gpio_get_value(), for example to initialize or update driver state
when the IRQ is edge-triggered. Note that some platforms don't support
this reverse mapping, so you should avoid using it.----原因所在
关于这两个函数:
/* map GPIO numbers to IRQ numbers */
int gpio_to_irq(unsigned gpio); //参数是gpio,返回中断编号
/* map IRQ numbers to GPIO numbers (avoid using this) */
int irq_to_gpio(unsigned irq); //参数是中断编号,返回对应gpio
中断脚是我们自己定义的,我把驱动中irq_to_gpio函数全部替换成对应的gpio number。有没有问题还有待验证,不过编译是通过了。
看了下驱动文件的头文件中包含#include<linux/gpio.h>,该头文件中有一个irq_to_gpio的原型
static inline int irq_to_gpio(unsigned irq)
{
/* irq can never have been returned from gpio_to_irq() */
WARN_ON(1); //啥都没有实现的函数,肯定没用。
return -EINVAL;
}
可以看到头文件开头几行有个条件编译,如下图,看了下.config的配置,果然该函数没被编译进内核。
然后又去平台相关的目录(arch/arm/mach-s5pv210-----我的开发板平台目录)下去搜了下,用grep -s "irq_to_gpio" ./ -r,nothing。
Documention/gpio.txt中关于这个函数的描述:
Non-error values returned from irq_to_gpio() would most commonly be used
with gpio_get_value(), for example to initialize or update driver state
when the IRQ is edge-triggered. Note that some platforms don't support
this reverse mapping, so you should avoid using it.----原因所在
关于这两个函数:
/* map GPIO numbers to IRQ numbers */
int gpio_to_irq(unsigned gpio); //参数是gpio,返回中断编号
/* map IRQ numbers to GPIO numbers (avoid using this) */
int irq_to_gpio(unsigned irq); //参数是中断编号,返回对应gpio
中断脚是我们自己定义的,我把驱动中irq_to_gpio函数全部替换成对应的gpio number。有没有问题还有待验证,不过编译是通过了。
相关文章推荐
- 编译海思3520内核时候报错drivers/mfd/ezx-pcap.c:205:2: error: implicit declaration of function 'irq_to_gpio' [-
- 编译飞凌ok335D开发板内核时出现drivers/mfd/ezx-pcap.c:205:2: error: implicit declaration of function 'irq_to_gpio
- drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio'
- drivers/input/touchscreen/eeti_ts.c:65:2: error: implicit declaration of function 'irq_to_gpio'
- 移植出错:eeti_ts.c:64: error: implicit declaration of function 'irq_to_gpio'
- drivers/mfd/ezx-pcap.c:214: error: implicit declaration of function 'irq_to_gpio'
- 内核error: implicit declaration of function 'irq_to_gpio' 解决方法
- 移植linux-2.6.38出现 error: implicit declaration of function 'irq_to_gpio'
- hi3520d开发板内核编译出现drivers/mfd/ezx-pcap.c:213: error: implicit declaration of function 'irq_to_gpio'
- implicit declaration of function 's3c2410_gpio_cfgpin"的解决办法
- Semantic Issue: Implicit declaration of function 'SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO' is invali
- error: implicit declaration of function 'class_device_create' error: implicit declaration of functio
- error: implicit declaration of function '********'
- error: implicit declaration of function 'gettimeofday'
- error: implicit declaration of function 'kmalloc'
- error: implicit declaration of function 'posix_memalign' [-Werror=implicit-function-declaration]
- implicit declaration of function "class_device_create"
- error: implicit declaration of function 'xxx'
- 如何解决warning:implicit declaration of function 'xxx'
- how to install NOkia SDK of Chinese Version when you meet a Error:"Could not load jvm.dll"