All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: gpio-restart: don't error on deferral
@ 2019-10-29  0:43 Chris Packham
  2019-10-29 10:47 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Packham @ 2019-10-29  0:43 UTC (permalink / raw)
  To: sre; +Cc: linux-pm, linux-kernel, Chris Packham

Don't generate an error message when devm_gpiod_get fails with
-EPROBE_DEFER.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
 drivers/power/reset/gpio-restart.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/reset/gpio-restart.c b/drivers/power/reset/gpio-restart.c
index 308ca9d9d276..4aaa46b80ba2 100644
--- a/drivers/power/reset/gpio-restart.c
+++ b/drivers/power/reset/gpio-restart.c
@@ -65,7 +65,8 @@ static int gpio_restart_probe(struct platform_device *pdev)
 	gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
 			open_source ? GPIOD_IN : GPIOD_OUT_LOW);
 	if (IS_ERR(gpio_restart->reset_gpio)) {
-		dev_err(&pdev->dev, "Could not get reset GPIO\n");
+		if (PTR_ERR(gpio_restart->reset_gpio) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Could not get reset GPIO\n");
 		return PTR_ERR(gpio_restart->reset_gpio);
 	}
 
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: reset: gpio-restart: don't error on deferral
  2019-10-29  0:43 [PATCH] power: reset: gpio-restart: don't error on deferral Chris Packham
@ 2019-10-29 10:47 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2019-10-29 10:47 UTC (permalink / raw)
  To: Chris Packham; +Cc: linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1314 bytes --]

Hi,

On Tue, Oct 29, 2019 at 01:43:02PM +1300, Chris Packham wrote:
> Don't generate an error message when devm_gpiod_get fails with
> -EPROBE_DEFER.
> 
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
> ---

Change looks good generally, but please make it like this to reduce
the amount of PTR_ERR():

ret = PTR_ERR_OR_ZERO(gpio_restart->reset_gpio)
if (ret) {
    if (ret != -EPROBE_DEFER)
        dev_err(...)
    return ret;
}

Thanks,

-- Sebastian

>  drivers/power/reset/gpio-restart.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/reset/gpio-restart.c b/drivers/power/reset/gpio-restart.c
> index 308ca9d9d276..4aaa46b80ba2 100644
> --- a/drivers/power/reset/gpio-restart.c
> +++ b/drivers/power/reset/gpio-restart.c
> @@ -65,7 +65,8 @@ static int gpio_restart_probe(struct platform_device *pdev)
>  	gpio_restart->reset_gpio = devm_gpiod_get(&pdev->dev, NULL,
>  			open_source ? GPIOD_IN : GPIOD_OUT_LOW);
>  	if (IS_ERR(gpio_restart->reset_gpio)) {
> -		dev_err(&pdev->dev, "Could not get reset GPIO\n");
> +		if (PTR_ERR(gpio_restart->reset_gpio) != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Could not get reset GPIO\n");
>  		return PTR_ERR(gpio_restart->reset_gpio);
>  	}
>  
> -- 
> 2.23.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-29 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29  0:43 [PATCH] power: reset: gpio-restart: don't error on deferral Chris Packham
2019-10-29 10:47 ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.