All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER
@ 2021-02-04 12:13 Luca Ceresoli
  2021-02-04 13:05 ` Michal Simek
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luca Ceresoli @ 2021-02-04 12:13 UTC (permalink / raw)
  To: linux-fpga
  Cc: Moritz Fischer, Tom Rix, Michal Simek, Alan Tull,
	Anatolij Gustschin, linux-kernel, Luca Ceresoli

The current code produces an error message on devm_gpiod_get() errors even
when the error is -EPROBE_DEFER, which should be silent.

This has been observed producing a significant amount of messages like:

    xlnx-slave-spi spi1.1: Failed to get PROGRAM_B gpio: -517

Fix and simplify code by using the dev_err_probe() helper function.

Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
Fixes: dd2784c01d93 ("fpga manager: xilinx-spi: check INIT_B pin during write_init")
Fixes: 061c97d13f1a ("fpga manager: Add Xilinx slave serial SPI driver")
---
 drivers/fpga/xilinx-spi.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
index 27defa98092d..fee4d0abf6bf 100644
--- a/drivers/fpga/xilinx-spi.c
+++ b/drivers/fpga/xilinx-spi.c
@@ -233,25 +233,19 @@ static int xilinx_spi_probe(struct spi_device *spi)
 
 	/* PROGRAM_B is active low */
 	conf->prog_b = devm_gpiod_get(&spi->dev, "prog_b", GPIOD_OUT_LOW);
-	if (IS_ERR(conf->prog_b)) {
-		dev_err(&spi->dev, "Failed to get PROGRAM_B gpio: %ld\n",
-			PTR_ERR(conf->prog_b));
-		return PTR_ERR(conf->prog_b);
-	}
+	if (IS_ERR(conf->prog_b))
+		return dev_err_probe(&spi->dev, PTR_ERR(conf->prog_b),
+				     "Failed to get PROGRAM_B gpio\n");
 
 	conf->init_b = devm_gpiod_get_optional(&spi->dev, "init-b", GPIOD_IN);
-	if (IS_ERR(conf->init_b)) {
-		dev_err(&spi->dev, "Failed to get INIT_B gpio: %ld\n",
-			PTR_ERR(conf->init_b));
-		return PTR_ERR(conf->init_b);
-	}
+	if (IS_ERR(conf->init_b))
+		return dev_err_probe(&spi->dev, PTR_ERR(conf->init_b),
+				     "Failed to get INIT_B gpio\n");
 
 	conf->done = devm_gpiod_get(&spi->dev, "done", GPIOD_IN);
-	if (IS_ERR(conf->done)) {
-		dev_err(&spi->dev, "Failed to get DONE gpio: %ld\n",
-			PTR_ERR(conf->done));
-		return PTR_ERR(conf->done);
-	}
+	if (IS_ERR(conf->done))
+		return dev_err_probe(&spi->dev, PTR_ERR(conf->done),
+				     "Failed to get DONE gpio\n");
 
 	mgr = devm_fpga_mgr_create(&spi->dev,
 				   "Xilinx Slave Serial FPGA Manager",
-- 
2.30.0


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

* Re: [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER
  2021-02-04 12:13 [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER Luca Ceresoli
@ 2021-02-04 13:05 ` Michal Simek
  2021-02-06 20:33 ` Moritz Fischer
  2021-03-06 15:40 ` Moritz Fischer
  2 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2021-02-04 13:05 UTC (permalink / raw)
  To: Luca Ceresoli, linux-fpga
  Cc: Moritz Fischer, Tom Rix, Michal Simek, Alan Tull,
	Anatolij Gustschin, linux-kernel

Hi,

On 2/4/21 1:13 PM, Luca Ceresoli wrote:
> The current code produces an error message on devm_gpiod_get() errors even
> when the error is -EPROBE_DEFER, which should be silent.
> 
> This has been observed producing a significant amount of messages like:
> 
>     xlnx-slave-spi spi1.1: Failed to get PROGRAM_B gpio: -517
> 
> Fix and simplify code by using the dev_err_probe() helper function.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Fixes: dd2784c01d93 ("fpga manager: xilinx-spi: check INIT_B pin during write_init")
> Fixes: 061c97d13f1a ("fpga manager: Add Xilinx slave serial SPI driver")
> ---
>  drivers/fpga/xilinx-spi.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
> index 27defa98092d..fee4d0abf6bf 100644
> --- a/drivers/fpga/xilinx-spi.c
> +++ b/drivers/fpga/xilinx-spi.c
> @@ -233,25 +233,19 @@ static int xilinx_spi_probe(struct spi_device *spi)
>  
>  	/* PROGRAM_B is active low */
>  	conf->prog_b = devm_gpiod_get(&spi->dev, "prog_b", GPIOD_OUT_LOW);
> -	if (IS_ERR(conf->prog_b)) {
> -		dev_err(&spi->dev, "Failed to get PROGRAM_B gpio: %ld\n",
> -			PTR_ERR(conf->prog_b));
> -		return PTR_ERR(conf->prog_b);
> -	}
> +	if (IS_ERR(conf->prog_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->prog_b),
> +				     "Failed to get PROGRAM_B gpio\n");
>  
>  	conf->init_b = devm_gpiod_get_optional(&spi->dev, "init-b", GPIOD_IN);
> -	if (IS_ERR(conf->init_b)) {
> -		dev_err(&spi->dev, "Failed to get INIT_B gpio: %ld\n",
> -			PTR_ERR(conf->init_b));
> -		return PTR_ERR(conf->init_b);
> -	}
> +	if (IS_ERR(conf->init_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->init_b),
> +				     "Failed to get INIT_B gpio\n");
>  
>  	conf->done = devm_gpiod_get(&spi->dev, "done", GPIOD_IN);
> -	if (IS_ERR(conf->done)) {
> -		dev_err(&spi->dev, "Failed to get DONE gpio: %ld\n",
> -			PTR_ERR(conf->done));
> -		return PTR_ERR(conf->done);
> -	}
> +	if (IS_ERR(conf->done))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->done),
> +				     "Failed to get DONE gpio\n");
>  
>  	mgr = devm_fpga_mgr_create(&spi->dev,
>  				   "Xilinx Slave Serial FPGA Manager",
> 

Acked-by: Michal Simek <michal.simek@xilinx.com>

Thanks,
Michal

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

* Re: [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER
  2021-02-04 12:13 [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER Luca Ceresoli
  2021-02-04 13:05 ` Michal Simek
@ 2021-02-06 20:33 ` Moritz Fischer
  2021-03-06 15:40 ` Moritz Fischer
  2 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2021-02-06 20:33 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: linux-fpga, Moritz Fischer, Tom Rix, Michal Simek, Alan Tull,
	Anatolij Gustschin, linux-kernel

On Thu, Feb 04, 2021 at 01:13:13PM +0100, Luca Ceresoli wrote:
> The current code produces an error message on devm_gpiod_get() errors even
> when the error is -EPROBE_DEFER, which should be silent.
> 
> This has been observed producing a significant amount of messages like:
> 
>     xlnx-slave-spi spi1.1: Failed to get PROGRAM_B gpio: -517
> 
> Fix and simplify code by using the dev_err_probe() helper function.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Fixes: dd2784c01d93 ("fpga manager: xilinx-spi: check INIT_B pin during write_init")
> Fixes: 061c97d13f1a ("fpga manager: Add Xilinx slave serial SPI driver")
> ---
>  drivers/fpga/xilinx-spi.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
> index 27defa98092d..fee4d0abf6bf 100644
> --- a/drivers/fpga/xilinx-spi.c
> +++ b/drivers/fpga/xilinx-spi.c
> @@ -233,25 +233,19 @@ static int xilinx_spi_probe(struct spi_device *spi)
>  
>  	/* PROGRAM_B is active low */
>  	conf->prog_b = devm_gpiod_get(&spi->dev, "prog_b", GPIOD_OUT_LOW);
> -	if (IS_ERR(conf->prog_b)) {
> -		dev_err(&spi->dev, "Failed to get PROGRAM_B gpio: %ld\n",
> -			PTR_ERR(conf->prog_b));
> -		return PTR_ERR(conf->prog_b);
> -	}
> +	if (IS_ERR(conf->prog_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->prog_b),
> +				     "Failed to get PROGRAM_B gpio\n");
>  
>  	conf->init_b = devm_gpiod_get_optional(&spi->dev, "init-b", GPIOD_IN);
> -	if (IS_ERR(conf->init_b)) {
> -		dev_err(&spi->dev, "Failed to get INIT_B gpio: %ld\n",
> -			PTR_ERR(conf->init_b));
> -		return PTR_ERR(conf->init_b);
> -	}
> +	if (IS_ERR(conf->init_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->init_b),
> +				     "Failed to get INIT_B gpio\n");
>  
>  	conf->done = devm_gpiod_get(&spi->dev, "done", GPIOD_IN);
> -	if (IS_ERR(conf->done)) {
> -		dev_err(&spi->dev, "Failed to get DONE gpio: %ld\n",
> -			PTR_ERR(conf->done));
> -		return PTR_ERR(conf->done);
> -	}
> +	if (IS_ERR(conf->done))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->done),
> +				     "Failed to get DONE gpio\n");
>  
>  	mgr = devm_fpga_mgr_create(&spi->dev,
>  				   "Xilinx Slave Serial FPGA Manager",
> -- 
> 2.30.0
> 
Looks good, will queue.

- Moritz

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

* Re: [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER
  2021-02-04 12:13 [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER Luca Ceresoli
  2021-02-04 13:05 ` Michal Simek
  2021-02-06 20:33 ` Moritz Fischer
@ 2021-03-06 15:40 ` Moritz Fischer
  2 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2021-03-06 15:40 UTC (permalink / raw)
  To: Luca Ceresoli
  Cc: linux-fpga, Moritz Fischer, Tom Rix, Michal Simek, Alan Tull,
	Anatolij Gustschin, linux-kernel

On Thu, Feb 04, 2021 at 01:13:13PM +0100, Luca Ceresoli wrote:
> The current code produces an error message on devm_gpiod_get() errors even
> when the error is -EPROBE_DEFER, which should be silent.
> 
> This has been observed producing a significant amount of messages like:
> 
>     xlnx-slave-spi spi1.1: Failed to get PROGRAM_B gpio: -517
> 
> Fix and simplify code by using the dev_err_probe() helper function.
> 
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Fixes: dd2784c01d93 ("fpga manager: xilinx-spi: check INIT_B pin during write_init")
> Fixes: 061c97d13f1a ("fpga manager: Add Xilinx slave serial SPI driver")
> ---
>  drivers/fpga/xilinx-spi.c | 24 +++++++++---------------
>  1 file changed, 9 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
> index 27defa98092d..fee4d0abf6bf 100644
> --- a/drivers/fpga/xilinx-spi.c
> +++ b/drivers/fpga/xilinx-spi.c
> @@ -233,25 +233,19 @@ static int xilinx_spi_probe(struct spi_device *spi)
>  
>  	/* PROGRAM_B is active low */
>  	conf->prog_b = devm_gpiod_get(&spi->dev, "prog_b", GPIOD_OUT_LOW);
> -	if (IS_ERR(conf->prog_b)) {
> -		dev_err(&spi->dev, "Failed to get PROGRAM_B gpio: %ld\n",
> -			PTR_ERR(conf->prog_b));
> -		return PTR_ERR(conf->prog_b);
> -	}
> +	if (IS_ERR(conf->prog_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->prog_b),
> +				     "Failed to get PROGRAM_B gpio\n");
>  
>  	conf->init_b = devm_gpiod_get_optional(&spi->dev, "init-b", GPIOD_IN);
> -	if (IS_ERR(conf->init_b)) {
> -		dev_err(&spi->dev, "Failed to get INIT_B gpio: %ld\n",
> -			PTR_ERR(conf->init_b));
> -		return PTR_ERR(conf->init_b);
> -	}
> +	if (IS_ERR(conf->init_b))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->init_b),
> +				     "Failed to get INIT_B gpio\n");
>  
>  	conf->done = devm_gpiod_get(&spi->dev, "done", GPIOD_IN);
> -	if (IS_ERR(conf->done)) {
> -		dev_err(&spi->dev, "Failed to get DONE gpio: %ld\n",
> -			PTR_ERR(conf->done));
> -		return PTR_ERR(conf->done);
> -	}
> +	if (IS_ERR(conf->done))
> +		return dev_err_probe(&spi->dev, PTR_ERR(conf->done),
> +				     "Failed to get DONE gpio\n");
>  
>  	mgr = devm_fpga_mgr_create(&spi->dev,
>  				   "Xilinx Slave Serial FPGA Manager",
> -- 
> 2.30.0
> 

Applied to for-5.13,

- Moritz

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

end of thread, other threads:[~2021-03-06 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-04 12:13 [PATCH] fpga: fpga-mgr: xilinx-spi: fix error messages on -EPROBE_DEFER Luca Ceresoli
2021-02-04 13:05 ` Michal Simek
2021-02-06 20:33 ` Moritz Fischer
2021-03-06 15:40 ` Moritz Fischer

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.