mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
@ 2024-10-24 10:35 Dario Binacchi
  2024-10-24 10:58 ` Krzysztof Kozlowski
  2024-10-24 11:01 ` Marco Felsch
  0 siblings, 2 replies; 6+ messages in thread
From: Dario Binacchi @ 2024-10-24 10:35 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-amarula, Dario Binacchi, Michael Trimarchi, Fabio Estevam,
	Krzysztof Kozlowski, Pengutronix Kernel Team, Sascha Hauer,
	Shawn Guo, Shengjiu Wang, Ulf Hansson, Uwe Kleine-König,
	imx, linux-arm-kernel, linux-pm

The patch standardizes the probe() code by replacing the two occurrences
of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
other error paths of the probe() function.

Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

---

 drivers/pmdomain/imx/gpcv2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
index 963d61c5af6d..6e6ecbf2e152 100644
--- a/drivers/pmdomain/imx/gpcv2.c
+++ b/drivers/pmdomain/imx/gpcv2.c
@@ -1356,7 +1356,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
 
 	ret = pm_genpd_init(&domain->genpd, NULL, true);
 	if (ret) {
-		dev_err(domain->dev, "Failed to init power domain\n");
+		dev_err_probe(domain->dev, ret, "Failed to init power domain\n");
 		goto out_domain_unmap;
 	}
 
@@ -1367,7 +1367,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
 	ret = of_genpd_add_provider_simple(domain->dev->of_node,
 					   &domain->genpd);
 	if (ret) {
-		dev_err(domain->dev, "Failed to add genpd provider\n");
+		dev_err_probe(domain->dev, ret, "Failed to add genpd provider\n");
 		goto out_genpd_remove;
 	}
 
-- 
2.43.0


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

* Re: [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
  2024-10-24 10:35 [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe() Dario Binacchi
@ 2024-10-24 10:58 ` Krzysztof Kozlowski
  2024-10-24 11:01 ` Marco Felsch
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-24 10:58 UTC (permalink / raw)
  To: Dario Binacchi, linux-kernel
  Cc: linux-amarula, Michael Trimarchi, Fabio Estevam,
	Pengutronix Kernel Team, Sascha Hauer, Shawn Guo, Shengjiu Wang,
	Ulf Hansson, Uwe Kleine-König, imx, linux-arm-kernel,
	linux-pm

On 24/10/2024 12:35, Dario Binacchi wrote:
> The patch standardizes the probe() code by replacing the two occurrences
> of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
> other error paths of the probe() function.

But why? Does not simplify the code and called function cannot defer. It
prints error, but your commit does not mention this as benefit.

Best regards,
Krzysztof


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

* Re: [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
  2024-10-24 10:35 [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe() Dario Binacchi
  2024-10-24 10:58 ` Krzysztof Kozlowski
@ 2024-10-24 11:01 ` Marco Felsch
  2024-10-24 17:26   ` Uwe Kleine-König
  1 sibling, 1 reply; 6+ messages in thread
From: Marco Felsch @ 2024-10-24 11:01 UTC (permalink / raw)
  To: Dario Binacchi
  Cc: linux-kernel, imx, Ulf Hansson, Michael Trimarchi, linux-pm,
	linux-amarula, Sascha Hauer, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Uwe Kleine-König, Shawn Guo,
	Fabio Estevam, Shengjiu Wang, linux-arm-kernel

Hi Dario,

thanks for the patch.

On 24-10-24, Dario Binacchi wrote:
> The patch standardizes the probe() code by replacing the two occurrences
> of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
> other error paths of the probe() function.

I assume that this paths aren't using dev_err_probe because these paths
can't return EPROBE_DEFER and therefore dev_err_probe() would use
dev_err() anyway.

Regards,
  Marco

> Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> ---
> 
>  drivers/pmdomain/imx/gpcv2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
> index 963d61c5af6d..6e6ecbf2e152 100644
> --- a/drivers/pmdomain/imx/gpcv2.c
> +++ b/drivers/pmdomain/imx/gpcv2.c
> @@ -1356,7 +1356,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
>  
>  	ret = pm_genpd_init(&domain->genpd, NULL, true);
>  	if (ret) {
> -		dev_err(domain->dev, "Failed to init power domain\n");
> +		dev_err_probe(domain->dev, ret, "Failed to init power domain\n");
>  		goto out_domain_unmap;
>  	}
>  
> @@ -1367,7 +1367,7 @@ static int imx_pgc_domain_probe(struct platform_device *pdev)
>  	ret = of_genpd_add_provider_simple(domain->dev->of_node,
>  					   &domain->genpd);
>  	if (ret) {
> -		dev_err(domain->dev, "Failed to add genpd provider\n");
> +		dev_err_probe(domain->dev, ret, "Failed to add genpd provider\n");
>  		goto out_genpd_remove;
>  	}
>  
> -- 
> 2.43.0
> 
> 
> 

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

* Re: [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
  2024-10-24 11:01 ` Marco Felsch
@ 2024-10-24 17:26   ` Uwe Kleine-König
  2024-10-24 18:08     ` Marco Felsch
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-10-24 17:26 UTC (permalink / raw)
  To: Marco Felsch
  Cc: Dario Binacchi, linux-kernel, imx, Ulf Hansson,
	Michael Trimarchi, linux-pm, linux-amarula, Sascha Hauer,
	Krzysztof Kozlowski, Pengutronix Kernel Team, Shawn Guo,
	Fabio Estevam, Shengjiu Wang, linux-arm-kernel

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

Hallo Marco,

On Thu, Oct 24, 2024 at 01:01:23PM +0200, Marco Felsch wrote:
> On 24-10-24, Dario Binacchi wrote:
> > The patch standardizes the probe() code by replacing the two occurrences
> > of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
> > other error paths of the probe() function.
> 
> I assume that this paths aren't using dev_err_probe because these paths
> can't return EPROBE_DEFER and therefore dev_err_probe() would use
> dev_err() anyway.

Note that dev_err_probe() has advantages even if the error code isn't
EPROBE_DEFER. In this case it's mentioning the error code.

See also commits
	7065f92255bb ("driver core: Clarify that dev_err_probe() is OK even w/out -EPROBE_DEFER")
	532888a59505 ("driver core: Better advertise dev_err_probe()")

Best regards
Uwe


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

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

* Re: [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
  2024-10-24 17:26   ` Uwe Kleine-König
@ 2024-10-24 18:08     ` Marco Felsch
  2024-10-25  7:14       ` Marco Felsch
  0 siblings, 1 reply; 6+ messages in thread
From: Marco Felsch @ 2024-10-24 18:08 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Dario Binacchi, linux-kernel, imx, Ulf Hansson,
	Michael Trimarchi, linux-pm, linux-amarula, Sascha Hauer,
	Krzysztof Kozlowski, Pengutronix Kernel Team, Shawn Guo,
	Fabio Estevam, Shengjiu Wang, linux-arm-kernel

Hi Uwe,

On 24-10-24, Uwe Kleine-König wrote:
> Hallo Marco,
> 
> On Thu, Oct 24, 2024 at 01:01:23PM +0200, Marco Felsch wrote:
> > On 24-10-24, Dario Binacchi wrote:
> > > The patch standardizes the probe() code by replacing the two occurrences
> > > of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
> > > other error paths of the probe() function.
> > 
> > I assume that this paths aren't using dev_err_probe because these paths
> > can't return EPROBE_DEFER and therefore dev_err_probe() would use
> > dev_err() anyway.
> 
> Note that dev_err_probe() has advantages even if the error code isn't
> EPROBE_DEFER. In this case it's mentioning the error code.
> 
> See also commits
> 	7065f92255bb ("driver core: Clarify that dev_err_probe() is OK even w/out -EPROBE_DEFER")
> 	532888a59505 ("driver core: Better advertise dev_err_probe()")

thanks for the pointers. With that in mind it make sense to me to
convert it. Feel free to add my:

Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>

Regards,
  Marco

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

* Re: [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe()
  2024-10-24 18:08     ` Marco Felsch
@ 2024-10-25  7:14       ` Marco Felsch
  0 siblings, 0 replies; 6+ messages in thread
From: Marco Felsch @ 2024-10-25  7:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: imx, Ulf Hansson, Michael Trimarchi, linux-pm, Shawn Guo,
	Sascha Hauer, linux-kernel, Fabio Estevam, Krzysztof Kozlowski,
	Pengutronix Kernel Team, Dario Binacchi, linux-amarula,
	Shengjiu Wang, linux-arm-kernel

Hi Dario,

On 24-10-24, Marco Felsch wrote:
> Hi Uwe,
> 
> On 24-10-24, Uwe Kleine-König wrote:
> > Hallo Marco,
> > 
> > On Thu, Oct 24, 2024 at 01:01:23PM +0200, Marco Felsch wrote:
> > > On 24-10-24, Dario Binacchi wrote:
> > > > The patch standardizes the probe() code by replacing the two occurrences
> > > > of dev_err() with dev_err_probe(). Indeed, dev_err_probe() was used in all
> > > > other error paths of the probe() function.
> > > 
> > > I assume that this paths aren't using dev_err_probe because these paths
> > > can't return EPROBE_DEFER and therefore dev_err_probe() would use
> > > dev_err() anyway.
> > 
> > Note that dev_err_probe() has advantages even if the error code isn't
> > EPROBE_DEFER. In this case it's mentioning the error code.
> > 
> > See also commits
> > 	7065f92255bb ("driver core: Clarify that dev_err_probe() is OK even w/out -EPROBE_DEFER")
> > 	532888a59505 ("driver core: Better advertise dev_err_probe()")
> 
> thanks for the pointers. With that in mind it make sense to me to
> convert it. Feel free to add my:

that being said, I would like to ask you if you could addapt the commit
message, to point out the advantage of using dev_err_probe().

> Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> 
> Regards,
>   Marco
> 
> 

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

end of thread, other threads:[~2024-10-25  7:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-24 10:35 [PATCH] pmdomain: imx: gpcv2: replace dev_err() with dev_err_probe() Dario Binacchi
2024-10-24 10:58 ` Krzysztof Kozlowski
2024-10-24 11:01 ` Marco Felsch
2024-10-24 17:26   ` Uwe Kleine-König
2024-10-24 18:08     ` Marco Felsch
2024-10-25  7:14       ` Marco Felsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®