linux3.0内核编译”implicit declaration of function 'irq_to_gpio' ”报错的解决办法

 

一、编译报错信息

 

drivers/mfd/ezx-pcap.c: In function ‘pcap_isr_work’:
drivers/mfd/ezx-pcap.c:205:2: error: implicit declaration of function ‘irq_to_gpio’ [-Werror=implicit-function-declaration]
  } while (gpio_get_value(irq_to_gpio(pcap->spi->irq)));
  ^
cc1: some warnings being treated as errors
scripts/Makefile.build:305: recipe for target 'drivers/mfd/ezx-pcap.o' failed
make[2]: *** [drivers/mfd/ezx-pcap.o] Error 1
scripts/Makefile.build:441: recipe for target 'drivers/mfd' failed
make[1]: *** [drivers/mfd] Error 2
Makefile:944: recipe for target 'drivers' failed
make: *** [drivers] Error 2

 

 

 

二、解决步骤 

 


1、将源码目录drivers/mfd/Kconfig)大概537行的

depends on GENERIC_HARDIRQS && SPI_MASTER修改为
depends on GENERIC_HARDIRQS && SPI_MASTER && ARCH_PXA

 

 

2、将源码目录 drivers/mfd/ezx-pcap.c)进行如下修改

(1)添加头文件#include <linux/gpio-pxa.h>

 

(2)将大概行while (gpio_get_value(irq_to_gpio(pcap->spi->irq)));替换为
     while (gpio_get_value(pxa_irq_to_gpio(pcap->spi->irq)));

 

3、找到其它版本的内核中有gpio-pxa.h的文件。将其复制到 源码目录下include/linux目录下。

 

该文件的全部内容如下,可以自行复制后保存成对应的文件名即可。

 

#ifndef __GPIO_PXA_H
#define __GPIO_PXA_H

#define GPIO_bit(x)	(1 << ((x) & 0x1f))

#define gpio_to_bank(gpio)	((gpio) >> 5)

/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
 * Those cases currently cause holes in the GPIO number space, the
 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
 */
extern int pxa_last_gpio;

extern int pxa_irq_to_gpio(int irq);

struct pxa_gpio_platform_data {
	int irq_base;
	int (*gpio_set_wake)(unsigned int gpio, unsigned int on);
};

#endif /* __GPIO_PXA_H */

 

4、再次编译即可完成。

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值