linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: stm32-dcmi: return appropriate error codes during probe
@ 2019-04-24 13:25 Fabien Dessenne
  2019-04-24 15:58 ` Hugues FRUCHET
  0 siblings, 1 reply; 2+ messages in thread
From: Fabien Dessenne @ 2019-04-24 13:25 UTC (permalink / raw)
  To: Hugues Fruchet, Mauro Carvalho Chehab, Maxime Coquelin,
	Alexandre Torgue, linux-media, linux-stm32, linux-arm-kernel,
	linux-kernel
  Cc: Fabien Dessenne

During probe, return the provided errors value instead of -ENODEV.
This allows the driver to be deferred probed if needed.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/media/platform/stm32/stm32-dcmi.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
index 906e71b..b9dad0a 100644
--- a/drivers/media/platform/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/stm32/stm32-dcmi.c
@@ -1672,7 +1672,7 @@ static int dcmi_probe(struct platform_device *pdev)
 	dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
 	if (IS_ERR(dcmi->rstc)) {
 		dev_err(&pdev->dev, "Could not get reset control\n");
-		return -ENODEV;
+		return PTR_ERR(dcmi->rstc);
 	}
 
 	/* Get bus characteristics from devicetree */
@@ -1687,7 +1687,7 @@ static int dcmi_probe(struct platform_device *pdev)
 	of_node_put(np);
 	if (ret) {
 		dev_err(&pdev->dev, "Could not parse the endpoint\n");
-		return -ENODEV;
+		return ret;
 	}
 
 	if (ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
@@ -1700,8 +1700,9 @@ static int dcmi_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq <= 0) {
-		dev_err(&pdev->dev, "Could not get irq\n");
-		return -ENODEV;
+		if (irq != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Could not get irq\n");
+		return irq;
 	}
 
 	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1721,12 +1722,13 @@ static int dcmi_probe(struct platform_device *pdev)
 					dev_name(&pdev->dev), dcmi);
 	if (ret) {
 		dev_err(&pdev->dev, "Unable to request irq %d\n", irq);
-		return -ENODEV;
+		return ret;
 	}
 
 	mclk = devm_clk_get(&pdev->dev, "mclk");
 	if (IS_ERR(mclk)) {
-		dev_err(&pdev->dev, "Unable to get mclk\n");
+		if (PTR_ERR(mclk) != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "Unable to get mclk\n");
 		return PTR_ERR(mclk);
 	}
 
-- 
2.7.4


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

* Re: [PATCH] media: stm32-dcmi: return appropriate error codes during probe
  2019-04-24 13:25 [PATCH] media: stm32-dcmi: return appropriate error codes during probe Fabien Dessenne
@ 2019-04-24 15:58 ` Hugues FRUCHET
  0 siblings, 0 replies; 2+ messages in thread
From: Hugues FRUCHET @ 2019-04-24 15:58 UTC (permalink / raw)
  To: Fabien DESSENNE, Mauro Carvalho Chehab, Maxime Coquelin,
	Alexandre TORGUE, linux-media, linux-stm32, linux-arm-kernel,
	linux-kernel

Acked-by: Hugues Fruchet <hugues.fruchet@st.com>


On 4/24/19 3:25 PM, Fabien Dessenne wrote:
> During probe, return the provided errors value instead of -ENODEV.
> This allows the driver to be deferred probed if needed.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>   drivers/media/platform/stm32/stm32-dcmi.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
> index 906e71b..b9dad0a 100644
> --- a/drivers/media/platform/stm32/stm32-dcmi.c
> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
> @@ -1672,7 +1672,7 @@ static int dcmi_probe(struct platform_device *pdev)
>   	dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
>   	if (IS_ERR(dcmi->rstc)) {
>   		dev_err(&pdev->dev, "Could not get reset control\n");
> -		return -ENODEV;
> +		return PTR_ERR(dcmi->rstc);
>   	}
>   
>   	/* Get bus characteristics from devicetree */
> @@ -1687,7 +1687,7 @@ static int dcmi_probe(struct platform_device *pdev)
>   	of_node_put(np);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Could not parse the endpoint\n");
> -		return -ENODEV;
> +		return ret;
>   	}
>   
>   	if (ep.bus_type == V4L2_MBUS_CSI2_DPHY) {
> @@ -1700,8 +1700,9 @@ static int dcmi_probe(struct platform_device *pdev)
>   
>   	irq = platform_get_irq(pdev, 0);
>   	if (irq <= 0) {
> -		dev_err(&pdev->dev, "Could not get irq\n");
> -		return -ENODEV;
> +		if (irq != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Could not get irq\n");
> +		return irq;
>   	}
>   
>   	dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1721,12 +1722,13 @@ static int dcmi_probe(struct platform_device *pdev)
>   					dev_name(&pdev->dev), dcmi);
>   	if (ret) {
>   		dev_err(&pdev->dev, "Unable to request irq %d\n", irq);
> -		return -ENODEV;
> +		return ret;
>   	}
>   
>   	mclk = devm_clk_get(&pdev->dev, "mclk");
>   	if (IS_ERR(mclk)) {
> -		dev_err(&pdev->dev, "Unable to get mclk\n");
> +		if (PTR_ERR(mclk) != -EPROBE_DEFER)
> +			dev_err(&pdev->dev, "Unable to get mclk\n");
>   		return PTR_ERR(mclk);
>   	}
>   
> 

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

end of thread, other threads:[~2019-04-24 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 13:25 [PATCH] media: stm32-dcmi: return appropriate error codes during probe Fabien Dessenne
2019-04-24 15:58 ` Hugues FRUCHET

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).