public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mxs_spi: Return proper timeout error
@ 2012-03-19  3:23 Fabio Estevam
  2012-03-19  3:40 ` Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Fabio Estevam @ 2012-03-19  3:23 UTC (permalink / raw)
  To: u-boot

Instead of returning -1, it is preferred to return -ETIMEDOUT in case of timeouts.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/spi/mxs_spi.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index adb9ca8..4e6f14e 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -162,7 +162,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 		if (mx28_wait_mask_set(&ssp_regs->hw_ssp_ctrl0_reg,
 			SSP_CTRL0_RUN, MXS_SPI_MAX_TIMEOUT)) {
 			printf("MXS SPI: Timeout waiting for start\n");
-			return -1;
+			return -ETIMEDOUT;
 		}
 
 		if (tx)
@@ -174,7 +174,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 			if (mx28_wait_mask_clr(&ssp_regs->hw_ssp_status_reg,
 				SSP_STATUS_FIFO_EMPTY, MXS_SPI_MAX_TIMEOUT)) {
 				printf("MXS SPI: Timeout waiting for data\n");
-				return -1;
+				return -ETIMEDOUT;
 			}
 
 			*rx = readl(&ssp_regs->hw_ssp_data);
@@ -184,7 +184,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
 		if (mx28_wait_mask_clr(&ssp_regs->hw_ssp_ctrl0_reg,
 			SSP_CTRL0_RUN, MXS_SPI_MAX_TIMEOUT)) {
 			printf("MXS SPI: Timeout waiting for finish\n");
-			return -1;
+			return -ETIMEDOUT;
 		}
 	}
 
-- 
1.7.1

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

* [U-Boot] [PATCH] mxs_spi: Return proper timeout error
  2012-03-19  3:23 [U-Boot] [PATCH] mxs_spi: Return proper timeout error Fabio Estevam
@ 2012-03-19  3:40 ` Marek Vasut
  2012-03-19  3:43 ` Mike Frysinger
  2012-03-20  8:00 ` Stefano Babic
  2 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2012-03-19  3:40 UTC (permalink / raw)
  To: u-boot

Dear Fabio Estevam,

> Instead of returning -1, it is preferred to return -ETIMEDOUT in case of
> timeouts.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/spi/mxs_spi.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
> index adb9ca8..4e6f14e 100644
> --- a/drivers/spi/mxs_spi.c
> +++ b/drivers/spi/mxs_spi.c
> @@ -162,7 +162,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int
> bitlen, if (mx28_wait_mask_set(&ssp_regs->hw_ssp_ctrl0_reg,
>  			SSP_CTRL0_RUN, MXS_SPI_MAX_TIMEOUT)) {
>  			printf("MXS SPI: Timeout waiting for start\n");
> -			return -1;
> +			return -ETIMEDOUT;
>  		}
> 
>  		if (tx)
> @@ -174,7 +174,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int
> bitlen, if (mx28_wait_mask_clr(&ssp_regs->hw_ssp_status_reg,
>  				SSP_STATUS_FIFO_EMPTY, MXS_SPI_MAX_TIMEOUT)) {
>  				printf("MXS SPI: Timeout waiting for data\n");
> -				return -1;
> +				return -ETIMEDOUT;
>  			}
> 
>  			*rx = readl(&ssp_regs->hw_ssp_data);
> @@ -184,7 +184,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int
> bitlen, if (mx28_wait_mask_clr(&ssp_regs->hw_ssp_ctrl0_reg,
>  			SSP_CTRL0_RUN, MXS_SPI_MAX_TIMEOUT)) {
>  			printf("MXS SPI: Timeout waiting for finish\n");
> -			return -1;
> +			return -ETIMEDOUT;
>  		}
>  	}

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] mxs_spi: Return proper timeout error
  2012-03-19  3:23 [U-Boot] [PATCH] mxs_spi: Return proper timeout error Fabio Estevam
  2012-03-19  3:40 ` Marek Vasut
@ 2012-03-19  3:43 ` Mike Frysinger
  2012-03-19  3:48   ` Marek Vasut
  2012-03-20  8:00 ` Stefano Babic
  2 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2012-03-19  3:43 UTC (permalink / raw)
  To: u-boot

On Sunday 18 March 2012 23:23:35 Fabio Estevam wrote:
> Instead of returning -1, it is preferred to return -ETIMEDOUT in case of
> timeouts.

the SPI API doesn't care
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120318/97fd7955/attachment.pgp>

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

* [U-Boot] [PATCH] mxs_spi: Return proper timeout error
  2012-03-19  3:43 ` Mike Frysinger
@ 2012-03-19  3:48   ` Marek Vasut
  0 siblings, 0 replies; 5+ messages in thread
From: Marek Vasut @ 2012-03-19  3:48 UTC (permalink / raw)
  To: u-boot

Dear Mike Frysinger,

> On Sunday 18 March 2012 23:23:35 Fabio Estevam wrote:
> > Instead of returning -1, it is preferred to return -ETIMEDOUT in case of
> > timeouts.
> 
> the SPI API doesn't care
> -mike

Yep, but returning symbolic value like this is more expressive.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] mxs_spi: Return proper timeout error
  2012-03-19  3:23 [U-Boot] [PATCH] mxs_spi: Return proper timeout error Fabio Estevam
  2012-03-19  3:40 ` Marek Vasut
  2012-03-19  3:43 ` Mike Frysinger
@ 2012-03-20  8:00 ` Stefano Babic
  2 siblings, 0 replies; 5+ messages in thread
From: Stefano Babic @ 2012-03-20  8:00 UTC (permalink / raw)
  To: u-boot

On 19/03/2012 04:23, Fabio Estevam wrote:
> Instead of returning -1, it is preferred to return -ETIMEDOUT in case of timeouts.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---

Applied to u-boot-imx, thanks

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

end of thread, other threads:[~2012-03-20  8:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-19  3:23 [U-Boot] [PATCH] mxs_spi: Return proper timeout error Fabio Estevam
2012-03-19  3:40 ` Marek Vasut
2012-03-19  3:43 ` Mike Frysinger
2012-03-19  3:48   ` Marek Vasut
2012-03-20  8:00 ` Stefano Babic

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