mmc_spi: fail gracefully if host or card do not support the switch command
authorWolfgang Muees <wolfgang.mues@auerswald.de>
Tue, 22 Sep 2009 23:45:26 +0000 (16:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:37 +0000 (07:39 -0700)
commitd08ebeddfb3293fa4bdfca9c610daf1e8ec8b233
treea7e9862dbbd21b5fcab805040bc11cf88b1aacb2
parent82cf818d54f0a415a031eabd0949a81946445198
mmc_spi: fail gracefully if host or card do not support the switch command

Some time ago, I have send a patch to the mmc_spi subsystem changing the
error codes.  This was after a discussion with Pierre about using EINVAL
only for non-recoverable errors.  This patch was accepted as

http://git.kernel.org/linus/fdd858db7113ca64132de390188d7ca00701013d

Unfortunately, several weeks later, I realized that this patch has opened
a little can of worms because there are SD cards on the market which

a) claim that they support the switch command
AND
b) refuse to execute this command if operating in SPI mode.

So, such a card would get unusuable in an embedded linux system in SPI
mode, because the init sequence terminates with an error.

This patch adds the missing error codes to the caller of the switch
command and restores the old behaviour to fail gracefully if these
commands can not execute.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Cc: <linux-mmc@vger.kernel.org>
Cc: <stable@kernel.org> [2.6.31.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c