* [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
@ 2021-09-20 20:37 Anand Moon
2021-09-21 5:34 ` Martin Blumenstingl
0 siblings, 1 reply; 4+ messages in thread
From: Anand Moon @ 2021-09-20 20:37 UTC (permalink / raw)
To: linux-arm-kernel, linux-amlogic, linux-kernel
Cc: Anand Moon, Martin Blumenstingl, Liam Girdwood, Mark Brown, Jon Hunter
devm_pwm_get() can return -EPROBE_DEFER if the pwm 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>
---
V1 - Fix the wrong probe defer for devm_regulator_register.
- Fix the commit message.
---
drivers/regulator/pwm-regulator.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 7629476d94ae..3bd020641b67 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -353,13 +353,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(drvdata->pwm)) {
- ret = PTR_ERR(drvdata->pwm);
- if (ret == -EPROBE_DEFER)
- dev_dbg(&pdev->dev,
- "Failed to get PWM, deferring probe\n");
- else
- dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
- return ret;
+ return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
+ "Failed to register regulator %s\n",
+ drvdata->desc.name);
}
if (init_data->constraints.boot_on || init_data->constraints.always_on)
--
2.33.0
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
2021-09-20 20:37 [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe() Anand Moon
@ 2021-09-21 5:34 ` Martin Blumenstingl
2021-09-21 19:21 ` Anand Moon
0 siblings, 1 reply; 4+ messages in thread
From: Martin Blumenstingl @ 2021-09-21 5:34 UTC (permalink / raw)
To: Anand Moon
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, Liam Girdwood,
Mark Brown, Jon Hunter
Hi Anand,
On Mon, Sep 20, 2021 at 10:38 PM Anand Moon <linux.amoon@gmail.com> wrote:
>
> devm_pwm_get() can return -EPROBE_DEFER if the pwm 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")
Personally I consider this as an improvement (having the deferral
reason show up in debugfs), not a bugfix.
Because of that I would drop the Fixes tag.
Let's wait on other people's opinions though.
[...]
> - dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
> - return ret;
> + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
> + "Failed to register regulator %s\n",
The message here should still be similar to the original one since the
actual problem is that we could not get a reference to the PWM
controller. At this point we are not trying to register the
pwm-regulator yet.
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
2021-09-21 5:34 ` Martin Blumenstingl
@ 2021-09-21 19:21 ` Anand Moon
2021-09-21 19:28 ` Martin Blumenstingl
0 siblings, 1 reply; 4+ messages in thread
From: Anand Moon @ 2021-09-21 19:21 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: linux-arm-kernel, linux-amlogic, Linux Kernel, Liam Girdwood,
Mark Brown, Jon Hunter
Hi Martin,
On Tue, 21 Sept 2021 at 11:04, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hi Anand,
>
> On Mon, Sep 20, 2021 at 10:38 PM Anand Moon <linux.amoon@gmail.com> wrote:
> >
> > devm_pwm_get() can return -EPROBE_DEFER if the pwm 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")
> Personally I consider this as an improvement (having the deferral
> reason show up in debugfs), not a bugfix.
> Because of that I would drop the Fixes tag.
> Let's wait on other people's opinions though.
>
Ok will drop this in the next version.
> [...]
> > - dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
> > - return ret;
> > + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
> > + "Failed to register regulator %s\n",
> The message here should still be similar to the original one since the
> actual problem is that we could not get a reference to the PWM
> controller. At this point we are not trying to register the
> pwm-regulator yet.
>
Yep, Typo I mixed up the logs completely.
it should be "Failed to get PWM, deferring probe"
Thanks
-Anand
>
> Best regards,
> Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe()
2021-09-21 19:21 ` Anand Moon
@ 2021-09-21 19:28 ` Martin Blumenstingl
0 siblings, 0 replies; 4+ messages in thread
From: Martin Blumenstingl @ 2021-09-21 19:28 UTC (permalink / raw)
To: Anand Moon
Cc: linux-arm-kernel, linux-amlogic, Linux Kernel, Liam Girdwood,
Mark Brown, Jon Hunter
Hi Anand,
On Tue, Sep 21, 2021 at 9:21 PM Anand Moon <linux.amoon@gmail.com> wrote:
[...]
> > > - dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
> > > - return ret;
> > > + return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
> > > + "Failed to register regulator %s\n",
> > The message here should still be similar to the original one since the
> > actual problem is that we could not get a reference to the PWM
> > controller. At this point we are not trying to register the
> > pwm-regulator yet.
> >
>
> Yep, Typo I mixed up the logs completely.
> it should be "Failed to get PWM, deferring probe"
I think it should only be "Failed to get PWM" only - without "deferring probe".
If the PWM is missing in .dts (which is not valid but might happen for
someone who's creating a new .dts) then the "deferring probe" part is
not correct as the error code is not -EPROBE_DEFER (it may be -ENOENT
instead - or similar).
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-21 19:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 20:37 [PATCHv2] regulator: pwm-regulator: Make use of the helper function dev_err_probe() Anand Moon
2021-09-21 5:34 ` Martin Blumenstingl
2021-09-21 19:21 ` Anand Moon
2021-09-21 19:28 ` Martin Blumenstingl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).