Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: block: Respect hw busy detection in card_busy_detect()

Currently for write request we don't trust the hw busy detection to be
fully handled by host, thus we also poll the card's status until we see
it's gets out of the busy state.

Still there are scenarios where it will a benefit to trust the hw busy
detection done by the host, since no additional polling is needed.
Let's prepare card_busy_detect() to be able to handle this.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>

authored by

Ulf Hansson and committed by
Chris Ball
95a91298 c49433fb

+8 -2
+8 -2
drivers/mmc/card/block.c
··· 750 750 } 751 751 752 752 static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, 753 - struct request *req, int *gen_err) 753 + bool hw_busy_detect, struct request *req, int *gen_err) 754 754 { 755 755 unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); 756 756 int err = 0; ··· 769 769 req->rq_disk->disk_name, __func__, status); 770 770 *gen_err = 1; 771 771 } 772 + 773 + /* We may rely on the host hw to handle busy detection.*/ 774 + if ((card->host->caps & MMC_CAP_WAIT_WHILE_BUSY) && 775 + hw_busy_detect) 776 + break; 772 777 773 778 /* 774 779 * Timeout if the device never becomes ready for data and never ··· 1214 1209 gen_err = 1; 1215 1210 } 1216 1211 1217 - err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, req, &gen_err); 1212 + err = card_busy_detect(card, MMC_BLK_TIMEOUT_MS, false, req, 1213 + &gen_err); 1218 1214 if (err) 1219 1215 return MMC_BLK_CMD_ERR; 1220 1216 }