diff options
Diffstat (limited to 'drivers/spi/spi-atmel.c')
-rw-r--r-- | drivers/spi/spi-atmel.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 079e6b1b0cdb..92a6f0d93233 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -224,7 +224,7 @@ struct atmel_spi { | |||
224 | struct platform_device *pdev; | 224 | struct platform_device *pdev; |
225 | 225 | ||
226 | struct spi_transfer *current_transfer; | 226 | struct spi_transfer *current_transfer; |
227 | unsigned long current_remaining_bytes; | 227 | int current_remaining_bytes; |
228 | int done_status; | 228 | int done_status; |
229 | 229 | ||
230 | struct completion xfer_completion; | 230 | struct completion xfer_completion; |
@@ -874,8 +874,9 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer) | |||
874 | spi_readl(as, RDR); | 874 | spi_readl(as, RDR); |
875 | } | 875 | } |
876 | if (xfer->bits_per_word > 8) { | 876 | if (xfer->bits_per_word > 8) { |
877 | as->current_remaining_bytes -= 2; | 877 | if (as->current_remaining_bytes > 2) |
878 | if (as->current_remaining_bytes < 0) | 878 | as->current_remaining_bytes -= 2; |
879 | else | ||
879 | as->current_remaining_bytes = 0; | 880 | as->current_remaining_bytes = 0; |
880 | } else { | 881 | } else { |
881 | as->current_remaining_bytes--; | 882 | as->current_remaining_bytes--; |
@@ -1110,6 +1111,8 @@ static int atmel_spi_one_transfer(struct spi_master *master, | |||
1110 | atmel_spi_next_xfer_pio(master, xfer); | 1111 | atmel_spi_next_xfer_pio(master, xfer); |
1111 | } else { | 1112 | } else { |
1112 | as->current_remaining_bytes -= len; | 1113 | as->current_remaining_bytes -= len; |
1114 | if (as->current_remaining_bytes < 0) | ||
1115 | as->current_remaining_bytes = 0; | ||
1113 | } | 1116 | } |
1114 | } else { | 1117 | } else { |
1115 | atmel_spi_next_xfer_pio(master, xfer); | 1118 | atmel_spi_next_xfer_pio(master, xfer); |