添加 GPIOLIB 依赖

Adding GPIOLIB dependency

我正在尝试编译一个使用来自 linux/gpio/consumer.h 的新 GPIO API 的内核模块。但是 make 失败并显示 'error: ‘gpio_handle’ has an incomplete type ‘struct gpio_desc’'。我读到我需要在 Kconfig 中额外包含 GPIOLIB 依赖项,但是简单地添加 'depends on' 是行不通的。包含这种依赖项的正确方法是什么?

比我想象的要简单...只需将 struct gpio_desc xx 替换为 struct gpio_desc* xx 即可解决问题,以便在 运行 时分配实际结构。因此,这应该适用于内核中具有此类结构的其他情况。