Skip to contentSkip to conversation

fsl espi: Fix reading from device

PATCH New Dale P. Smith 1 participant 1 message Sep 26, 2012 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fsl espi: Fix reading from device

Return the actual bytes read from the device.

---
 drivers/spi/fsl_espi.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
drivers/spi/fsl_espi.c +2 -8
index a1ebd33..c0348db 100644
@@ -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;
Signature · 1 line
1.7.2.5