--- 405686771a5b1484f97f0715c1c0c112c6a51ed1 +++ a31fe4d385a72faeb0d13b3000ce9839874704fa @@ -184,6 +184,10 @@ static void mmc_wait_done(struct mmc_req complete(mrq->done_data); } +struct msmsdcc_host; +void msmsdcc_request_end(struct msmsdcc_host *host, struct mmc_request *mrq); +void msmsdcc_stop_data(struct msmsdcc_host *host); + /** * mmc_wait_for_req - start a request and wait for completion * @host: MMC host to start command @@ -195,6 +199,10 @@ static void mmc_wait_done(struct mmc_req */ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) { +#ifdef CONFIG_WIMAX + int ret = 0; +#endif + DECLARE_COMPLETION_ONSTACK(complete); mrq->done_data = &complete; @@ -202,7 +210,20 @@ void mmc_wait_for_req(struct mmc_host *h mmc_start_request(host, mrq); +#ifdef CONFIG_WIMAX + ret = wait_for_completion_timeout(&complete, msecs_to_jiffies(5000)); + if (ret <= 0) { + struct msmsdcc_host *msm_host = mmc_priv(host); + printk("[ERR] %s: %s wait_for_completion_timeout!\n", __func__, mmc_hostname(host)); + + msmsdcc_stop_data(msm_host); + + mrq->cmd->error = -ETIMEDOUT; + msmsdcc_request_end(msm_host, mrq); + } +#else wait_for_completion(&complete); +#endif } EXPORT_SYMBOL(mmc_wait_for_req); @@ -1082,6 +1103,7 @@ void mmc_remove_sd_card(struct work_stru mmc_release_host(host); } mmc_bus_put(host); + wake_unlock(&mmc_delayed_work_wake_lock); printk(KERN_INFO "%s: %s exit\n", mmc_hostname(host), __func__); }