[PATCH 03/11] mmc: core: Rename and reorganize mmc_switch_status_error()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rename mmc_switch_status_error() to mmc_send_status_error(), and
add check_switch_err in order to prepare for using it for other
places.

No functional change intended.

Signed-off-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
---

 drivers/mmc/core/mmc_ops.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 4d73db4..6e8826e 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -411,18 +411,21 @@ int mmc_spi_set_crc(struct mmc_host *host, int use_crc)
 	return err;
 }
 
-static int mmc_switch_status_error(struct mmc_host *host, u32 status)
+static int mmc_send_status_error(struct mmc_host *host, u32 status,
+				 bool check_switch_err)
 {
-	if (mmc_host_is_spi(host)) {
-		if (status & R1_SPI_ILLEGAL_COMMAND)
-			return -EBADMSG;
-	} else {
+	if (check_switch_err) {
+		if (unlikely(mmc_host_is_spi(host)))
+			return (status & R1_SPI_ILLEGAL_COMMAND) ?
+				-EBADMSG : 0;
+
 		if (status & 0xFDFFA000)
 			pr_warn("%s: unexpected status %#x after switch\n",
 				mmc_hostname(host), status);
 		if (status & R1_SWITCH_ERROR)
 			return -EBADMSG;
 	}
+
 	return 0;
 }
 
@@ -438,7 +441,7 @@ int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal)
 	if (err)
 		return err;
 
-	return mmc_switch_status_error(card->host, status);
+	return mmc_send_status_error(card->host, status, true);
 }
 
 int mmc_switch_status(struct mmc_card *card)
@@ -493,7 +496,7 @@ static int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
 			} else if (err) {
 				return err;
 			} else {
-				err = mmc_switch_status_error(host, status);
+				err = mmc_send_status_error(host, status, true);
 				if (err)
 					return err;
 				busy = R1_CURRENT_STATE(status) == R1_STATE_PRG;
-- 
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux