| .. | .. |
|---|
| 256 | 256 | goto out_put; |
|---|
| 257 | 257 | } |
|---|
| 258 | 258 | req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_BOOT_WP; |
|---|
| 259 | + req_to_mmc_queue_req(req)->drv_op_result = -EIO; |
|---|
| 259 | 260 | blk_execute_rq(mq->queue, NULL, req, 0); |
|---|
| 260 | 261 | ret = req_to_mmc_queue_req(req)->drv_op_result; |
|---|
| 261 | 262 | blk_put_request(req); |
|---|
| .. | .. |
|---|
| 415 | 416 | static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms, |
|---|
| 416 | 417 | u32 *resp_errs) |
|---|
| 417 | 418 | { |
|---|
| 418 | | - unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); |
|---|
| 419 | + unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms > 2000 ? 2000 : timeout_ms); |
|---|
| 419 | 420 | int err = 0; |
|---|
| 420 | 421 | u32 status; |
|---|
| 421 | 422 | |
|---|
| .. | .. |
|---|
| 649 | 650 | idatas[0] = idata; |
|---|
| 650 | 651 | req_to_mmc_queue_req(req)->drv_op = |
|---|
| 651 | 652 | rpmb ? MMC_DRV_OP_IOCTL_RPMB : MMC_DRV_OP_IOCTL; |
|---|
| 653 | + req_to_mmc_queue_req(req)->drv_op_result = -EIO; |
|---|
| 652 | 654 | req_to_mmc_queue_req(req)->drv_op_data = idatas; |
|---|
| 653 | 655 | req_to_mmc_queue_req(req)->ioc_count = 1; |
|---|
| 654 | 656 | blk_execute_rq(mq->queue, NULL, req, 0); |
|---|
| .. | .. |
|---|
| 718 | 720 | } |
|---|
| 719 | 721 | req_to_mmc_queue_req(req)->drv_op = |
|---|
| 720 | 722 | rpmb ? MMC_DRV_OP_IOCTL_RPMB : MMC_DRV_OP_IOCTL; |
|---|
| 723 | + req_to_mmc_queue_req(req)->drv_op_result = -EIO; |
|---|
| 721 | 724 | req_to_mmc_queue_req(req)->drv_op_data = idata; |
|---|
| 722 | 725 | req_to_mmc_queue_req(req)->ioc_count = num_of_cmds; |
|---|
| 723 | 726 | blk_execute_rq(mq->queue, NULL, req, 0); |
|---|
| .. | .. |
|---|
| 1781 | 1784 | * bytes transferred to zero in that case. |
|---|
| 1782 | 1785 | */ |
|---|
| 1783 | 1786 | err = __mmc_send_status(card, &status, 0); |
|---|
| 1784 | | - if (err || mmc_blk_status_error(req, status)) |
|---|
| 1787 | + if (err || mmc_blk_status_error(req, status)) { |
|---|
| 1785 | 1788 | brq->data.bytes_xfered = 0; |
|---|
| 1789 | + if (mmc_card_sd(card) && !mmc_card_removed(card)) { |
|---|
| 1790 | + mmc_blk_reset_success(mq->blkdata, type); |
|---|
| 1791 | + if (!mmc_blk_reset(md, card->host, type)) |
|---|
| 1792 | + return; |
|---|
| 1793 | + pr_err("%s: pre recovery failed!\n", req->rq_disk->disk_name); |
|---|
| 1794 | + } |
|---|
| 1795 | + } |
|---|
| 1786 | 1796 | |
|---|
| 1787 | 1797 | mmc_retune_release(card->host); |
|---|
| 1788 | 1798 | |
|---|
| .. | .. |
|---|
| 1996 | 2006 | mmc_blk_urgent_bkops(mq, mqrq); |
|---|
| 1997 | 2007 | } |
|---|
| 1998 | 2008 | |
|---|
| 1999 | | -static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, struct request *req) |
|---|
| 2009 | +static void mmc_blk_mq_dec_in_flight(struct mmc_queue *mq, enum mmc_issue_type issue_type) |
|---|
| 2000 | 2010 | { |
|---|
| 2001 | 2011 | unsigned long flags; |
|---|
| 2002 | 2012 | bool put_card; |
|---|
| 2003 | 2013 | |
|---|
| 2004 | 2014 | spin_lock_irqsave(&mq->lock, flags); |
|---|
| 2005 | 2015 | |
|---|
| 2006 | | - mq->in_flight[mmc_issue_type(mq, req)] -= 1; |
|---|
| 2016 | + mq->in_flight[issue_type] -= 1; |
|---|
| 2007 | 2017 | |
|---|
| 2008 | 2018 | put_card = (mmc_tot_in_flight(mq) == 0); |
|---|
| 2009 | 2019 | |
|---|
| .. | .. |
|---|
| 2015 | 2025 | |
|---|
| 2016 | 2026 | static void mmc_blk_mq_post_req(struct mmc_queue *mq, struct request *req) |
|---|
| 2017 | 2027 | { |
|---|
| 2028 | + enum mmc_issue_type issue_type = mmc_issue_type(mq, req); |
|---|
| 2018 | 2029 | struct mmc_queue_req *mqrq = req_to_mmc_queue_req(req); |
|---|
| 2019 | 2030 | struct mmc_request *mrq = &mqrq->brq.mrq; |
|---|
| 2020 | 2031 | struct mmc_host *host = mq->card->host; |
|---|
| .. | .. |
|---|
| 2030 | 2041 | else if (likely(!blk_should_fake_timeout(req->q))) |
|---|
| 2031 | 2042 | blk_mq_complete_request(req); |
|---|
| 2032 | 2043 | |
|---|
| 2033 | | - mmc_blk_mq_dec_in_flight(mq, req); |
|---|
| 2044 | + mmc_blk_mq_dec_in_flight(mq, issue_type); |
|---|
| 2034 | 2045 | } |
|---|
| 2035 | 2046 | |
|---|
| 2036 | 2047 | void mmc_blk_mq_recovery(struct mmc_queue *mq) |
|---|
| .. | .. |
|---|
| 2768 | 2779 | if (IS_ERR(req)) |
|---|
| 2769 | 2780 | return PTR_ERR(req); |
|---|
| 2770 | 2781 | req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_CARD_STATUS; |
|---|
| 2782 | + req_to_mmc_queue_req(req)->drv_op_result = -EIO; |
|---|
| 2771 | 2783 | blk_execute_rq(mq->queue, NULL, req, 0); |
|---|
| 2772 | 2784 | ret = req_to_mmc_queue_req(req)->drv_op_result; |
|---|
| 2773 | 2785 | if (ret >= 0) { |
|---|
| .. | .. |
|---|
| 2806 | 2818 | goto out_free; |
|---|
| 2807 | 2819 | } |
|---|
| 2808 | 2820 | req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_EXT_CSD; |
|---|
| 2821 | + req_to_mmc_queue_req(req)->drv_op_result = -EIO; |
|---|
| 2809 | 2822 | req_to_mmc_queue_req(req)->drv_op_data = &ext_csd; |
|---|
| 2810 | 2823 | blk_execute_rq(mq->queue, NULL, req, 0); |
|---|
| 2811 | 2824 | err = req_to_mmc_queue_req(req)->drv_op_result; |
|---|