Skip to contentSkip to conversation

mmc: core: Assemble the codes of related to eMMC4.5

PATCH RESEND In review Seungwon Jeon 2 participants 2 messages Oct 25, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 mmc: core: Assemble the codes of related to eMMC4.5

Code cleanup. The codes of related to eMMC4.5 are scattered. This patch removes one if-statement and assembles all. And it also removes variable initialization below else-statement. It is obvious for previous version but seems unnecessary. All members of card structure are already set to zero at card-init.

---
 drivers/mmc/core/mmc.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)
drivers/mmc/core/mmc.c +9 -11
index 6354eb3..6354bac 100644
@@ -467,29 +467,27 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 		card->ext_csd.rst_n_function = ext_csd[EXT_CSD_RST_N_FUNCTION];
 	}
 
-	/* eMMC v4.5 or later */
-	if (card->ext_csd.rev >= 6)
-		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
-
 	card->ext_csd.raw_erased_mem_count = ext_csd[EXT_CSD_ERASED_MEM_CONT];
 	if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
 		card->erased_byte = 0xFF;
 	else
 		card->erased_byte = 0x0;
 
+	/* eMMC v4.5 or later */
 	if (card->ext_csd.rev >= 6) {
+		card->ext_csd.feature_support |= MMC_DISCARD_FEATURE;
+
 		card->ext_csd.generic_cmd6_time = 10 *
 			ext_csd[EXT_CSD_GENERIC_CMD6_TIME];
 		card->ext_csd.power_off_longtime = 10 *
 			ext_csd[EXT_CSD_POWER_OFF_LONG_TIME];
-	} else
-		card->ext_csd.generic_cmd6_time = 0;
 
-	card->ext_csd.cache_size =
-		ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
-		ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
+		card->ext_csd.cache_size =
+			ext_csd[EXT_CSD_CACHE_SIZE + 0] << 0 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 1] << 8 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 2] << 16 |
+			ext_csd[EXT_CSD_CACHE_SIZE + 3] << 24;
+	}
 
 out:
 	return err;

--
1.7.0.4

#1 lore raw

Hi,

Quoted 7 lines · Seungwon Jeon

Code cleanup. The codes of related to eMMC4.5 are scattered. This patch removes one if-statement and assembles all. And it also removes variable initialization below else-statement. It is obvious for previous version but seems unnecessary. All members of card structure are already set to zero at card-init.

Thanks, pushed to mmc-next for 3.2.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child