diff options
| -rw-r--r-- | drivers/mmc/host/imxmmc.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index 9cda12fba9aa..f61406da65d2 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
| @@ -905,7 +905,8 @@ static void imxmci_check_status(unsigned long data) | |||
| 905 | { | 905 | { |
| 906 | struct imxmci_host *host = (struct imxmci_host *)data; | 906 | struct imxmci_host *host = (struct imxmci_host *)data; |
| 907 | 907 | ||
| 908 | if( host->pdata->card_present(mmc_dev(host->mmc)) != host->present ) { | 908 | if (host->pdata && host->pdata->card_present && |
| 909 | host->pdata->card_present(mmc_dev(host->mmc)) != host->present) { | ||
| 909 | host->present ^= 1; | 910 | host->present ^= 1; |
| 910 | dev_info(mmc_dev(host->mmc), "card %s\n", | 911 | dev_info(mmc_dev(host->mmc), "card %s\n", |
| 911 | host->present ? "inserted" : "removed"); | 912 | host->present ? "inserted" : "removed"); |
| @@ -968,6 +969,8 @@ static int imxmci_probe(struct platform_device *pdev) | |||
| 968 | host->mmc = mmc; | 969 | host->mmc = mmc; |
| 969 | host->dma_allocated = 0; | 970 | host->dma_allocated = 0; |
| 970 | host->pdata = pdev->dev.platform_data; | 971 | host->pdata = pdev->dev.platform_data; |
| 972 | if (!host->pdata) | ||
| 973 | dev_warn(&pdev->dev, "No platform data provided!\n"); | ||
| 971 | 974 | ||
| 972 | spin_lock_init(&host->lock); | 975 | spin_lock_init(&host->lock); |
| 973 | host->res = r; | 976 | host->res = r; |
| @@ -1020,7 +1023,11 @@ static int imxmci_probe(struct platform_device *pdev) | |||
| 1020 | if (ret) | 1023 | if (ret) |
| 1021 | goto out; | 1024 | goto out; |
| 1022 | 1025 | ||
| 1023 | host->present = host->pdata->card_present(mmc_dev(mmc)); | 1026 | if (host->pdata && host->pdata->card_present) |
| 1027 | host->present = host->pdata->card_present(mmc_dev(mmc)); | ||
| 1028 | else /* if there is no way to detect assume that card is present */ | ||
| 1029 | host->present = 1; | ||
| 1030 | |||
| 1024 | init_timer(&host->timer); | 1031 | init_timer(&host->timer); |
| 1025 | host->timer.data = (unsigned long)host; | 1032 | host->timer.data = (unsigned long)host; |
| 1026 | host->timer.function = imxmci_check_status; | 1033 | host->timer.function = imxmci_check_status; |
