Skip to content

Commit

Permalink
mmc: core: Enable erase/discard/trim support for all mmc hosts
Browse files Browse the repository at this point in the history
Step by step, mmc host drivers and the mmc core have been improved in
regards to support erase/discard/trim operations. We have now reached a
point when it no longer seems reasonable to use an opt-in approach to
enable the functionality. Therefore, let's switch to make the operations
always supported.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://lore.kernel.org/r/20200508112853.23525-1-ulf.hansson@linaro.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
storulf committed May 28, 2020
1 parent 04f2f45 commit 94fe258
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/mmc/core/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1815,8 +1815,7 @@ 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))
if (!(card->csd.cmdclass & CCC_ERASE))
return -EOPNOTSUPP;

if (!card->erase_size)
Expand Down Expand Up @@ -1872,8 +1871,7 @@ EXPORT_SYMBOL(mmc_erase);

int mmc_can_erase(struct mmc_card *card)
{
if ((card->host->caps & MMC_CAP_ERASE) &&
(card->csd.cmdclass & CCC_ERASE) && card->erase_size)
if (card->csd.cmdclass & CCC_ERASE && card->erase_size)
return 1;
return 0;
}
Expand Down

0 comments on commit 94fe258

Please sign in to comment.