From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: pm list <linux-pm@lists.linux-foundation.org>
Cc: Pavel Machek <pavel@ucw.cz>
Subject: [PATCH 2/3] Freezer: Return int from freeze_processes
Date: Sat, 26 May 2007 23:24:34 +0200 [thread overview]
Message-ID: <200705262324.34869.rjw@sisk.pl> (raw)
In-Reply-To: <200705262317.48604.rjw@sisk.pl>
From: Rafael J. Wysocki <rjw@sisk.pl>
Make try_to_freeze_tasks() and freeze_processes() return -EBUSY on failure
instead of the number of unfrozen tasks (none of the callers actually uses this
number).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
kernel/power/process.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
Index: linux-2.6.22-rc2/kernel/power/process.c
===================================================================
--- linux-2.6.22-rc2.orig/kernel/power/process.c
+++ linux-2.6.22-rc2/kernel/power/process.c
@@ -105,7 +105,7 @@ static void cancel_freezing(struct task_
}
}
-static unsigned int try_to_freeze_tasks(int freeze_user_space)
+static int try_to_freeze_tasks(int freeze_user_space)
{
struct task_struct *g, *p;
unsigned long end_time;
@@ -175,28 +175,25 @@ static unsigned int try_to_freeze_tasks(
read_unlock(&tasklist_lock);
}
- return todo;
+ return todo ? -EBUSY : 0;
}
/**
* freeze_processes - tell processes to enter the refrigerator
- *
- * Returns 0 on success, or the number of processes that didn't freeze,
- * although they were told to.
*/
int freeze_processes(void)
{
- unsigned int nr_unfrozen;
+ int error;
printk("Stopping tasks ... ");
- nr_unfrozen = try_to_freeze_tasks(FREEZER_USER_SPACE);
- if (nr_unfrozen)
- return nr_unfrozen;
+ error = try_to_freeze_tasks(FREEZER_USER_SPACE);
+ if (error)
+ return error;
sys_sync();
- nr_unfrozen = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
- if (nr_unfrozen)
- return nr_unfrozen;
+ error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
+ if (error)
+ return error;
printk("done.\n");
BUG_ON(in_atomic());
next prev parent reply other threads:[~2007-05-26 21:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-26 21:17 [PATCH 0/3] Freezer cleanups Rafael J. Wysocki
2007-05-26 21:20 ` [PATCH 1/3] Freezer: Use __set_current_state in refrigerator Rafael J. Wysocki
2007-05-26 23:15 ` Pavel Machek
2007-05-26 21:24 ` Rafael J. Wysocki [this message]
2007-05-26 23:17 ` [PATCH 2/3] Freezer: Return int from freeze_processes Pavel Machek
2007-05-26 21:29 ` [PATCH 3/3] Freezer: Remove redundant check in try_to_freeze_tasks Rafael J. Wysocki
2007-05-26 23:18 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200705262324.34869.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox