rk: restore file mode
[firefly-linux-kernel-4.4.55.git] / drivers / mmc / core / bus.c
old mode 100755 (executable)
new mode 100644 (file)
index d0b980c..0669ed0
@@ -127,17 +127,18 @@ static void mmc_bus_shutdown(struct device *dev)
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = mmc_dev_to_card(dev);
        struct mmc_host *host = card->host;
-       int ret;
+       int ret = 0;
 
        if (dev->driver && drv->shutdown)
-               drv->shutdown(card);
+           drv->shutdown(card);
 
-       if (host->bus_ops->shutdown) {
-               ret = host->bus_ops->shutdown(host);
-               if (ret)
-                       pr_warn("%s: error %d during shutdown\n",
-                               mmc_hostname(host), ret);
+    if (host->bus_ops->shutdown) {
+        ret = host->bus_ops->shutdown(host);
+
+        if (ret)
+            pr_warn("%s: error %d during shutdown\n",mmc_hostname(host), ret);
        }
+
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -145,10 +146,17 @@ static int mmc_bus_suspend(struct device *dev)
 {
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = mmc_dev_to_card(dev);
+       struct mmc_host *host = card->host;
        int ret = 0;
 
-       if (dev->driver && drv->suspend)
+       if (dev->driver && drv->suspend) {
                ret = drv->suspend(card);
+               if (ret)
+                       return ret;
+       }
+       
+    if(host->bus_ops->suspend)
+           ret = host->bus_ops->suspend(host);
        return ret;
 }
 
@@ -156,10 +164,19 @@ static int mmc_bus_resume(struct device *dev)
 {
        struct mmc_driver *drv = to_mmc_driver(dev->driver);
        struct mmc_card *card = mmc_dev_to_card(dev);
+       struct mmc_host *host = card->host;
        int ret = 0;
 
+    if(host->bus_ops->resume){
+           ret = host->bus_ops->resume(host);
+           if (ret)
+                   pr_warn("%s: error %d during resume (card was removed?)\n",
+                           mmc_hostname(host), ret);
+    }
+    
        if (dev->driver && drv->resume)
                ret = drv->resume(card);
+
        return ret;
 }
 #endif
@@ -169,20 +186,30 @@ static int mmc_bus_resume(struct device *dev)
 static int mmc_runtime_suspend(struct device *dev)
 {
        struct mmc_card *card = mmc_dev_to_card(dev);
+       struct mmc_host *host = card->host;
+       int ret = 0;
+
+       if (host->bus_ops->runtime_suspend)
+               ret = host->bus_ops->runtime_suspend(host);
 
-       return mmc_power_save_host(card->host);
+       return ret;
 }
 
 static int mmc_runtime_resume(struct device *dev)
 {
        struct mmc_card *card = mmc_dev_to_card(dev);
+       struct mmc_host *host = card->host;
+       int ret = 0;
+
+       if (host->bus_ops->runtime_resume)
+               ret = host->bus_ops->runtime_resume(host);
 
-       return mmc_power_restore_host(card->host);
+       return ret;
 }
 
 static int mmc_runtime_idle(struct device *dev)
 {
-       return pm_runtime_suspend(dev);
+       return 0;
 }
 
 #endif /* !CONFIG_PM_RUNTIME */
@@ -317,7 +344,7 @@ int mmc_add_card(struct mmc_card *card)
                break;
        }
 
-       if (mmc_sd_card_uhs(card) &&
+       if (mmc_card_uhs(card) &&
                (card->sd_bus_speed < ARRAY_SIZE(uhs_speeds)))
                uhs_bus_speed_mode = uhs_speeds[card->sd_bus_speed];