Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ulf Hansson and committed by
Chris Ball
5601aaf7 2501c917

+7 -18
+2 -10
drivers/mmc/core/bus.c
··· 185 185 { 186 186 struct mmc_card *card = mmc_dev_to_card(dev); 187 187 struct mmc_host *host = card->host; 188 - int ret = 0; 189 188 190 - if (host->bus_ops->runtime_suspend) 191 - ret = host->bus_ops->runtime_suspend(host); 192 - 193 - return ret; 189 + return host->bus_ops->runtime_suspend(host); 194 190 } 195 191 196 192 static int mmc_runtime_resume(struct device *dev) 197 193 { 198 194 struct mmc_card *card = mmc_dev_to_card(dev); 199 195 struct mmc_host *host = card->host; 200 - int ret = 0; 201 196 202 - if (host->bus_ops->runtime_resume) 203 - ret = host->bus_ops->runtime_resume(host); 204 - 205 - return ret; 197 + return host->bus_ops->runtime_resume(host); 206 198 } 207 199 208 200 static int mmc_runtime_idle(struct device *dev)
+5 -8
drivers/mmc/core/core.c
··· 2231 2231 { 2232 2232 struct mmc_card *card = host->card; 2233 2233 2234 - if (!host->bus_ops->power_restore) 2235 - return -EOPNOTSUPP; 2236 - 2237 2234 if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset) 2238 2235 return -EOPNOTSUPP; 2239 2236 ··· 2332 2335 { 2333 2336 int ret; 2334 2337 2335 - if ((host->caps & MMC_CAP_NONREMOVABLE) || !host->bus_ops->alive) 2338 + if (host->caps & MMC_CAP_NONREMOVABLE) 2336 2339 return 0; 2337 2340 2338 2341 if (!host->card || mmc_card_removed(host->card)) ··· 2415 2418 * if there is a _removable_ card registered, check whether it is 2416 2419 * still present 2417 2420 */ 2418 - if (host->bus_ops && host->bus_ops->detect && !host->bus_dead 2421 + if (host->bus_ops && !host->bus_dead 2419 2422 && !(host->caps & MMC_CAP_NONREMOVABLE)) 2420 2423 host->bus_ops->detect(host); 2421 2424 ··· 2517 2520 2518 2521 mmc_bus_get(host); 2519 2522 2520 - if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { 2523 + if (!host->bus_ops || host->bus_dead) { 2521 2524 mmc_bus_put(host); 2522 2525 return -EINVAL; 2523 2526 } ··· 2543 2546 2544 2547 mmc_bus_get(host); 2545 2548 2546 - if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { 2549 + if (!host->bus_ops || host->bus_dead) { 2547 2550 mmc_bus_put(host); 2548 2551 return -EINVAL; 2549 2552 } ··· 2648 2651 /* Validate prerequisites for suspend */ 2649 2652 if (host->bus_ops->pre_suspend) 2650 2653 err = host->bus_ops->pre_suspend(host); 2651 - if (!err && host->bus_ops->suspend) 2654 + if (!err) 2652 2655 break; 2653 2656 2654 2657 /* Calling bus_ops->remove() with a claimed host can deadlock */