]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mmc: core: Stop bkops for eMMC only from mmc suspend
authorUlf Hansson <ulf.hansson@linaro.org>
Thu, 2 May 2013 12:02:36 +0000 (14:02 +0200)
committerChris Ball <cjb@laptop.org>
Sun, 26 May 2013 18:23:15 +0000 (14:23 -0400)
Move mmc suspend specific operations to be executed from the .suspend
callback in the mmc bus_ops. This simplifies the mmc_suspend_host
function which is supposed to handle nothing but common suspend tasks.

Since eMMC can be considered non-removable there are no need to check
for ongoing bkops at PM_SUSPEND_PREPARE notification so remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/core.c
drivers/mmc/core/mmc.c

index 48b9fec34737f40b16f931e8ec581b3520d157d8..d856871ed6cb0beb07d2d397a908bd2279f6a94d 100644 (file)
@@ -2651,14 +2651,8 @@ int mmc_suspend_host(struct mmc_host *host)
 
        mmc_bus_get(host);
        if (host->bus_ops && !host->bus_dead) {
-               if (host->bus_ops->suspend) {
-                       if (mmc_card_doing_bkops(host->card)) {
-                               err = mmc_stop_bkops(host->card);
-                               if (err)
-                                       goto out;
-                       }
+               if (host->bus_ops->suspend)
                        err = host->bus_ops->suspend(host);
-               }
 
                if (err == -ENOSYS || !host->bus_ops->resume) {
                        /*
@@ -2682,10 +2676,8 @@ int mmc_suspend_host(struct mmc_host *host)
        if (!err && !mmc_card_keep_power(host))
                mmc_power_off(host);
 
-out:
        return err;
 }
-
 EXPORT_SYMBOL(mmc_suspend_host);
 
 /**
@@ -2740,22 +2732,10 @@ int mmc_pm_notify(struct notifier_block *notify_block,
        struct mmc_host *host = container_of(
                notify_block, struct mmc_host, pm_notify);
        unsigned long flags;
-       int err = 0;
 
        switch (mode) {
        case PM_HIBERNATION_PREPARE:
        case PM_SUSPEND_PREPARE:
-               if (host->card && mmc_card_mmc(host->card) &&
-                   mmc_card_doing_bkops(host->card)) {
-                       err = mmc_stop_bkops(host->card);
-                       if (err) {
-                               pr_err("%s: didn't stop bkops\n",
-                                       mmc_hostname(host));
-                               return err;
-                       }
-                       mmc_card_clr_doing_bkops(host->card);
-               }
-
                spin_lock_irqsave(&host->lock, flags);
                host->rescan_disable = 1;
                spin_unlock_irqrestore(&host->lock, flags);
index 0cbd1effe9605b90f8f3696b41933e39c1a06cf6..a0469cf7933fa4c7ca772e1f78fe74fad896f99a 100644 (file)
@@ -1411,6 +1411,12 @@ static int mmc_suspend(struct mmc_host *host)
 
        mmc_claim_host(host);
 
+       if (mmc_card_doing_bkops(host->card)) {
+               err = mmc_stop_bkops(host->card);
+               if (err)
+                       goto out;
+       }
+
        err = mmc_cache_ctrl(host, 0);
        if (err)
                goto out;