Skip to contentSkip to conversation

sysreset: gpio: fix gpio_reboot_request return value

PATCH Superseded Jonathan Liu 2 participants 2 messages Mar 27, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysreset: gpio: fix gpio_reboot_request return value

It should return -EINPROGRESS if successful otherwise sysreset-uclass will continue to the next sysreset device.

---
 drivers/sysreset/sysreset_gpio.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/sysreset/sysreset_gpio.c +6 -1
index dfca10ccc8..d12e491ffe 100644
@@ -17,6 +17,7 @@ struct gpio_reboot_priv {
 static int gpio_reboot_request(struct udevice *dev, enum sysreset_t type)
 {
 	struct gpio_reboot_priv *priv = dev_get_priv(dev);
+	int r;
 
 	/*
 	 * When debug log is enabled please make sure that chars won't end up
@@ -26,7 +27,11 @@ static int gpio_reboot_request(struct udevice *dev, enum sysreset_t type)
 	debug("GPIO reset\n");
 
 	/* Writing 1 respects polarity (active high/low) based on gpio->flags */
-	return dm_gpio_set_value(&priv->gpio, 1);
+	r = dm_gpio_set_value(&priv->gpio, 1);
+	if (r < 0)
+		return r;
+
+	return -EINPROGRESS;
 }
 
 static struct sysreset_ops gpio_reboot_ops = {
Signature · 1 line
2.40.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Jonathan,

Quoted 8 lines · Jonathan Liu

It should return -EINPROGRESS if successful otherwise sysreset-uclass will continue to the next sysreset device.

---
 drivers/sysreset/sysreset_gpio.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

with nit below

drivers/sysreset/sysreset_gpio.c struct gpio_reboot_priv { · line 20

Quoted 10 lines
drivers/sysreset/sysreset_gpio.c +1 -0
index dfca10ccc8..d12e491ffe 100644
@@ -17,6 +17,7 @@ struct gpio_reboot_priv {
 static int gpio_reboot_request(struct udevice *dev, enum sysreset_t type)
 {
        struct gpio_reboot_priv *priv = dev_get_priv(dev);
+       int r;

Please could you use 'ret' for the var name as that is more common.

Quoted 17 lines
drivers/sysreset/sysreset_gpio.c +5 -2
        /*
         * When debug log is enabled please make sure that chars won't end up
@@ -26,7 +27,11 @@ static int gpio_reboot_request(struct udevice *dev, enum sysreset_t type)
        debug("GPIO reset\n");
 
        /* Writing 1 respects polarity (active high/low) based on gpio->flags */
-       return dm_gpio_set_value(&priv->gpio, 1);
+       r = dm_gpio_set_value(&priv->gpio, 1);
+       if (r < 0)
+               return r;
+
+       return -EINPROGRESS;
 }
 
 static struct sysreset_ops gpio_reboot_ops = {
--
Quoted 2 lines

2.40.0

Regards,
Simon