From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@zip.com.au>,
Nigel Cunningham <ncunningham@linuxmail.org>
Subject: swsusp: try_to_freeze to make freezing hooks nicer
Date: Sat, 25 Dec 2004 22:29:57 +0100 [thread overview]
Message-ID: <20041225212957.GA20169@elf.ucw.cz> (raw)
Hi!
This moves refrigerator changes to sched.h, so that every file
user of refrigerator does not have to include suspend.h, and makes
refrigerator support easier by introducing try_to_freeze. Please
apply,
Pavel
Adapted from patch by Nigel Cunningham
Signed-off-by: Pavel Machek <pavel@suse.cz>
--- linux-cvs/include/linux/sched.h 2004-12-03 16:47:45.000000000 +0100
+++ linux/include/linux/sched.h 2004-12-25 15:51:46.000000000 +0100
@@ -1124,6 +1124,34 @@
#endif
+/* try_to_freeze
+ *
+ * Checks whether we need to enter the refrigerator
+ * and returns 1 if we did so.
+ */
+#ifdef CONFIG_PM
+extern void refrigerator(unsigned long);
+extern int freeze_processes(void);
+extern void thaw_processes(void);
+
+static inline int try_to_freeze(unsigned long refrigerator_flags)
+{
+ if (unlikely(current->flags & PF_FREEZE)) {
+ refrigerator(refrigerator_flags);
+ return 1;
+ } else
+ return 0;
+}
+#else
+static inline void refrigerator(unsigned long flag) {}
+static inline int freeze_processes(void) { BUG(); }
+static inline void thaw_processes(void) {}
+
+static inline int try_to_freeze(unsigned long refrigerator_flags)
+{
+ return 0;
+}
+#endif /* CONFIG_PM */
#endif /* __KERNEL__ */
#endif
--- linux-cvs/include/linux/suspend.h 2004-12-10 22:35:58.000000000 +0100
+++ linux/include/linux/suspend.h 2004-12-01 13:52:10.000000000 +0100
@@ -36,26 +36,16 @@
/* kernel/power/swsusp.c */
extern int software_suspend(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+
+#else
static inline int software_suspend(void)
{
printk("Warning: fake suspend called\n");
return -EPERM;
}
-#endif /* CONFIG_SOFTWARE_SUSPEND */
-
-
-#ifdef CONFIG_PM
-extern void refrigerator(unsigned long);
-extern int freeze_processes(void);
-extern void thaw_processes(void);
-
-extern int pm_prepare_console(void);
-extern void pm_restore_console(void);
-
-#else
-static inline void refrigerator(unsigned long flag) {}
-#endif /* CONFIG_PM */
+#endif
#ifdef CONFIG_SMP
extern void disable_nonboot_cpus(void);
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
reply other threads:[~2004-12-25 21:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20041225212957.GA20169@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=ncunningham@linuxmail.org \
/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
Powered by JetHome