一、编译报错信息
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、再次编译即可完成。