> > diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c > > index ce89611a136e..a31dc915c5ec 100644 > > --- a/drivers/mmc/core/block.c > > +++ b/drivers/mmc/core/block.c > > @@ -1140,8 +1140,12 @@ static void mmc_blk_issue_discard_rq(struct > mmc_queue *mq, struct request *req) > > { > > struct mmc_blk_data *md = mq->blkdata; > > struct mmc_card *card = md->queue.card; > > + unsigned int arg = card->erase_arg; > > > > - mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, card- > >erase_arg); > > + if (mmc_card_sd(card) && (card->quirks & > MMC_QUIRK_BROKEN_SD_DISCARD)) > > There's no need for the mmc_card_sd() here, as the quirk can't be set > unless it's the SD card type (see add_quirk_sd()). Done. > > Moreover, I would prefer if we can use a helper function > (mmc_card_broken_sd_discard()), that checks the new quirk bit. Similar > helpers are already available in drivers/mmc/core/card.h. Done. > > > + arg = SD_ERASE_ARG; > > + > > + mmc_blk_issue_erase_rq(mq, req, MMC_BLK_DISCARD, arg); > > } > > > > static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, > > diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h > > index 99045e138ba4..881432309b46 100644 > > --- a/drivers/mmc/core/card.h > > +++ b/drivers/mmc/core/card.h > > @@ -73,6 +73,7 @@ struct mmc_fixup { > > #define EXT_CSD_REV_ANY (-1u) > > > > #define CID_MANFID_SANDISK 0x2 > > +#define CID_MANFID_SANDISK_SD 0x3 > > #define CID_MANFID_ATP 0x9 > > #define CID_MANFID_TOSHIBA 0x11 > > #define CID_MANFID_MICRON 0x13 > > diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h > > index be4393988086..29b9497936df 100644 > > --- a/drivers/mmc/core/quirks.h > > +++ b/drivers/mmc/core/quirks.h > > @@ -100,6 +100,12 @@ static const struct mmc_fixup __maybe_unused > mmc_blk_fixups[] = { > > MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, > add_quirk_mmc, > > MMC_QUIRK_TRIM_BROKEN), > > > > + /* > > + * Some SD cards reports discard support while they don't > > + */ > > + MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, > add_quirk_sd, > > + MMC_QUIRK_BROKEN_SD_DISCARD), > > + > > END_FIXUP > > }; > > > > diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h > > index 8a30de08e913..c726ea781255 100644 > > --- a/include/linux/mmc/card.h > > +++ b/include/linux/mmc/card.h > > @@ -293,6 +293,7 @@ struct mmc_card { > > #define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling > SDIO_CCCR_INTx could create a fake interrupt */ > > #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ > > #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI > support */ > > +#define MMC_QUIRK_BROKEN_SD_DISCARD (1<<14) /* Disable broken > SD discard support */ > > > > bool reenable_cmdq; /* Re-enable Command Queue */ > > > > -- > > 2.17.1 > > > > Other than the minor nitpicks above, this looks good to me! Thanks, Avri > > Kind regards > Uffe