The patch titled mmc_spi: use EILSEQ for possible transmission errors has been added to the -mm tree. Its filename is mmc_spi-use-eilseq-for-possible-transmission-errors.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: mmc_spi: use EILSEQ for possible transmission errors From: Wolfgang Muees <wolfgang.mues@xxxxxxxxxxxx> Change the reported error code for the responses to a command from EINVAL/EIO to EILSEQ, as EINVAL is reserved for non-recoverable host errors, and the responses from the SD/MMC card may be because of recoverable transmission errors in the command or in the response. Response codes are NOT protected by a checksum, so don't trust them. Signed-off-by: Wolfgang Muees <wolfgang.mues@xxxxxxxxxxxx> Cc: Matt Fleming <matt@xxxxxxxxxxxxxxxxx> Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx> Cc: Mike Frysinger <vapier.adi@xxxxxxxxx> Cc: Pierre Ossman <drzeus@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/mmc/host/mmc_spi.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff -puN drivers/mmc/host/mmc_spi.c~mmc_spi-use-eilseq-for-possible-transmission-errors drivers/mmc/host/mmc_spi.c --- a/drivers/mmc/host/mmc_spi.c~mmc_spi-use-eilseq-for-possible-transmission-errors +++ a/drivers/mmc/host/mmc_spi.c @@ -334,17 +334,18 @@ checkstatus: cmd->error = 0; /* Status byte: the entire seven-bit R1 response. */ - if (cmd->resp[0] != 0) { - if ((R1_SPI_PARAMETER | R1_SPI_ADDRESS - | R1_SPI_ILLEGAL_COMMAND) - & cmd->resp[0]) - value = -EINVAL; - else if (R1_SPI_COM_CRC & cmd->resp[0]) - value = -EILSEQ; - else if ((R1_SPI_ERASE_SEQ | R1_SPI_ERASE_RESET) - & cmd->resp[0]) - value = -EIO; - /* else R1_SPI_IDLE, "it's resetting" */ + /* + * Note that we have a problem here: as the response is NOT protected + * by a CRC or checksum, a transmission error in the response will + * be interpreted as an error code. So we map all error codes to + * EILSEQ here, to allow for the upper layer to retry the command. + * If one of these error codes is a non-recoverable error, retries + * will do no harm. + */ + + /* Allow only 0 and R1_SPI_IDLE here */ + if (cmd->resp[0] & ~R1_SPI_IDLE) { + value = -EILSEQ; } switch (mmc_spi_resp_type(cmd)) { _ Patches currently in -mm which might be from wolfgang.mues@xxxxxxxxxxxx are linux-next.patch mmc_spi-use-eilseq-for-possible-transmission-errors.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html