[PATCH 09/11] mmc: core: Distinguish the caller of mmc_poll_for_busy() by new paramter

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

 



Add new flag, poll_for_switch, to tell mmc_send_status_error() how
to translate the device status into return code.

No functional change intended.

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

 drivers/mmc/core/mmc_ops.c | 9 ++++++---
 drivers/mmc/core/mmc_ops.h | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index e0592f0..3a7e59b 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -432,6 +432,8 @@ static int mmc_send_status_error(struct mmc_host *host, u32 status,
 				mmc_hostname(host), status);
 		if (status & R1_SWITCH_ERROR)
 			return -EBADMSG;
+	} else {
+		return R1_STATUS(status) ? -EIO : 0;
 	}
 
 	return 0;
@@ -459,7 +461,7 @@ int mmc_switch_status(struct mmc_card *card)
 
 int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
 		      bool send_status, bool retry_crc_err, bool use_r1b_resp,
-		      unsigned int retries)
+		      unsigned int retries, bool poll_for_switch)
 {
 	struct mmc_host *host = card->host;
 	int err;
@@ -504,7 +506,8 @@ int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
 			} else if (err) {
 				return err;
 			} else {
-				err = mmc_send_status_error(host, status, true);
+				err = mmc_send_status_error(host, status,
+						poll_for_switch);
 				if (err)
 					return err;
 				busy = R1_CURRENT_STATE(status) == R1_STATE_PRG
@@ -592,7 +595,7 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
 
 	/* Let's try to poll to find out when the command is completed. */
 	err = mmc_poll_for_busy(card, timeout_ms, send_status, retry_crc_err,
-				use_r1b_resp, MMC_CMD_RETRIES);
+				use_r1b_resp, MMC_CMD_RETRIES, true);
 	if (err)
 		goto out;
 
diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h
index 2e2c229..922835a 100644
--- a/drivers/mmc/core/mmc_ops.h
+++ b/drivers/mmc/core/mmc_ops.h
@@ -35,7 +35,7 @@
 int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);
 int mmc_poll_for_busy(struct mmc_card *card, unsigned int timeout_ms,
 		      bool send_status, bool retry_crc_err, bool use_r1b_resp,
-		      unsigned int retries);
+		      unsigned int retries, bool poll_for_switch);
 int mmc_switch_status(struct mmc_card *card);
 int __mmc_switch_status(struct mmc_card *card, bool crc_err_fatal);
 int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value,
-- 
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