aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/via-pmu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh/via-pmu.c')
-rw-r--r--drivers/macintosh/via-pmu.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index b6073bdb50c3..ca3c4aba5a22 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1769,35 +1769,21 @@ EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
1769#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 1769#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
1770 1770
1771/* Sleep is broadcast last-to-first */ 1771/* Sleep is broadcast last-to-first */
1772static int 1772static void broadcast_sleep(int when)
1773broadcast_sleep(int when, int fallback)
1774{ 1773{
1775 int ret = PBOOK_SLEEP_OK;
1776 struct list_head *list; 1774 struct list_head *list;
1777 struct pmu_sleep_notifier *notifier; 1775 struct pmu_sleep_notifier *notifier;
1778 1776
1779 for (list = sleep_notifiers.prev; list != &sleep_notifiers; 1777 for (list = sleep_notifiers.prev; list != &sleep_notifiers;
1780 list = list->prev) { 1778 list = list->prev) {
1781 notifier = list_entry(list, struct pmu_sleep_notifier, list); 1779 notifier = list_entry(list, struct pmu_sleep_notifier, list);
1782 ret = notifier->notifier_call(notifier, when); 1780 notifier->notifier_call(notifier, when);
1783 if (ret != PBOOK_SLEEP_OK) {
1784 printk(KERN_DEBUG "sleep %d rejected by %p (%p)\n",
1785 when, notifier, notifier->notifier_call);
1786 for (; list != &sleep_notifiers; list = list->next) {
1787 notifier = list_entry(list, struct pmu_sleep_notifier, list);
1788 notifier->notifier_call(notifier, fallback);
1789 }
1790 return ret;
1791 }
1792 } 1781 }
1793 return ret;
1794} 1782}
1795 1783
1796/* Wake is broadcast first-to-last */ 1784/* Wake is broadcast first-to-last */
1797static int 1785static void broadcast_wake(void)
1798broadcast_wake(void)
1799{ 1786{
1800 int ret = PBOOK_SLEEP_OK;
1801 struct list_head *list; 1787 struct list_head *list;
1802 struct pmu_sleep_notifier *notifier; 1788 struct pmu_sleep_notifier *notifier;
1803 1789
@@ -1806,7 +1792,6 @@ broadcast_wake(void)
1806 notifier = list_entry(list, struct pmu_sleep_notifier, list); 1792 notifier = list_entry(list, struct pmu_sleep_notifier, list);
1807 notifier->notifier_call(notifier, PBOOK_WAKE); 1793 notifier->notifier_call(notifier, PBOOK_WAKE);
1808 } 1794 }
1809 return ret;
1810} 1795}
1811 1796
1812/* 1797/*
@@ -2013,12 +1998,8 @@ pmac_suspend_devices(void)
2013 1998
2014 pm_prepare_console(); 1999 pm_prepare_console();
2015 2000
2016 /* Notify old-style device drivers & userland */ 2001 /* Notify old-style device drivers */
2017 ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT); 2002 broadcast_sleep(PBOOK_SLEEP_REQUEST);
2018 if (ret != PBOOK_SLEEP_OK) {
2019 printk(KERN_ERR "Sleep rejected by drivers\n");
2020 return -EBUSY;
2021 }
2022 2003
2023 /* Sync the disks. */ 2004 /* Sync the disks. */
2024 /* XXX It would be nice to have some way to ensure that 2005 /* XXX It would be nice to have some way to ensure that
@@ -2028,12 +2009,7 @@ pmac_suspend_devices(void)
2028 */ 2009 */
2029 sys_sync(); 2010 sys_sync();
2030 2011
2031 /* Sleep can fail now. May not be very robust but useful for debugging */ 2012 broadcast_sleep(PBOOK_SLEEP_NOW);
2032 ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
2033 if (ret != PBOOK_SLEEP_OK) {
2034 printk(KERN_ERR "Driver sleep failed\n");
2035 return -EBUSY;
2036 }
2037 2013
2038 /* Send suspend call to devices, hold the device core's dpm_sem */ 2014 /* Send suspend call to devices, hold the device core's dpm_sem */
2039 ret = device_suspend(PMSG_SUSPEND); 2015 ret = device_suspend(PMSG_SUSPEND);