From 5a455cb6151908cc9ac891bdedc89e383423e7f6 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Mon, 30 Dec 2024 11:41:13 +0800 Subject: [PATCH] [DM/PIN] Reset the value of PIN_NONE PIN_NONE is '-1', is similar to '-RT_ERROR', '-RT_EEMPTY' is better. Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/include/drivers/dev_pin.h | 2 +- components/drivers/regulator/regulator-gpio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/drivers/include/drivers/dev_pin.h b/components/drivers/include/drivers/dev_pin.h index b1705ae6dd..0cb15c3af9 100644 --- a/components/drivers/include/drivers/dev_pin.h +++ b/components/drivers/include/drivers/dev_pin.h @@ -111,7 +111,7 @@ struct rt_device_pin const struct rt_pin_ops *ops; }; -#define PIN_NONE (-1) +#define PIN_NONE (-RT_EEMPTY) #define PIN_LOW 0x00 /*!< low level */ #define PIN_HIGH 0x01 /*!< high level */ diff --git a/components/drivers/regulator/regulator-gpio.c b/components/drivers/regulator/regulator-gpio.c index 069831835f..0ba9b9534c 100644 --- a/components/drivers/regulator/regulator-gpio.c +++ b/components/drivers/regulator/regulator-gpio.c @@ -193,7 +193,7 @@ static rt_err_t regulator_gpio_probe(struct rt_platform_device *pdev) /* GPIO flags are ignored, we check by enable-active-high */ rg->enable_pin = rt_pin_get_named_pin(dev, "enable", 0, RT_NULL, RT_NULL); - if (rg->enable_pin < 0 && rg->enable_pin != -RT_EEMPTY) + if (rg->enable_pin < 0 && rg->enable_pin != PIN_NONE) { err = rg->enable_pin; goto _fail;