From: Matthew Garrett <mjg59@srcf.ucam.org>
To: Greg KH <greg@kroah.com>
Cc: linux-pm@lists.osdl.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [linux-pm] Re: [PATCH, RFC] [1/3] Generic in-kernel AC status
Date: Wed, 8 Feb 2006 17:49:33 +0000 [thread overview]
Message-ID: <20060208174933.GA30719@srcf.ucam.org> (raw)
In-Reply-To: <20060208171649.GA21373@kroah.com>
On Wed, Feb 08, 2006 at 09:16:49AM -0800, Greg KH wrote:
> kerneldoc will not work with this. It needs to be a one line, short,
> description. Put the full description below the function paramaters, it
> can be as many lines as you want there.
Ok, how's this one?
Signed-Off-By: Matthew Garrett <mjg59@srcf.ucam.org>
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 5be87ba..59ece0f 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -129,6 +129,8 @@ struct pm_ops {
extern void pm_set_ops(struct pm_ops *);
extern struct pm_ops *pm_ops;
+extern void pm_set_ac_status(int (*ac_status_function)(void));
+extern int pm_get_ac_status(void);
extern int pm_suspend(suspend_state_t state);
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 46110d5..31745fb 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -15,7 +15,7 @@
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/pm.h>
-
+#include <linux/module.h>
#include "power.h"
@@ -25,6 +25,7 @@
DECLARE_MUTEX(pm_sem);
struct pm_ops *pm_ops = NULL;
+int (*get_ac_status)(void);
suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
/**
@@ -39,6 +40,41 @@ void pm_set_ops(struct pm_ops * ops)
up(&pm_sem);
}
+/**
+ * pm_set_ac_status - Set the ac status callback.
+ * @ops: Pointer to function
+ *
+ * Provide a callback that returns true if the system is currently on
+ * AC power. This should be called by power management subsystems.
+ */
+
+void pm_set_ac_status(int (*ac_status_function)(void))
+{
+ down(&pm_sem);
+ get_ac_status = ac_status_function;
+ up(&pm_sem);
+}
+EXPORT_SYMBOL_GPL(pm_set_ac_status);
+
+/**
+ * pm_get_ac_status - return true if the system is on AC
+ *
+ * Returns true if the system has a registered callback for determining
+ * AC state and is currently on AC power, false otherwise.
+ */
+
+int pm_get_ac_status(void)
+{
+ int status=0;
+
+ down (&pm_sem);
+ if (get_ac_status)
+ status = get_ac_status();
+ up (&pm_sem);
+
+ return status;
+}
+EXPORT_SYMBOL_GPL(pm_get_ac_status);
/**
* suspend_prepare - Do prep work before entering low-power state.
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2006-02-08 17:49 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 12:57 [PATCH, RFC] [1/3] Generic in-kernel AC status Matthew Garrett
2006-02-08 13:03 ` [PATCH, RFC] [2/3] ACPI support for generic " Matthew Garrett
2006-02-08 13:04 ` [PATCH, RFC] [1/3] Generic " Matthew Garrett
2006-02-08 13:05 ` [PATCH, RFC] [3/3] APM support for generic " Matthew Garrett
2006-02-08 16:58 ` [linux-pm] Re: [PATCH, RFC] [1/3] Generic " Greg KH
2006-02-08 17:08 ` Matthew Garrett
2006-02-08 17:16 ` Greg KH
2006-02-08 17:49 ` Matthew Garrett [this message]
2006-02-09 5:46 ` Greg KH
2006-02-09 8:53 ` Gabor Gombas
2006-02-10 12:21 ` Pavel Machek
2006-02-10 13:13 ` Gabor Gombas
2006-02-10 13:19 ` Matthew Garrett
2006-02-10 13:54 ` Pavel Machek
2006-02-10 13:56 ` Gabor Gombas
2006-02-08 22:25 ` Philipp Matthias Hahn
2006-02-10 12:21 ` Pavel Machek
2006-02-10 8:06 ` Stefan Seyfried
2006-02-10 12:19 ` Pavel Machek
2006-02-10 12:32 ` Stefan Seyfried
2006-02-10 13:46 ` Pavel Machek
2006-02-12 10:17 ` Jan Engelhardt
2006-02-12 11:27 ` Kyle Moffett
2006-02-14 17:44 ` Thomas Renninger
2006-02-14 20:17 ` Rafael J. Wysocki
2006-02-15 12:36 ` Thomas Renninger
2006-02-15 12:47 ` Matthew Garrett
2006-02-15 15:04 ` Thomas Renninger
2006-02-16 22:44 ` Pavel Machek
2006-02-16 22:39 ` 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=20060208174933.GA30719@srcf.ucam.org \
--to=mjg59@srcf.ucam.org \
--cc=greg@kroah.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.osdl.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