mmc: core: Remove unnecessary validations for bus_ops callbacks
authorUlf Hansson <ulf.hansson@linaro.org>
Wed, 30 Oct 2013 22:15:30 +0000 (23:15 +0100)
committerChris Ball <chris@printf.net>
Fri, 14 Feb 2014 03:58:23 +0000 (22:58 -0500)
Due to the removal of the Kconfig option MMC_UNSAFE_RESUME, several
validations of a present bus_ops callback became redundant. Let's
remove these.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
drivers/mmc/core/bus.c
drivers/mmc/core/core.c

index 64145a32b917b37ce862e392fe3600417c99c336..824644875d41691fe6dc099c53e4770f1cbea23e 100644 (file)
@@ -185,24 +185,16 @@ 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 ret;
+       return host->bus_ops->runtime_suspend(host);
 }
 
 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 ret;
+       return host->bus_ops->runtime_resume(host);
 }
 
 static int mmc_runtime_idle(struct device *dev)
index 10856ec64412ac21a95f9a5055911a3192af2e92..22427c684b367299b4c877eee6d73886c9731105 100644 (file)
@@ -2231,9 +2231,6 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
 {
        struct mmc_card *card = host->card;
 
-       if (!host->bus_ops->power_restore)
-               return -EOPNOTSUPP;
-
        if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
                return -EOPNOTSUPP;
 
@@ -2335,7 +2332,7 @@ int _mmc_detect_card_removed(struct mmc_host *host)
 {
        int ret;
 
-       if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
+       if (host->caps & MMC_CAP_NONREMOVABLE)
                return 0;
 
        if (!host->card || mmc_card_removed(host->card))
@@ -2418,7 +2415,7 @@ void mmc_rescan(struct work_struct *work)
         * if there is a _removable_ card registered, check whether it is
         * still present
         */
-       if (host->bus_ops && host->bus_ops->detect && !host->bus_dead
+       if (host->bus_ops && !host->bus_dead
            && !(host->caps & MMC_CAP_NONREMOVABLE))
                host->bus_ops->detect(host);
 
@@ -2520,7 +2517,7 @@ int mmc_power_save_host(struct mmc_host *host)
 
        mmc_bus_get(host);
 
-       if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
+       if (!host->bus_ops || host->bus_dead) {
                mmc_bus_put(host);
                return -EINVAL;
        }
@@ -2546,7 +2543,7 @@ int mmc_power_restore_host(struct mmc_host *host)
 
        mmc_bus_get(host);
 
-       if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
+       if (!host->bus_ops || host->bus_dead) {
                mmc_bus_put(host);
                return -EINVAL;
        }
@@ -2651,7 +2648,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
                /* Validate prerequisites for suspend */
                if (host->bus_ops->pre_suspend)
                        err = host->bus_ops->pre_suspend(host);
-               if (!err && host->bus_ops->suspend)
+               if (!err)
                        break;
 
                /* Calling bus_ops->remove() with a claimed host can deadlock */