Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Now that we have 1:1 mapping between handles an...
details: https://anonhg.NetBSD.org/src/rev/a7f027bd58fa
branches: trunk
changeset: 755497:a7f027bd58fa
user: jruoho <jruoho%NetBSD.org@localhost>
date: Mon Jun 07 17:28:17 2010 +0000
description:
Now that we have 1:1 mapping between handles and nodes, use the former for
all power resource operations. Eliminates the wrapper functions.
diffstat:
sys/dev/acpi/acpi_power.c | 53 ++++++++++++++++------------------------------
sys/dev/acpi/acpi_power.h | 12 ++++------
sys/dev/acpi/acpi_tz.c | 8 +++---
3 files changed, 28 insertions(+), 45 deletions(-)
diffs (181 lines):
diff -r 74ac266709fa -r a7f027bd58fa sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Mon Jun 07 17:13:52 2010 +0000
+++ b/sys/dev/acpi/acpi_power.c Mon Jun 07 17:28:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.16 2010/06/07 14:07:25 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.17 2010/06/07 17:28:17 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.16 2010/06/07 14:07:25 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.17 2010/06/07 17:28:17 jruoho Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@@ -198,10 +198,12 @@
}
bool
-acpi_power_register(struct acpi_devnode *ad)
+acpi_power_register(ACPI_HANDLE hdl)
{
+ struct acpi_devnode *ad = acpi_get_node(hdl);
- KASSERT(ad != NULL && ad->ad_root != NULL);
+ if (ad == NULL)
+ return false;
if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0)
return false;
@@ -210,11 +212,13 @@
}
void
-acpi_power_deregister(struct acpi_devnode *ad)
+acpi_power_deregister(ACPI_HANDLE hdl)
{
+ struct acpi_devnode *ad = acpi_get_node(hdl);
struct acpi_power_res *res;
- KASSERT(ad != NULL && ad->ad_root != NULL);
+ if (ad == NULL)
+ return;
if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0)
return;
@@ -226,25 +230,18 @@
(void)acpi_power_res_deref(res, ad->ad_handle);
}
-void
-acpi_power_deregister_from_handle(ACPI_HANDLE hdl)
-{
- struct acpi_devnode *ad = acpi_get_node(hdl);
-
- if (ad == NULL)
- return;
-
- acpi_power_deregister(ad);
-}
-
/*
* Get the D-state of an ACPI device node.
*/
bool
-acpi_power_get(struct acpi_devnode *ad, int *state)
+acpi_power_get(ACPI_HANDLE hdl, int *state)
{
+ struct acpi_devnode *ad = acpi_get_node(hdl);
ACPI_STATUS rv;
+ if (ad == NULL)
+ return false;
+
if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
rv = AE_SUPPORT;
goto fail;
@@ -356,13 +353,15 @@
* Set the D-state of an ACPI device node.
*/
bool
-acpi_power_set(struct acpi_devnode *ad, int state)
+acpi_power_set(ACPI_HANDLE hdl, int state)
{
+ struct acpi_devnode *ad = acpi_get_node(hdl);
ACPI_STATUS rv;
char path[5];
int old;
- KASSERT(ad != NULL && ad->ad_root != NULL);
+ if (ad == NULL)
+ return false;
if ((ad->ad_flags & ACPI_DEVICE_POWER) == 0) {
rv = AE_SUPPORT;
@@ -435,20 +434,6 @@
return false;
}
-/*
- * Set the D-state of an ACPI device node from a handle.
- */
-bool
-acpi_power_set_from_handle(ACPI_HANDLE hdl, int state)
-{
- struct acpi_devnode *ad = acpi_get_node(hdl);
-
- if (ad == NULL)
- return false;
-
- return acpi_power_set(ad, state);
-}
-
static ACPI_STATUS
acpi_power_switch(struct acpi_devnode *ad, int state, bool on)
{
diff -r 74ac266709fa -r a7f027bd58fa sys/dev/acpi/acpi_power.h
--- a/sys/dev/acpi/acpi_power.h Mon Jun 07 17:13:52 2010 +0000
+++ b/sys/dev/acpi/acpi_power.h Mon Jun 07 17:28:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.h,v 1.5 2010/06/07 14:07:25 jruoho Exp $ */
+/* $NetBSD: acpi_power.h,v 1.6 2010/06/07 17:28:17 jruoho Exp $ */
/*-
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -34,12 +34,10 @@
#define ACPI_STATE_ERROR -1
-bool acpi_power_register(struct acpi_devnode *);
-void acpi_power_deregister(struct acpi_devnode *);
-void acpi_power_deregister_from_handle(ACPI_HANDLE);
-bool acpi_power_get(struct acpi_devnode *, int *);
-bool acpi_power_set(struct acpi_devnode *, int);
-bool acpi_power_set_from_handle(ACPI_HANDLE, int);
+bool acpi_power_register(ACPI_HANDLE);
+void acpi_power_deregister(ACPI_HANDLE);
+bool acpi_power_get(ACPI_HANDLE, int *);
+bool acpi_power_set(ACPI_HANDLE, int);
ACPI_STATUS acpi_power_res(ACPI_HANDLE, ACPI_HANDLE, bool);
void acpi_power_add(struct acpi_devnode *);
diff -r 74ac266709fa -r a7f027bd58fa sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c Mon Jun 07 17:13:52 2010 +0000
+++ b/sys/dev/acpi/acpi_tz.c Mon Jun 07 17:28:17 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.73 2010/06/01 19:20:43 plunky Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.74 2010/06/07 17:28:17 jruoho Exp $ */
/*
* Copyright (c) 2003 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.73 2010/06/01 19:20:43 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.74 2010/06/07 17:28:17 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -240,7 +240,7 @@
rv = acpi_eval_reference_handle(al.Pointer, &hdl);
if (ACPI_SUCCESS(rv))
- acpi_power_deregister_from_handle(hdl);
+ acpi_power_deregister(hdl);
ACPI_FREE(sc->sc_zone.al[i].Pointer);
}
@@ -406,7 +406,7 @@
if (ACPI_FAILURE(rv))
return rv;
- (void)acpi_power_set_from_handle(cooler, pwr_state);
+ (void)acpi_power_set(cooler, pwr_state);
return AE_OK;
}
Home |
Main Index |
Thread Index |
Old Index