Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Adapt to the sysmon_pswitch interface.



details:   https://anonhg.NetBSD.org/src/rev/9b833e0713ec
branches:  trunk
changeset: 545855:9b833e0713ec
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Apr 17 01:34:14 2003 +0000

description:
Adapt to the sysmon_pswitch interface.

diffstat:

 sys/dev/acpi/acpi_lid.c |  33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diffs (82 lines):

diff -r ef200d61a24b -r 9b833e0713ec sys/dev/acpi/acpi_lid.c
--- a/sys/dev/acpi/acpi_lid.c   Thu Apr 17 01:26:41 2003 +0000
+++ b/sys/dev/acpi/acpi_lid.c   Thu Apr 17 01:34:14 2003 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: acpi_lid.c,v 1.6 2002/10/02 16:33:37 thorpej Exp $     */
+/*     $NetBSD: acpi_lid.c,v 1.7 2003/04/17 01:34:14 thorpej Exp $     */
 
 /*
- * Copyright 2001 Wasabi Systems, Inc.
+ * Copyright 2001, 2003 Wasabi Systems, Inc.
  * All rights reserved.
  *
  * Written by Jason R. Thorpe for Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.6 2002/10/02 16:33:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.7 2003/04/17 01:34:14 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,14 +50,14 @@
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
 
+#include <dev/sysmon/sysmonvar.h>
+
 struct acpilid_softc {
        struct device sc_dev;           /* base device glue */
        struct acpi_devnode *sc_node;   /* our ACPI devnode */
-       int sc_flags;                   /* see below */
+       struct sysmon_pswitch sc_smpsw; /* our sysmon glue */
 };
 
-#define        ACPILID_F_VERBOSE               0x01    /* verbose events */
-
 int    acpilid_match(struct device *, struct cfdata *, void *);
 void   acpilid_attach(struct device *, struct device *, void *);
 
@@ -102,6 +102,14 @@
 
        sc->sc_node = aa->aa_node;
 
+       sc->sc_smpsw.smpsw_name = sc->sc_dev.dv_xname;
+       sc->sc_smpsw.smpsw_type = SMPSW_TYPE_LID;
+       if (sysmon_pswitch_register(&sc->sc_smpsw) != 0) {
+               printf("%s: unable to register with sysmon\n",
+                   sc->sc_dev.dv_xname);
+               return;
+       }
+
        rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle,
            ACPI_DEVICE_NOTIFY, acpilid_notify_handler, sc);
        if (rv != AE_OK) {
@@ -109,9 +117,6 @@
                    sc->sc_dev.dv_xname, rv);
                return;
        }
-
-       /* Display the current state when it changes. */
-       sc->sc_flags = ACPILID_F_VERBOSE;
 }
 
 /*
@@ -129,14 +134,8 @@
            &status) != AE_OK)
                return;
 
-       if (sc->sc_flags & ACPILID_F_VERBOSE)
-               printf("%s: Lid %s\n",
-                   sc->sc_dev.dv_xname,
-                   status == 0 ? "closed " : "open");
-
-       /*
-        * XXX Perform the appropriate action for the new lid status.
-        */
+       sysmon_pswitch_event(&sc->sc_smpsw, status == 0 ?
+           SMPSW_EVENT_PRESSED : SMPSW_EVENT_RELEASED);
 }
 
 /*



Home | Main Index | Thread Index | Old Index