mxs_spi: Return proper timeout error
authorFabio Estevam <festevam@gmail.com>
Sun, 18 Mar 2012 17:23:35 +0000 (17:23 +0000)
committerStefano Babic <sbabic@denx.de>
Tue, 27 Mar 2012 07:41:16 +0000 (09:41 +0200)
Instead of returning -1, it is preferred to return -ETIMEDOUT in case of timeouts.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Marek Vasut <marex@denx.de>
drivers/spi/mxs_spi.c

index adb9ca8ec8f92e7adc7c924aa8e5bba7bc2e4dad..4e6f14ee0722d102b2db33cdcb67ff1c02a1c272 100644 (file)
@@ -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;
                }
        }