Source-Changes-HG archive

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

[src/thorpej-cfargs]: src/sys/dev/acpi Pass CFARG_DEVHANDLE to config_found()...



details:   https://anonhg.NetBSD.org/src/rev/05fad6b4dd8e
branches:  thorpej-cfargs
changeset: 1019751:05fad6b4dd8e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Apr 03 16:10:39 2021 +0000

description:
Pass CFARG_DEVHANDLE to config_found(), rather than setting the device
handle in acpi_device_register().

diffstat:

 sys/dev/acpi/acpi.c |  19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diffs (68 lines):

diff -r a9e9a50709de -r 05fad6b4dd8e sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Sat Apr 03 16:09:44 2021 +0000
+++ b/sys/dev/acpi/acpi.c       Sat Apr 03 16:10:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.290.2.2 2021/04/02 22:17:43 thorpej Exp $   */
+/*     $NetBSD: acpi.c,v 1.290.2.3 2021/04/03 16:10:39 thorpej Exp $   */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.290.2.2 2021/04/02 22:17:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.290.2.3 2021/04/03 16:10:39 thorpej Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -951,6 +951,8 @@
                if (acpi_match_hid(ad->ad_devinfo, acpi_early_ids) == 0)
                        continue;
 
+               KASSERT(ad->ad_handle != NULL);
+
                aa.aa_node = ad;
                aa.aa_iot = sc->sc_iot;
                aa.aa_memt = sc->sc_memt;
@@ -964,6 +966,7 @@
 
                ad->ad_device = config_found(sc->sc_dev, &aa, acpi_print,
                    CFARG_IATTR, "acpinodebus",
+                   CFARG_DEVHANDLE, devhandle_from_acpi(ad->ad_handle),
                    CFARG_EOL);
        }
 }
@@ -1016,6 +1019,8 @@
                if (acpi_match_hid(di, hpet_ids) != 0 && sc->sc_hpet != NULL)
                        continue;
 
+               KASSERT(ad->ad_handle != NULL);
+
                aa.aa_node = ad;
                aa.aa_iot = sc->sc_iot;
                aa.aa_memt = sc->sc_memt;
@@ -1029,6 +1034,7 @@
 
                ad->ad_device = config_found(sc->sc_dev, &aa, acpi_print,
                    CFARG_IATTR, "acpinodebus",
+                   CFARG_DEVHANDLE, devhandle_from_acpi(ad->ad_handle),
                    CFARG_EOL);
        }
 }
@@ -1151,14 +1157,7 @@
        device_t parent = device_parent(dev);
        ACPI_HANDLE hdl = NULL;
 
-       /*
-        * aa_node is only valid if we attached to the "acpinodebus"
-        * interface attribute.
-        */
-       if (device_attached_to_iattr(dev, "acpinodebus")) {
-               const struct acpi_attach_args *aa = v;
-               hdl = aa->aa_node->ad_handle;
-       } else if (device_is_a(parent, "pci")) {
+       if (device_is_a(parent, "pci")) {
                const struct pci_attach_args *pa = v;
                struct acpi_devnode *ad;
                u_int segment;



Home | Main Index | Thread Index | Old Index