Skip to contentSkip to conversation

spi: atmel: Make current_remaining_bytes to be int

PATCH Applied Axel Lin 2 participants 2 messages Mar 27, 2014 – Apr 1, 2014

Subsystems (3)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/spi/spi-atmel.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-atmel.c +3 -1
index 8005f98..485e6cc 100644
@@ -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);
Signature · 8 lines
1.8.3.2



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Applied
#1 lore raw
Quoted 3 lines · Axel Lin

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.

Applied, thanks.