From: lin tao Date: Tue, 24 Jun 2014 02:15:34 +0000 (+0800) Subject: mmc: host: rk_sdmmc: clk_prepare/unprepare should be used in non-atomic context X-Git-Tag: firefly_0821_release~5058 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6161c3dd95f83074d460dd226bc1c28785817f03;p=firefly-linux-kernel-4.4.55.git mmc: host: rk_sdmmc: clk_prepare/unprepare should be used in non-atomic context --- diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index f5f78969d38d..6325d5d161dc 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -1295,28 +1295,34 @@ static int dw_mci_get_ro(struct mmc_host *mmc) static int dw_mci_set_sdio_status(struct mmc_host *mmc, int val) { struct dw_mci_slot *slot = mmc_priv(mmc); - /*struct dw_mci_board *brd = slot->host->pdata;*/ - struct dw_mci *host = slot->host; + struct dw_mci *host = slot->host; + /*struct dw_mci_board *brd = slot->host->pdata;*/ + if (!(mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO)) return 0; spin_lock_bh(&host->lock); - if(val){ + + if(val) set_bit(DW_MMC_CARD_PRESENT, &slot->flags); + else + clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); + + spin_unlock_bh(&host->lock); + + if(test_bit(DW_MMC_CARD_PRESENT, &slot->flags)){ if(__clk_is_enabled(host->hclk_mmc) == false) clk_prepare_enable(host->hclk_mmc); if(__clk_is_enabled(host->clk_mmc) == false) clk_prepare_enable(host->clk_mmc); }else{ - clear_bit(DW_MMC_CARD_PRESENT, &slot->flags); if(__clk_is_enabled(host->clk_mmc) == true) clk_disable_unprepare(slot->host->clk_mmc); if(__clk_is_enabled(host->hclk_mmc) == true) clk_disable_unprepare(slot->host->hclk_mmc); } - spin_unlock_bh(&host->lock); - mmc_detect_change(slot->mmc, 20); + mmc_detect_change(slot->mmc, 20); return 0; }