Browse Source

mmc: core: Remove unnecessary validations for bus_ops callbacks

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>
Ulf Hansson 11 years ago
parent
commit
5601aaf73e
2 changed files with 7 additions and 18 deletions
  1. 2 10
      drivers/mmc/core/bus.c
  2. 5 8
      drivers/mmc/core/core.c

+ 2 - 10
drivers/mmc/core/bus.c

@@ -185,24 +185,16 @@ static int mmc_runtime_suspend(struct device *dev)
 {
 {
 	struct mmc_card *card = mmc_dev_to_card(dev);
 	struct mmc_card *card = mmc_dev_to_card(dev);
 	struct mmc_host *host = card->host;
 	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)
 static int mmc_runtime_resume(struct device *dev)
 {
 {
 	struct mmc_card *card = mmc_dev_to_card(dev);
 	struct mmc_card *card = mmc_dev_to_card(dev);
 	struct mmc_host *host = card->host;
 	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)
 static int mmc_runtime_idle(struct device *dev)

+ 5 - 8
drivers/mmc/core/core.c

@@ -2231,9 +2231,6 @@ static int mmc_do_hw_reset(struct mmc_host *host, int check)
 {
 {
 	struct mmc_card *card = host->card;
 	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)
 	if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)
 		return -EOPNOTSUPP;
 		return -EOPNOTSUPP;
 
 
@@ -2335,7 +2332,7 @@ int _mmc_detect_card_removed(struct mmc_host *host)
 {
 {
 	int ret;
 	int ret;
 
 
-	if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive)
+	if (host->caps & MMC_CAP_NONREMOVABLE)
 		return 0;
 		return 0;
 
 
 	if (!host->card || mmc_card_removed(host->card))
 	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
 	 * if there is a _removable_ card registered, check whether it is
 	 * still present
 	 * 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->caps & MMC_CAP_NONREMOVABLE))
 		host->bus_ops->detect(host);
 		host->bus_ops->detect(host);
 
 
@@ -2520,7 +2517,7 @@ int mmc_power_save_host(struct mmc_host *host)
 
 
 	mmc_bus_get(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);
 		mmc_bus_put(host);
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
@@ -2546,7 +2543,7 @@ int mmc_power_restore_host(struct mmc_host *host)
 
 
 	mmc_bus_get(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);
 		mmc_bus_put(host);
 		return -EINVAL;
 		return -EINVAL;
 	}
 	}
@@ -2651,7 +2648,7 @@ int mmc_pm_notify(struct notifier_block *notify_block,
 		/* Validate prerequisites for suspend */
 		/* Validate prerequisites for suspend */
 		if (host->bus_ops->pre_suspend)
 		if (host->bus_ops->pre_suspend)
 			err = host->bus_ops->pre_suspend(host);
 			err = host->bus_ops->pre_suspend(host);
-		if (!err && host->bus_ops->suspend)
+		if (!err)
 			break;
 			break;
 
 
 		/* Calling bus_ops->remove() with a claimed host can deadlock */
 		/* Calling bus_ops->remove() with a claimed host can deadlock */