[PATCH v4 1/3] mmc: core: Remove some redundant validations in mmc_erase() function
From: Baolin Wang
Date: Mon Sep 05 2016 - 22:58:59 EST
Before issuing mmc_erase() function, users always have checked if it can
erase with mmc_can_erase/trim/discard() function, thus remove the redundant
erase checking in mmc_erase() function.
Signed-off-by: Baolin Wang <baolin.wang@xxxxxxxxxx>
Tested-by: Shawn Lin <shawn.lin@xxxxxxxxxxxxxx>
---
Changes since v3:
- Split into 3 separate patches.
- Add test tag by Shawn.
Changes since v2:
- Add nr checking and other optimization in mmc_erase() function.
Changes since v1:
- Add the alignment if card->erase_size is not power of 2.
---
drivers/mmc/core/core.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index e55cde6..7d7209d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2217,13 +2217,6 @@ int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
unsigned int rem, to = from + nr;
int err;
- if (!(card->host->caps & MMC_CAP_ERASE) ||
- !(card->csd.cmdclass & CCC_ERASE))
- return -EOPNOTSUPP;
-
- if (!card->erase_size)
- return -EOPNOTSUPP;
-
if (mmc_card_sd(card) && arg != MMC_ERASE_ARG)
return -EOPNOTSUPP;
--
1.7.9.5