2020-10-30 20:15:07

by Grygorii Strashko

[permalink] [raw]
Subject: [PATCH] pwm: tiehrpwm: handle deferred probe with dev_err_probe()

The devm_clk_get() may return -EPROBE_DEFER which is not handled properly
by TI EHRPWM driver and causes unnecessary boot log messages.

Hence, add proper deferred probe handling with new dev_err_probe() API.

Signed-off-by: Grygorii Strashko <[email protected]>
---
drivers/pwm/pwm-tiehrpwm.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 0846917ff2d2..14c8fdcfd607 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -437,10 +437,8 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
}
}

- if (IS_ERR(clk)) {
- dev_err(&pdev->dev, "failed to get clock\n");
- return PTR_ERR(clk);
- }
+ if (IS_ERR(clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(clk), "Failed to get fck\n");

pc->clk_rate = clk_get_rate(clk);
if (!pc->clk_rate) {
@@ -462,10 +460,8 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)

/* Acquire tbclk for Time Base EHRPWM submodule */
pc->tbclk = devm_clk_get(&pdev->dev, "tbclk");
- if (IS_ERR(pc->tbclk)) {
- dev_err(&pdev->dev, "Failed to get tbclk\n");
- return PTR_ERR(pc->tbclk);
- }
+ if (IS_ERR(pc->tbclk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(pc->tbclk), "Failed to get tbclk\n");

ret = clk_prepare(pc->tbclk);
if (ret < 0) {
--
2.17.1


2020-10-31 09:13:29

by Vignesh Raghavendra

[permalink] [raw]
Subject: Re: [PATCH] pwm: tiehrpwm: handle deferred probe with dev_err_probe()



On 10/31/20 1:42 AM, Grygorii Strashko wrote:
> The devm_clk_get() may return -EPROBE_DEFER which is not handled properly
> by TI EHRPWM driver and causes unnecessary boot log messages.
>
> Hence, add proper deferred probe handling with new dev_err_probe() API.
>
> Signed-off-by: Grygorii Strashko <[email protected]>
> ---

Reviewed-by: Vignesh Raghavendra <[email protected]>

> drivers/pwm/pwm-tiehrpwm.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
> index 0846917ff2d2..14c8fdcfd607 100644
> --- a/drivers/pwm/pwm-tiehrpwm.c
> +++ b/drivers/pwm/pwm-tiehrpwm.c
> @@ -437,10 +437,8 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
> }
> }
>
> - if (IS_ERR(clk)) {
> - dev_err(&pdev->dev, "failed to get clock\n");
> - return PTR_ERR(clk);
> - }
> + if (IS_ERR(clk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(clk), "Failed to get fck\n");
>
> pc->clk_rate = clk_get_rate(clk);
> if (!pc->clk_rate) {
> @@ -462,10 +460,8 @@ static int ehrpwm_pwm_probe(struct platform_device *pdev)
>
> /* Acquire tbclk for Time Base EHRPWM submodule */
> pc->tbclk = devm_clk_get(&pdev->dev, "tbclk");
> - if (IS_ERR(pc->tbclk)) {
> - dev_err(&pdev->dev, "Failed to get tbclk\n");
> - return PTR_ERR(pc->tbclk);
> - }
> + if (IS_ERR(pc->tbclk))
> + return dev_err_probe(&pdev->dev, PTR_ERR(pc->tbclk), "Failed to get tbclk\n");
>
> ret = clk_prepare(pc->tbclk);
> if (ret < 0) {
>

2020-11-03 06:52:33

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH] pwm: tiehrpwm: handle deferred probe with dev_err_probe()

On Fri, Oct 30, 2020 at 10:12:54PM +0200, Grygorii Strashko wrote:
> The devm_clk_get() may return -EPROBE_DEFER which is not handled properly
> by TI EHRPWM driver and causes unnecessary boot log messages.
>
> Hence, add proper deferred probe handling with new dev_err_probe() API.
>
> Signed-off-by: Grygorii Strashko <[email protected]>

Reviewed-by: Uwe Kleine-K?nig <[email protected]>

Thanks
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (596.00 B)
signature.asc (499.00 B)
Download all attachments

2020-11-11 20:03:07

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] pwm: tiehrpwm: handle deferred probe with dev_err_probe()

On Fri, Oct 30, 2020 at 10:12:54PM +0200, Grygorii Strashko wrote:
> The devm_clk_get() may return -EPROBE_DEFER which is not handled properly
> by TI EHRPWM driver and causes unnecessary boot log messages.
>
> Hence, add proper deferred probe handling with new dev_err_probe() API.
>
> Signed-off-by: Grygorii Strashko <[email protected]>
> ---
> drivers/pwm/pwm-tiehrpwm.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)

Applied, thanks.

Thierry


Attachments:
(No filename) (495.00 B)
signature.asc (849.00 B)
Download all attachments