Skip to contentSkip to conversation

mmc: Remove incorrect cmd->flags usage

PATCH New Andy Fleming 2 participants 3 messages Sep 6, 2012 – Sep 7, 2012 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: Remove incorrect cmd->flags usage

There were a couple of drivers that were actually using the flags field of the cmd structure, despite the fact that no one ever *set* that field. When we removed the field, those drivers failed to compile. Replaced the references with the correct usage of resp_type.

---
I've gone and applied this to the mmc repository, as it's more correct than the current implementation. I don't anticipate any problems, but the pl180 and pxa folks should make sure their drivers still work.

 drivers/mmc/arm_pl180_mmci.c |    2 +-
 drivers/mmc/pxa_mmc_gen.c    |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/arm_pl180_mmci.c +1 -1
index db2c7ab..af1380a 100644
@@ -52,7 +52,7 @@ static int wait_for_command_end(struct mmc *dev, struct mmc_cmd *cmd)
 		debug("CMD%d time out\n", cmd->cmdidx);
 		return TIMEOUT;
 	} else if ((hoststatus & SDI_STA_CCRCFAIL) &&
-		   (cmd->flags & MMC_RSP_CRC)) {
+		   (cmd->resp_type & MMC_RSP_CRC)) {
 		printf("CMD%d CRC error\n", cmd->cmdidx);
 		return -EILSEQ;
 	}
drivers/mmc/pxa_mmc_gen.c +5 -3
index 2c5bf17..b3ec441 100644
@@ -118,7 +118,7 @@ static int pxa_mmc_start_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
 	int ret;
 
 	/* The card can send a "busy" response */
-	if (cmd->flags & MMC_RSP_BUSY)
+	if (cmd->resp_type & MMC_RSP_BUSY)
 		cmdat |= MMC_CMDAT_BUSY;
 
 	/* Inform the controller about response type */
@@ -181,9 +181,11 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd)
 	/* The command response didn't arrive */
 	if (stat & MMC_STAT_TIME_OUT_RESPONSE)
 		return -ETIMEDOUT;
-	else if (stat & MMC_STAT_RES_CRC_ERROR && cmd->flags & MMC_RSP_CRC) {
+	else if (stat & MMC_STAT_RES_CRC_ERROR
+			&& cmd->resp_type & MMC_RSP_CRC) {
 #ifdef	PXAMMC_CRC_SKIP
-		if (cmd->flags & MMC_RSP_136 && cmd->response[0] & (1 << 31))
+		if (cmd->resp_type & MMC_RSP_136
+				&& cmd->response[0] & (1 << 31))
 			printf("Ignoring CRC, this may be dangerous!\n");
 		else
 #endif
Signature · 1 line
1.7.9.7
#1 lore raw

PATCH 1/1 mmc: Remove incorrect cmd->flags usage

Dear Andy Fleming,

Quoted 5 lines

There were a couple of drivers that were actually using the flags field of the cmd structure, despite the fact that no one ever *set* that field. When we removed the field, those drivers failed to compile. Replaced the references with the correct usage of resp_type.

I'll run duts tests on this on M28, stay tuned.

Quoted 41 lines

---
I've gone and applied this to the mmc repository, as it's more correct than the current implementation. I don't anticipate any problems, but the pl180 and pxa folks should make sure their drivers still work.

 drivers/mmc/arm_pl180_mmci.c |    2 +-
 drivers/mmc/pxa_mmc_gen.c    |    8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/arm_pl180_mmci.c +1 -1
index db2c7ab..af1380a 100644
@@ -52,7 +52,7 @@ static int wait_for_command_end(struct mmc *dev, struct
 mmc_cmd *cmd) debug("CMD%d time out\n", cmd->cmdidx);
 		return TIMEOUT;
 	} else if ((hoststatus & SDI_STA_CCRCFAIL) &&
-		   (cmd->flags & MMC_RSP_CRC)) {
+		   (cmd->resp_type & MMC_RSP_CRC)) {
 		printf("CMD%d CRC error\n", cmd->cmdidx);
 		return -EILSEQ;
 	}
drivers/mmc/pxa_mmc_gen.c +1 -1
index 2c5bf17..b3ec441 100644
@@ -118,7 +118,7 @@ static int pxa_mmc_start_cmd(struct mmc *mmc, struct
 mmc_cmd *cmd, int ret;
 
 	/* The card can send a "busy" response */
-	if (cmd->flags & MMC_RSP_BUSY)
+	if (cmd->resp_type & MMC_RSP_BUSY)
 		cmdat |= MMC_CMDAT_BUSY;
 
 	/* Inform the controller about response type */
@@ -181,9 +181,11 @@ static int pxa_mmc_cmd_done(struct mmc *mmc, struct

mmc_cmd *cmd) /* The command response didn't arrive */

drivers/mmc/pxa_mmc_gen.c +0 -0
 	if (stat & MMC_STAT_TIME_OUT_RESPONSE)
 		return -ETIMEDOUT;

drivers/mmc/pxa_mmc_gen.c static int pxa_mmc_cmd_done(struct mmc *mmc, struct mmc_cmd *cmd) · line 191

Quoted 10 lines
drivers/mmc/pxa_mmc_gen.c +4 -2
-	else if (stat & MMC_STAT_RES_CRC_ERROR && cmd->flags & MMC_RSP_CRC) {
+	else if (stat & MMC_STAT_RES_CRC_ERROR
+			&& cmd->resp_type & MMC_RSP_CRC) {
 #ifdef	PXAMMC_CRC_SKIP
-		if (cmd->flags & MMC_RSP_136 && cmd->response[0] & (1 << 31))
+		if (cmd->resp_type & MMC_RSP_136
+				&& cmd->response[0] & (1 << 31))
 			printf("Ignoring CRC, this may be dangerous!\n");
 		else
 #endif

Best regards,
Marek Vasut

#2 lore raw

PATCH 1/1 mmc: Remove incorrect cmd->flags usage

Dear Marek Vasut,

Quoted 9 lines

Dear Andy Fleming,

Quoted 5 lines

There were a couple of drivers that were actually using the flags field of the cmd structure, despite the fact that no one ever *set* that field. When we removed the field, those drivers failed to compile. Replaced the references with the correct usage of resp_type.

I'll run duts tests on this on M28, stay tuned.

[...]

Ok, seems to work on M28.

Best regards,
Marek Vasut