All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Anand Moon <linux.amoon@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
Date: Mon, 20 Sep 2021 10:26:30 +0200	[thread overview]
Message-ID: <7dcee097-9119-1987-9bb5-777d541cc9f7@baylibre.com> (raw)
In-Reply-To: <20210919211129.4364-1-linux.amoon@gmail.com>

On 19/09/2021 23:11, Anand Moon wrote:
> devm_regulator_register can return -EPROBE_DEFER if the
> regulator is not ready yet. Use dev_err_probe() for
> pwm regulator resources to indicate the deferral reason
> when waiting for the resource to come up.
> 
> Fixes: 0cd71b9a43ad ("regulator: pwm: Don't warn on probe deferral")
> 
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
>  drivers/regulator/pwm-regulator.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
> index 7629476d94ae..451e57a739f8 100644
> --- a/drivers/regulator/pwm-regulator.c
> +++ b/drivers/regulator/pwm-regulator.c
> @@ -382,9 +382,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
>  					    &drvdata->desc, &config);
>  	if (IS_ERR(regulator)) {
>  		ret = PTR_ERR(regulator);
> -		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
> -			drvdata->desc.name, ret);
> -		return ret;
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "Failed to register regulator %s: %d\n",
> +				     drvdata->desc.name, ret);

No need to keep ret and print it since it will be printed by dev_err_probe, pass directly PTR_ERR(regulator) and drop the ": %d" from the error string.

Neil


>  	}
>  
>  	return 0;
> 


WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Anand Moon <linux.amoon@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	 linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
Date: Mon, 20 Sep 2021 10:26:30 +0200	[thread overview]
Message-ID: <7dcee097-9119-1987-9bb5-777d541cc9f7@baylibre.com> (raw)
In-Reply-To: <20210919211129.4364-1-linux.amoon@gmail.com>

On 19/09/2021 23:11, Anand Moon wrote:
> devm_regulator_register can return -EPROBE_DEFER if the
> regulator is not ready yet. Use dev_err_probe() for
> pwm regulator resources to indicate the deferral reason
> when waiting for the resource to come up.
> 
> Fixes: 0cd71b9a43ad ("regulator: pwm: Don't warn on probe deferral")
> 
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
>  drivers/regulator/pwm-regulator.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
> index 7629476d94ae..451e57a739f8 100644
> --- a/drivers/regulator/pwm-regulator.c
> +++ b/drivers/regulator/pwm-regulator.c
> @@ -382,9 +382,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
>  					    &drvdata->desc, &config);
>  	if (IS_ERR(regulator)) {
>  		ret = PTR_ERR(regulator);
> -		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
> -			drvdata->desc.name, ret);
> -		return ret;
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "Failed to register regulator %s: %d\n",
> +				     drvdata->desc.name, ret);

No need to keep ret and print it since it will be printed by dev_err_probe, pass directly PTR_ERR(regulator) and drop the ": %d" from the error string.

Neil


>  	}
>  
>  	return 0;
> 


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Anand Moon <linux.amoon@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	 linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Jon Hunter <jonathanh@nvidia.com>
Subject: Re: [PATCH] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
Date: Mon, 20 Sep 2021 10:26:30 +0200	[thread overview]
Message-ID: <7dcee097-9119-1987-9bb5-777d541cc9f7@baylibre.com> (raw)
In-Reply-To: <20210919211129.4364-1-linux.amoon@gmail.com>

On 19/09/2021 23:11, Anand Moon wrote:
> devm_regulator_register can return -EPROBE_DEFER if the
> regulator is not ready yet. Use dev_err_probe() for
> pwm regulator resources to indicate the deferral reason
> when waiting for the resource to come up.
> 
> Fixes: 0cd71b9a43ad ("regulator: pwm: Don't warn on probe deferral")
> 
> Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Signed-off-by: Anand Moon <linux.amoon@gmail.com>
> ---
>  drivers/regulator/pwm-regulator.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
> index 7629476d94ae..451e57a739f8 100644
> --- a/drivers/regulator/pwm-regulator.c
> +++ b/drivers/regulator/pwm-regulator.c
> @@ -382,9 +382,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
>  					    &drvdata->desc, &config);
>  	if (IS_ERR(regulator)) {
>  		ret = PTR_ERR(regulator);
> -		dev_err(&pdev->dev, "Failed to register regulator %s: %d\n",
> -			drvdata->desc.name, ret);
> -		return ret;
> +		return dev_err_probe(&pdev->dev, ret,
> +				     "Failed to register regulator %s: %d\n",
> +				     drvdata->desc.name, ret);

No need to keep ret and print it since it will be printed by dev_err_probe, pass directly PTR_ERR(regulator) and drop the ": %d" from the error string.

Neil


>  	}
>  
>  	return 0;
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-09-20  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 21:11 [PATCH] regulator: pwm-regulator: Make use of the helper function dev_err_probe() Anand Moon
2021-09-19 21:11 ` Anand Moon
2021-09-19 21:11 ` Anand Moon
2021-09-20  8:26 ` Neil Armstrong [this message]
2021-09-20  8:26   ` Neil Armstrong
2021-09-20  8:26   ` Neil Armstrong
2021-09-20 18:05   ` Anand Moon
2021-09-20 18:05     ` Anand Moon
2021-09-20 18:05     ` Anand Moon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7dcee097-9119-1987-9bb5-777d541cc9f7@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux.amoon@gmail.com \
    --cc=martin.blumenstingl@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.