diff options
| -rw-r--r-- | drivers/mmc/core/core.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 709ada9f26b5..c296bc098fe2 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -897,6 +897,7 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) | |||
| 897 | DECLARE_WAITQUEUE(wait, current); | 897 | DECLARE_WAITQUEUE(wait, current); |
| 898 | unsigned long flags; | 898 | unsigned long flags; |
| 899 | int stop; | 899 | int stop; |
| 900 | bool pm = false; | ||
| 900 | 901 | ||
| 901 | might_sleep(); | 902 | might_sleep(); |
| 902 | 903 | ||
| @@ -916,13 +917,18 @@ int __mmc_claim_host(struct mmc_host *host, atomic_t *abort) | |||
| 916 | host->claimed = 1; | 917 | host->claimed = 1; |
| 917 | host->claimer = current; | 918 | host->claimer = current; |
| 918 | host->claim_cnt += 1; | 919 | host->claim_cnt += 1; |
| 920 | if (host->claim_cnt == 1) | ||
| 921 | pm = true; | ||
| 919 | } else | 922 | } else |
| 920 | wake_up(&host->wq); | 923 | wake_up(&host->wq); |
| 921 | spin_unlock_irqrestore(&host->lock, flags); | 924 | spin_unlock_irqrestore(&host->lock, flags); |
| 922 | remove_wait_queue(&host->wq, &wait); | 925 | remove_wait_queue(&host->wq, &wait); |
| 926 | |||
| 927 | if (pm) | ||
| 928 | pm_runtime_get_sync(mmc_dev(host)); | ||
| 929 | |||
| 923 | return stop; | 930 | return stop; |
| 924 | } | 931 | } |
| 925 | |||
| 926 | EXPORT_SYMBOL(__mmc_claim_host); | 932 | EXPORT_SYMBOL(__mmc_claim_host); |
| 927 | 933 | ||
| 928 | /** | 934 | /** |
| @@ -947,6 +953,8 @@ void mmc_release_host(struct mmc_host *host) | |||
| 947 | host->claimer = NULL; | 953 | host->claimer = NULL; |
| 948 | spin_unlock_irqrestore(&host->lock, flags); | 954 | spin_unlock_irqrestore(&host->lock, flags); |
| 949 | wake_up(&host->wq); | 955 | wake_up(&host->wq); |
| 956 | pm_runtime_mark_last_busy(mmc_dev(host)); | ||
| 957 | pm_runtime_put_autosuspend(mmc_dev(host)); | ||
| 950 | } | 958 | } |
| 951 | } | 959 | } |
| 952 | EXPORT_SYMBOL(mmc_release_host); | 960 | EXPORT_SYMBOL(mmc_release_host); |
