Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Forgot that the firmware may change the power s...
details: https://anonhg.NetBSD.org/src/rev/e442152545a7
branches: trunk
changeset: 754210:e442152545a7
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Apr 23 19:00:58 2010 +0000
description:
Forgot that the firmware may change the power state behind our back,
so actively query the state when the sysctl(8) is invoked.
diffstat:
sys/dev/acpi/acpi_power.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (45 lines):
diff -r 92dbe0bdb9a3 -r e442152545a7 sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Fri Apr 23 18:51:31 2010 +0000
+++ b/sys/dev/acpi/acpi_power.c Fri Apr 23 19:00:58 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.4 2010/04/23 18:51:31 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.5 2010/04/23 19:00:58 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.4 2010/04/23 18:51:31 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.5 2010/04/23 19:00:58 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -758,7 +758,7 @@
*/
err = sysctl_createv(NULL, 0, &anode, NULL,
CTLFLAG_READONLY, CTLTYPE_STRING, ad->ad_name,
- NULL, acpi_power_sysctl, 0, &ad->ad_state, 0,
+ NULL, acpi_power_sysctl, 0, ad, 0,
CTL_CREATE, CTL_EOL);
if (err != 0)
@@ -769,12 +769,16 @@
static int
acpi_power_sysctl(SYSCTLFN_ARGS)
{
+ struct acpi_devnode *ad;
struct sysctlnode node;
int err, state;
char t[3];
node = *rnode;
- state = *(int *)rnode->sysctl_data;
+ ad = rnode->sysctl_data;
+
+ if (acpi_power_get(ad, &state) != true)
+ state = 0;
(void)memset(t, '\0', sizeof(t));
(void)snprintf(t, sizeof(t), "D%d", state);
Home |
Main Index |
Thread Index |
Old Index