aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-03-19 11:53:55 +0100
committerPaul Mackerras <paulus@samba.org>2007-03-26 12:35:17 +1000
commit70b52b3869a31aab85241a1f998f9943a3905637 (patch)
tree3c6944c5545c206cc43b8c20f1b9fe150b7ac0e9 /drivers
parent17e638bc28f2fdc9c0d3eebfb80fce43827b8d12 (diff)
[POWERPC] powermac: disallow pmu sleep notifiers from aborting sleep
Tracing through the code, no current PMU sleep notifier can abort sleep. Since no new PMU sleep notifiers should be added, this patch simplifies the code and removes the ability to abort sleep. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/macintosh/adb.c42
-rw-r--r--drivers/macintosh/apm_emu.c13
-rw-r--r--drivers/macintosh/via-pmu-led.c4
-rw-r--r--drivers/macintosh/via-pmu.c36
4 files changed, 20 insertions, 75 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c
index f729eebf771..adfea3c7c62 100644
--- a/drivers/macintosh/adb.c
+++ b/drivers/macintosh/adb.c
@@ -90,7 +90,7 @@ static int autopoll_devs;
int __adb_probe_sync;
#ifdef CONFIG_PM
-static int adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
+static void adb_notify_sleep(struct pmu_sleep_notifier *self, int when);
static struct pmu_sleep_notifier adb_sleep_notifier = {
adb_notify_sleep,
SLEEP_LEVEL_ADB,
@@ -340,11 +340,9 @@ __initcall(adb_init);
/*
* notify clients before sleep and reset bus afterwards
*/
-int
+void
adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
{
- int ret;
-
switch (when) {
case PBOOK_SLEEP_REQUEST:
adb_got_sleep = 1;
@@ -353,22 +351,8 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
/* Stop autopoll */
if (adb_controller->autopoll)
adb_controller->autopoll(0);
- ret = blocking_notifier_call_chain(&adb_client_list,
- ADB_MSG_POWERDOWN, NULL);
- if (ret & NOTIFY_STOP_MASK) {
- up(&adb_probe_mutex);
- return PBOOK_SLEEP_REFUSE;
- }
- break;
- case PBOOK_SLEEP_REJECT:
- if (adb_got_sleep) {
- adb_got_sleep = 0;
- up(&adb_probe_mutex);
- adb_reset_bus();
- }
- break;
-
- case PBOOK_SLEEP_NOW:
+ blocking_notifier_call_chain(&adb_client_list,
+ ADB_MSG_POWERDOWN, NULL);
break;
case PBOOK_WAKE:
adb_got_sleep = 0;
@@ -376,14 +360,13 @@ adb_notify_sleep(struct pmu_sleep_notifier *self, int when)
adb_reset_bus();
break;
}
- return PBOOK_SLEEP_OK;
}
#endif /* CONFIG_PM */
static int
do_adb_reset_bus(void)
{
- int ret, nret;
+ int ret;
if (adb_controller == NULL)
return -ENXIO;
@@ -391,13 +374,8 @@ do_adb_reset_bus(void)
if (adb_controller->autopoll)
adb_controller->autopoll(0);
- nret = blocking_notifier_call_chain(&adb_client_list,
- ADB_MSG_PRE_RESET, NULL);
- if (nret & NOTIFY_STOP_MASK) {
- if (adb_controller->autopoll)
- adb_controller->autopoll(autopoll_devs);
- return -EBUSY;
- }
+ blocking_notifier_call_chain(&adb_client_list,
+ ADB_MSG_PRE_RESET, NULL);
if (sleepy_trackpad) {
/* Let the trackpad settle down */
@@ -427,10 +405,8 @@ do_adb_reset_bus(void)
}
up(&adb_handler_sem);
- nret = blocking_notifier_call_chain(&adb_client_list,
- ADB_MSG_POST_RESET, NULL);
- if (nret & NOTIFY_STOP_MASK)
- return -EBUSY;
+ blocking_notifier_call_chain(&adb_client_list,
+ ADB_MSG_POST_RESET, NULL);
return ret;
}
diff --git a/drivers/macintosh/apm_emu.c b/drivers/macintosh/apm_emu.c
index c5e4d43f97f..cdb0bead991 100644
--- a/drivers/macintosh/apm_emu.c
+++ b/drivers/macintosh/apm_emu.c
@@ -96,7 +96,7 @@ static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
static struct apm_user * user_list;
-static int apm_notify_sleep(struct pmu_sleep_notifier *self, int when);
+static void apm_notify_sleep(struct pmu_sleep_notifier *self, int when);
static struct pmu_sleep_notifier apm_sleep_notifier = {
apm_notify_sleep,
SLEEP_LEVEL_USERLAND,
@@ -352,7 +352,7 @@ static int do_open(struct inode * inode, struct file * filp)
* doesn't provide a way to NAK, but this could be added
* here.
*/
-static int wait_all_suspend(void)
+static void wait_all_suspend(void)
{
DECLARE_WAITQUEUE(wait, current);
@@ -366,24 +366,19 @@ static int wait_all_suspend(void)
remove_wait_queue(&apm_suspend_waitqueue, &wait);
DBG("apm_emu: wait_all_suspend() - complete !\n");
-
- return 1;
}
-static int apm_notify_sleep(struct pmu_sleep_notifier *self, int when)
+static void apm_notify_sleep(struct pmu_sleep_notifier *self, int when)
{
switch(when) {
case PBOOK_SLEEP_REQUEST:
queue_event(APM_SYS_SUSPEND, NULL);
- if (!wait_all_suspend())
- return PBOOK_SLEEP_REFUSE;
+ wait_all_suspend();
break;
- case PBOOK_SLEEP_REJECT:
case PBOOK_WAKE:
queue_event(APM_NORMAL_RESUME, NULL);
break;
}
- return PBOOK_SLEEP_OK;
}
#define APM_CRITICAL 10
diff --git a/drivers/macintosh/via-pmu-led.c b/drivers/macintosh/via-pmu-led.c
index 179af10105d..ed8423f4605 100644
--- a/drivers/macintosh/via-pmu-led.c
+++ b/drivers/macintosh/via-pmu-led.c
@@ -81,7 +81,7 @@ static struct led_classdev pmu_led = {
};
#ifdef CONFIG_PM
-static int pmu_led_sleep_call(struct pmu_sleep_notifier *self, int when)
+static void pmu_led_sleep_call(struct pmu_sleep_notifier *self, int when)
{
unsigned long flags;
@@ -99,8 +99,6 @@ static int pmu_led_sleep_call(struct pmu_sleep_notifier *self, int when)
break;
}
spin_unlock_irqrestore(&pmu_blink_lock, flags);
-
- return PBOOK_SLEEP_OK;
}
static struct pmu_sleep_notifier via_pmu_led_sleep_notif = {
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index b6073bdb50c..ca3c4aba5a2 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1769,35 +1769,21 @@ EXPORT_SYMBOL(pmu_unregister_sleep_notifier);
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
/* Sleep is broadcast last-to-first */
-static int
-broadcast_sleep(int when, int fallback)
+static void broadcast_sleep(int when)
{
- int ret = PBOOK_SLEEP_OK;
struct list_head *list;
struct pmu_sleep_notifier *notifier;
for (list = sleep_notifiers.prev; list != &sleep_notifiers;
list = list->prev) {
notifier = list_entry(list, struct pmu_sleep_notifier, list);
- ret = notifier->notifier_call(notifier, when);
- if (ret != PBOOK_SLEEP_OK) {
- printk(KERN_DEBUG "sleep %d rejected by %p (%p)\n",
- when, notifier, notifier->notifier_call);
- for (; list != &sleep_notifiers; list = list->next) {
- notifier = list_entry(list, struct pmu_sleep_notifier, list);
- notifier->notifier_call(notifier, fallback);
- }
- return ret;
- }
+ notifier->notifier_call(notifier, when);
}
- return ret;
}
/* Wake is broadcast first-to-last */
-static int
-broadcast_wake(void)
+static void broadcast_wake(void)
{
- int ret = PBOOK_SLEEP_OK;
struct list_head *list;
struct pmu_sleep_notifier *notifier;
@@ -1806,7 +1792,6 @@ broadcast_wake(void)
notifier = list_entry(list, struct pmu_sleep_notifier, list);
notifier->notifier_call(notifier, PBOOK_WAKE);
}
- return ret;
}
/*
@@ -2013,12 +1998,8 @@ pmac_suspend_devices(void)
pm_prepare_console();
- /* Notify old-style device drivers & userland */
- ret = broadcast_sleep(PBOOK_SLEEP_REQUEST, PBOOK_SLEEP_REJECT);
- if (ret != PBOOK_SLEEP_OK) {
- printk(KERN_ERR "Sleep rejected by drivers\n");
- return -EBUSY;
- }
+ /* Notify old-style device drivers */
+ broadcast_sleep(PBOOK_SLEEP_REQUEST);
/* Sync the disks. */
/* XXX It would be nice to have some way to ensure that
@@ -2028,12 +2009,7 @@ pmac_suspend_devices(void)
*/
sys_sync();
- /* Sleep can fail now. May not be very robust but useful for debugging */
- ret = broadcast_sleep(PBOOK_SLEEP_NOW, PBOOK_WAKE);
- if (ret != PBOOK_SLEEP_OK) {
- printk(KERN_ERR "Driver sleep failed\n");
- return -EBUSY;
- }
+ broadcast_sleep(PBOOK_SLEEP_NOW);
/* Send suspend call to devices, hold the device core's dpm_sem */
ret = device_suspend(PMSG_SUSPEND);