diff mbox series

sysreset: gpio: fix gpio_reboot_request return value

Message ID 20230327075455.420404-1-net147@gmail.com
State Superseded
Delegated to: Simon Glass
Headers show
Series sysreset: gpio: fix gpio_reboot_request return value | expand

Commit Message

Jonathan Liu March 27, 2023, 7:54 a.m. UTC
It should return -EINPROGRESS if successful otherwise sysreset-uclass
will continue to the next sysreset device.

Signed-off-by: Jonathan Liu <net147@gmail.com>
---
 drivers/sysreset/sysreset_gpio.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Simon Glass March 27, 2023, 8:24 a.m. UTC | #1
Hi Jonathan,

On Mon, 27 Mar 2023 at 20:55, Jonathan Liu <net147@gmail.com> wrote:
>
> It should return -EINPROGRESS if successful otherwise sysreset-uclass
> will continue to the next sysreset device.
>
> Signed-off-by: Jonathan Liu <net147@gmail.com>
> ---
>  drivers/sysreset/sysreset_gpio.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

with nit below

>
> diff --git a/drivers/sysreset/sysreset_gpio.c b/drivers/sysreset/sysreset_gpio.c
> index dfca10ccc8..d12e491ffe 100644
> --- a/drivers/sysreset/sysreset_gpio.c
> +++ b/drivers/sysreset/sysreset_gpio.c
> @@ -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.
>
>         /*
>          * 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 = {
> --
> 2.40.0
>

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/sysreset/sysreset_gpio.c b/drivers/sysreset/sysreset_gpio.c
index dfca10ccc8..d12e491ffe 100644
--- a/drivers/sysreset/sysreset_gpio.c
+++ b/drivers/sysreset/sysreset_gpio.c
@@ -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 = {