From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Len Brown <lenb@kernel.org>
Subject: [PATCH 1/3] ACPI / PM: More visible function for retrieving device power states
Date: Wed, 05 Dec 2012 01:40:26 +0100 [thread overview]
Message-ID: <7406201.5441t27pIL@vostro.rjw.lan> (raw)
In-Reply-To: <1464990.iyrX0DeZyT@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The function used for retrieving ACPI device power states,
__acpi_bus_get_power(), is now static, because it is only used
internally in drivers/acpi/bus.c. However, it will be used
outside of that file going forward, so rename it to
acpi_device_get_power(), in analogy with acpi_device_set_power(),
add a kerneldoc comment to it and add its header to acpi_bus.h.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/bus.c | 15 ++++++++++++---
include/acpi/acpi_bus.h | 1 +
2 files changed, 13 insertions(+), 3 deletions(-)
Index: linux/drivers/acpi/bus.c
===================================================================
--- linux.orig/drivers/acpi/bus.c
+++ linux/drivers/acpi/bus.c
@@ -200,7 +200,16 @@ static const char *state_string(int stat
}
}
-static int __acpi_bus_get_power(struct acpi_device *device, int *state)
+/**
+ * acpi_device_get_power - Get power state of an ACPI device.
+ * @device: Device to get the power state of.
+ * @state: Place to store the power state of the device.
+ *
+ * This function does not update the device's power.state field, but it may
+ * update its parent's power.state field (when the parent's power state is
+ * unknown and the device's power state turns out to be D0).
+ */
+int acpi_device_get_power(struct acpi_device *device, int *state)
{
int result = ACPI_STATE_UNKNOWN;
@@ -389,7 +398,7 @@ int acpi_bus_init_power(struct acpi_devi
device->power.state = ACPI_STATE_UNKNOWN;
- result = __acpi_bus_get_power(device, &state);
+ result = acpi_device_get_power(device, &state);
if (result)
return result;
@@ -413,7 +422,7 @@ int acpi_bus_update_power(acpi_handle ha
if (result)
return result;
- result = __acpi_bus_get_power(device, &state);
+ result = acpi_device_get_power(device, &state);
if (result)
return result;
Index: linux/include/acpi/acpi_bus.h
===================================================================
--- linux.orig/include/acpi/acpi_bus.h
+++ linux/include/acpi/acpi_bus.h
@@ -340,6 +340,7 @@ acpi_status acpi_bus_get_status_handle(a
unsigned long long *sta);
int acpi_bus_get_status(struct acpi_device *device);
int acpi_bus_set_power(acpi_handle handle, int state);
+int acpi_device_get_power(struct acpi_device *device, int *state);
int acpi_device_set_power(struct acpi_device *device, int state);
int acpi_bus_update_power(acpi_handle handle, int *state_p);
bool acpi_bus_power_manageable(acpi_handle handle);
next prev parent reply other threads:[~2012-12-05 0:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 0:39 [PATCH 0/3] ACPI / PM: Export ACPI power states of devices via sysfs Rafael J. Wysocki
2012-12-05 0:40 ` Rafael J. Wysocki [this message]
2012-12-05 0:41 ` [PATCH 2/3] ACPI / PM: Common string representations of device power states Rafael J. Wysocki
2012-12-05 0:42 ` [PATCH 3/3] ACPI / PM: Export power states of ACPI devices via sysfs Rafael J. Wysocki
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=7406201.5441t27pIL@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.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