Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Use deviter_first()/deviter_next() instead of a...



details:   https://anonhg.NetBSD.org/src/rev/736bbf9a39bf
branches:  trunk
changeset: 747640:736bbf9a39bf
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Fri Sep 25 20:26:26 2009 +0000

description:
Use deviter_first()/deviter_next() instead of accessing alldevs
directly.  Compile-tested, only.

diffstat:

 sys/dev/acpi/hpqlb_acpi.c    |   9 ++++++---
 sys/dev/acpi/thinkpad_acpi.c |  10 +++++++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diffs (87 lines):

diff -r 41a821763241 -r 736bbf9a39bf sys/dev/acpi/hpqlb_acpi.c
--- a/sys/dev/acpi/hpqlb_acpi.c Fri Sep 25 19:49:31 2009 +0000
+++ b/sys/dev/acpi/hpqlb_acpi.c Fri Sep 25 20:26:26 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpqlb_acpi.c,v 1.2 2008/05/02 01:53:33 simonb Exp $ */
+/* $NetBSD: hpqlb_acpi.c,v 1.3 2009/09/25 20:26:59 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2008  Christoph Egger <cegger%netbsd.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpqlb_acpi.c,v 1.2 2008/05/02 01:53:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpqlb_acpi.c,v 1.3 2009/09/25 20:26:59 dyoung Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -245,6 +245,7 @@
 hpqlb_finalize(device_t self)
 {
        device_t dv;
+       deviter_t di;
        struct hpqlb_softc *sc = device_private(self);
        static int done_once = 0;
 
@@ -255,7 +256,8 @@
                return 0;
        done_once = 1;
 
-       TAILQ_FOREACH(dv, &alldevs, dv_list) {
+       for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); dv != NULL;
+            dv = deviter_next(&di)) {
                if (!device_is_a(dv, "wskbd"))
                        continue;
 
@@ -268,6 +270,7 @@
                                device_xname(dv));
                break;
        }
+       deviter_release(&di);
 
        if (dv == NULL) {
                aprint_error_dev(self, "WARNING: no matching wskbd found\n");
diff -r 41a821763241 -r 736bbf9a39bf sys/dev/acpi/thinkpad_acpi.c
--- a/sys/dev/acpi/thinkpad_acpi.c      Fri Sep 25 19:49:31 2009 +0000
+++ b/sys/dev/acpi/thinkpad_acpi.c      Fri Sep 25 20:26:26 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.19 2009/05/12 09:29:46 cegger Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.20 2009/09/25 20:26:26 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.19 2009/05/12 09:29:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.20 2009/09/25 20:26:26 dyoung Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -166,6 +166,7 @@
        struct acpi_attach_args *aa = (struct acpi_attach_args *)opaque;
        struct sysmon_pswitch *psw;
        device_t curdev;
+       deviter_t di;
        ACPI_STATUS rv;
        ACPI_INTEGER val;
        int i;
@@ -187,12 +188,15 @@
        }
 
        sc->sc_ecdev = NULL;
-       TAILQ_FOREACH(curdev, &alldevs, dv_list)
+       for (curdev = deviter_first(&di, DEVITER_F_ROOT_FIRST);
+            curdev != NULL; curdev = deviter_next(&di))
                if (device_is_a(curdev, "acpiecdt") ||
                    device_is_a(curdev, "acpiec")) {
                        sc->sc_ecdev = curdev;
                        break;
                }
+       deviter_release(&di);
+
        if (sc->sc_ecdev)
                aprint_debug_dev(self, "using EC at %s\n",
                    device_xname(sc->sc_ecdev));



Home | Main Index | Thread Index | Old Index