mxs_spi: Return proper timeout error
Subsystems (2)
Fabio Estevam
reviewerPATCH 1/1 mxs_spi: Return proper timeout error
Instead of returning -1, it is preferred to return -ETIMEDOUT in case of timeouts.
--- drivers/spi/mxs_spi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/spi/mxs_spi.c +3 -3
@@ -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 ; } }
Signature · 1 line
1.7.1
PATCH 1/1 mxs_spi: Return proper timeout error
Dear Fabio Estevam,
Quoted 31 lines
Instead of returning -1, it is preferred to return
-ETIMEDOUTin case of timeouts.Signed-off-by Fabio Estevam <[email protected]>--- drivers/spi/mxs_spi.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)drivers/spi/mxs_spi.c +2
-2@@ -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);
drivers/spi/mxs_spi.c int spi_xfer(struct spi_slave *slave, unsigned int · line 189
Quoted 7 lines
drivers/spi/mxs_spi.c +1
-1@@ -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 ; } }
Best regards,
Marek Vasut
PATCH 1/1 mxs_spi: Return proper timeout error
In reply to Fabio EstevamQuoted 2 lines · On Sunday 18 March 2012 23:23:35 Fabio Estevam wrote:
Instead of returning -1, it is preferred to return
-ETIMEDOUTin 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>
PATCH 1/1 mxs_spi: Return proper timeout error
Dear Mike Frysinger,
Quoted 6 lines · On Sunday 18 March 2012 23:23:35 Fabio Estevam wrote:
Quoted 2 lines
Instead of returning -1, it is preferred to return
-ETIMEDOUTin case of timeouts.the SPI API doesn't care
-mike
Yep, but returning symbolic value like this is more expressive.
Best regards,
Marek Vasut
PATCH 1/1 mxs_spi: Return proper timeout error
In reply to Fabio EstevamQuoted 4 lines · Fabio Estevam
Instead of returning -1, it is preferred to return
-ETIMEDOUTin case of timeouts.Signed-off-by Fabio Estevam <[email protected]>---
Applied to u-boot-imx, thanks
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== 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 =====================================================================