diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2010-10-02 07:54:06 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2010-10-23 09:11:17 -0400 |
commit | 12ae637f081a7a05144af65802a7b492b9162660 (patch) | |
tree | 1b54043d766aaf33466f5efad08d53d16a024f85 /drivers/mmc | |
parent | 9b966aae6419f7d75a87114c4d82bfb8f8699132 (diff) |
mmc: propagate power save/restore ops return value
Allow power save/restore and their relevant mmc_bus_ops handlers
exit with a return value.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Tested-by: Luciano Coelho <luciano.coelho@nokia.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/core/core.c | 20 | ||||
-rw-r--r-- | drivers/mmc/core/core.h | 4 | ||||
-rw-r--r-- | drivers/mmc/core/mmc.c | 8 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 8 |
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 | ||
1586 | void mmc_power_save_host(struct mmc_host *host) | 1586 | int 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 | } |
1602 | EXPORT_SYMBOL(mmc_power_save_host); | 1606 | EXPORT_SYMBOL(mmc_power_save_host); |
1603 | 1607 | ||
1604 | void mmc_power_restore_host(struct mmc_host *host) | 1608 | int 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 | } |
1618 | EXPORT_SYMBOL(mmc_power_restore_host); | 1626 | EXPORT_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 | ||
29 | void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops); | 29 | void 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 | ||
660 | static void mmc_power_restore(struct mmc_host *host) | 660 | static 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 | ||
668 | static int mmc_sleep(struct mmc_host *host) | 672 | static 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 | ||
725 | static void mmc_sd_power_restore(struct mmc_host *host) | 725 | static 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 | ||
733 | static const struct mmc_bus_ops mmc_sd_ops = { | 737 | static const struct mmc_bus_ops mmc_sd_ops = { |