summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-atmel.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-03-27 09:26:38 +0800
committerMark Brown <broonie@linaro.org>2014-04-14 17:06:17 +0100
commit0c3b97487d15a452f1fa7bfd9b6f1bd1a31d538d (patch)
tree4c5f3bfc546c5ddbf29073b3b5ad525a2f6a9d39 /drivers/spi/spi-atmel.c
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
spi: atmel: Make current_remaining_bytes to be int
Don't use unsigned for current_remaining_bytes so we can check current_remaining_bytes < 0 case. Use int is enough for current_remaining_bytes. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi-atmel.c')
-rw-r--r--drivers/spi/spi-atmel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 8005f9869481..485e6cce94bf 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -224,7 +224,7 @@ struct atmel_spi {
struct platform_device *pdev;
struct spi_transfer *current_transfer;
- unsigned long current_remaining_bytes;
+ int current_remaining_bytes;
int done_status;
struct completion xfer_completion;
@@ -1110,6 +1110,8 @@ static int atmel_spi_one_transfer(struct spi_master *master,
atmel_spi_next_xfer_pio(master, xfer);
} else {
as->current_remaining_bytes -= len;
+ if (as->current_remaining_bytes < 0)
+ as->current_remaining_bytes = 0;
}
} else {
atmel_spi_next_xfer_pio(master, xfer);