Patchwork [U-Boot] fsl espi: Fix reading from device

login
register
mail settings
Submitter Dale P. Smith
Date Sept. 26, 2012, 10:46 p.m.
Message ID <1348699580-4805-1-git-send-email-dsmith@vtiinstruments.com>
Download mbox | patch
Permalink /patch/187272/
State Rejected
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Dale P. Smith - Sept. 26, 2012, 10:46 p.m.
Return the actual bytes read from the device.
---
 drivers/spi/fsl_espi.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

Patch

diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index a1ebd33..c0348db 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -291,16 +291,10 @@  int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
 				debug("***spi_xfer:...%08x readed\n", tmpdin);
 			}
 		}
-		if (data_in) {
-			memcpy(data_in, buffer + 2 * cmd_len, tran_len);
-			if (*buffer == 0x0b) {
-				data_in += tran_len;
-				data_len -= tran_len;
-				*(int *)buffer += tran_len;
-			}
-		}
 		spi_cs_deactivate(slave);
 	}
+	if (data_in)
+		memcpy(data_in, buffer + rx_offset, len);
 
 	free(buffer);
 	return 0;