在看显示模块的代码时看到一个函数devm_gpiod_get_optional(), 之前没接触过,它的调用如下: devm_gpiod_get_optional ->devm_gpiod_get_index_optional->//index为0devm_gpiod_get_index ->gpiod_get_index 可以看到devm_gpiod_get_optional只是对gpiod_get_index的包装而已,并且index为0。index参数后面会...
*host, if (!pwrseq) return ERR_PTR(-ENOMEM); - pwrseq->reset_gpio = gpiod_get_index(dev, "reset", 0, GPIOD_OUT_LOW); + pwrseq->reset_gpio = gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(pwrseq->reset_gpio)) { ret = PTR_ERR(pwrseq->reset_gpio); goto free; -...
+ return devm_fwnode_gpiod_get_index(dev, fwnode, con_id, 0, + flags, label); +} + static inline struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev, const char *con_id, int index, @@ -538,11 +561,10 @@ struct gpio_desc *devm_fwnode_get_index_gpio...
COX_Status (*Cfg) (COX_PIO_Dev pio, uint8_t index, uint32_t arg, uint32_t *pre_arg); } COX_PIO_PI_Def; typedef const COX_PIO_PI_Def COX_PIO_PI; 这样的实现,确实可以大大减小IO操作的移植,因为我们在每个厂商实现一套API,以新唐为例: COX_PIO_PI pi_pio = { NUC_GPIO_Init, NUC...
可以看到devm_gpiod_get_optional只是对gpiod_get_index的包装而已,并且index为0。index参数后面会提。 函数参数: structgpio_desc *__must_check devm_gpiod_get_index(structdevice *dev,constchar*con_id, unsignedintidx,enumgpiod_flags flags); ...
> The gpiod_get() function expands to gpiod_get_index() with index 0 > so it's better to use it since is easier to read and more concise. > > Signed-off-by: Javier Martinez Canillas <jav...@osg.samsung.com> Thanks, applied for next!
可以看到devm_gpiod_get_optional只是对gpiod_get_index的包装而已,并且index为0。index参数后面会提。 函数参数: structgpio_desc *__must_check devm_gpiod_get_index(structdevice *dev,constchar*con_id, unsignedintidx,enumgpiod_flags flags); ...