aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/core.c20
-rw-r--r--drivers/mmc/core/core.h4
-rw-r--r--drivers/mmc/core/mmc.c8
-rw-r--r--drivers/mmc/core/sd.c8
4 files changed, 28 insertions, 12 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 3eb7a9be6d8d..8f86d702e46e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1583,37 +1583,45 @@ void mmc_stop_host(struct mmc_host *host)
1583 mmc_power_off(host); 1583 mmc_power_off(host);
1584} 1584}
1585 1585
1586void mmc_power_save_host(struct mmc_host *host) 1586int mmc_power_save_host(struct mmc_host *host)
1587{ 1587{
1588 int ret = 0;
1589
1588 mmc_bus_get(host); 1590 mmc_bus_get(host);
1589 1591
1590 if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { 1592 if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
1591 mmc_bus_put(host); 1593 mmc_bus_put(host);
1592 return; 1594 return -EINVAL;
1593 } 1595 }
1594 1596
1595 if (host->bus_ops->power_save) 1597 if (host->bus_ops->power_save)
1596 host->bus_ops->power_save(host); 1598 ret = host->bus_ops->power_save(host);
1597 1599
1598 mmc_bus_put(host); 1600 mmc_bus_put(host);
1599 1601
1600 mmc_power_off(host); 1602 mmc_power_off(host);
1603
1604 return ret;
1601} 1605}
1602EXPORT_SYMBOL(mmc_power_save_host); 1606EXPORT_SYMBOL(mmc_power_save_host);
1603 1607
1604void mmc_power_restore_host(struct mmc_host *host) 1608int mmc_power_restore_host(struct mmc_host *host)
1605{ 1609{
1610 int ret;
1611
1606 mmc_bus_get(host); 1612 mmc_bus_get(host);
1607 1613
1608 if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) { 1614 if (!host->bus_ops || host->bus_dead || !host->bus_ops->power_restore) {
1609 mmc_bus_put(host); 1615 mmc_bus_put(host);
1610 return; 1616 return -EINVAL;
1611 } 1617 }
1612 1618
1613 mmc_power_up(host); 1619 mmc_power_up(host);
1614 host->bus_ops->power_restore(host); 1620 ret = host->bus_ops->power_restore(host);
1615 1621
1616 mmc_bus_put(host); 1622 mmc_bus_put(host);
1623
1624 return ret;
1617} 1625}
1618EXPORT_SYMBOL(mmc_power_restore_host); 1626EXPORT_SYMBOL(mmc_power_restore_host);
1619 1627
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index a971b0667aad..77240cd11bcf 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -22,8 +22,8 @@ struct mmc_bus_ops {
22 void (*detect)(struct mmc_host *); 22 void (*detect)(struct mmc_host *);
23 int (*suspend)(struct mmc_host *); 23 int (*suspend)(struct mmc_host *);
24 int (*resume)(struct mmc_host *); 24 int (*resume)(struct mmc_host *);
25 void (*power_save)(struct mmc_host *); 25 int (*power_save)(struct mmc_host *);
26 void (*power_restore)(struct mmc_host *); 26 int (*power_restore)(struct mmc_host *);
27}; 27};
28 28
29void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); 29void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index df2a817303b4..995261f7fd70 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -657,12 +657,16 @@ static int mmc_resume(struct mmc_host *host)
657 return err; 657 return err;
658} 658}
659 659
660static void mmc_power_restore(struct mmc_host *host) 660static int mmc_power_restore(struct mmc_host *host)
661{ 661{
662 int ret;
663
662 host->card->state &= ~MMC_STATE_HIGHSPEED; 664 host->card->state &= ~MMC_STATE_HIGHSPEED;
663 mmc_claim_host(host); 665 mmc_claim_host(host);
664 mmc_init_card(host, host->ocr, host->card); 666 ret = mmc_init_card(host, host->ocr, host->card);
665 mmc_release_host(host); 667 mmc_release_host(host);
668
669 return ret;
666} 670}
667 671
668static int mmc_sleep(struct mmc_host *host) 672static int mmc_sleep(struct mmc_host *host)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index bc745e1237bf..49da4dffd28e 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -722,12 +722,16 @@ static int mmc_sd_resume(struct mmc_host *host)
722 return err; 722 return err;
723} 723}
724 724
725static void mmc_sd_power_restore(struct mmc_host *host) 725static int mmc_sd_power_restore(struct mmc_host *host)
726{ 726{
727 int ret;
728
727 host->card->state &= ~MMC_STATE_HIGHSPEED; 729 host->card->state &= ~MMC_STATE_HIGHSPEED;
728 mmc_claim_host(host); 730 mmc_claim_host(host);
729 mmc_sd_init_card(host, host->ocr, host->card); 731 ret = mmc_sd_init_card(host, host->ocr, host->card);
730 mmc_release_host(host); 732 mmc_release_host(host);
733
734 return ret;
731} 735}
732 736
733static const struct mmc_bus_ops mmc_sd_ops = { 737static const struct mmc_bus_ops mmc_sd_ops = {