linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 1/3] mmc: core: Remove some redundant validations in mmc_erase() function
@ 2016-09-06  2:55 Baolin Wang
  2016-09-06  2:55 ` [PATCH v4 2/3] mmc: core: Factor out the alignment of erase size Baolin Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Baolin Wang @ 2016-09-06  2:55 UTC (permalink / raw)
  To: ulf.hansson
  Cc: adrian.hunter, rmk+kernel, shawn.lin, dianders, heiko, david,
	hdegoede, linux-mmc, linux-kernel, broonie, linus.walleij,
	baolin.wang

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@linaro.org>
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
---
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-09-06 12:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-06  2:55 [PATCH v4 1/3] mmc: core: Remove some redundant validations in mmc_erase() function Baolin Wang
2016-09-06  2:55 ` [PATCH v4 2/3] mmc: core: Factor out the alignment of erase size Baolin Wang
2016-09-06  4:34   ` Andreas Mohr
2016-09-06  6:26     ` Baolin Wang
2016-09-06  7:19       ` Andreas Mohr
2016-09-06  8:25         ` Baolin Wang
2016-09-06  7:52       ` Adrian Hunter
2016-09-06  8:27         ` Baolin Wang
2016-09-06  2:55 ` [PATCH v4 3/3] mmc: core: Optimize the mmc erase size alignment Baolin Wang
2016-09-06 12:17 ` [PATCH v4 1/3] mmc: core: Remove some redundant validations in mmc_erase() function Ulf Hansson
2016-09-06 12:35   ` Baolin Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).