Source-Changes-HG archive

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

[src/thorpej-i2c-spi-conf]: src/sys/dev/i2c Rather than using the "cookie" fr...



details:   https://anonhg.NetBSD.org/src/rev/cb45eea1ab26
branches:  thorpej-i2c-spi-conf
changeset: 983201:cb45eea1ab26
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat May 08 15:44:12 2021 +0000

description:
Rather than using the "cookie" from the i2c_attach_args, use the
device handle that's already associated with our device_t.

diffstat:

 sys/dev/i2c/ihidev.c |  13 ++++++-------
 sys/dev/i2c/ihidev.h |   3 +--
 2 files changed, 7 insertions(+), 9 deletions(-)

diffs (72 lines):

diff -r 4c0694a93177 -r cb45eea1ab26 sys/dev/i2c/ihidev.c
--- a/sys/dev/i2c/ihidev.c      Sat May 08 15:10:44 2021 +0000
+++ b/sys/dev/i2c/ihidev.c      Sat May 08 15:44:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.c,v 1.19 2021/04/24 23:36:54 thorpej Exp $ */
+/* $NetBSD: ihidev.c,v 1.19.2.1 2021/05/08 15:44:12 thorpej Exp $ */
 /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
 
 /*-
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.19 2021/04/24 23:36:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.19.2.1 2021/05/08 15:44:12 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,8 +162,7 @@
        sc->sc_addr = ia->ia_addr;
        mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_VM);
 
-       sc->sc_phandle = ia->ia_cookie;
-       if (ia->ia_cookietype != I2C_COOKIE_ACPI) {
+       if (devhandle_type(device_handle(self)) != DEVHANDLE_TYPE_ACPI) {
                aprint_error(": unsupported device tree type\n");
                return;
        }
@@ -651,7 +650,7 @@
 ihiddev_intr_init(struct ihidev_softc *sc)
 {
 #if NACPICA > 0
-       ACPI_HANDLE hdl = (void *)(uintptr_t)sc->sc_phandle;
+       ACPI_HANDLE hdl = devhandle_to_acpi(device_handle(sc->sc_dev));
        struct acpi_resources res;
        ACPI_STATUS rv;
        char buf[100];
@@ -675,7 +674,7 @@
 
        acpi_resource_cleanup(&res);
 
-       sc->sc_ih = acpi_intr_establish(sc->sc_dev, sc->sc_phandle, IPL_TTY,
+       sc->sc_ih = acpi_intr_establish(sc->sc_dev, (uint64_t)hdl, IPL_TTY,
            false, ihidev_intr, sc, device_xname(sc->sc_dev));
        if (sc->sc_ih == NULL) {
                aprint_error_dev(sc->sc_dev, "can't establish interrupt\n");
@@ -977,7 +976,7 @@
 static bool
 ihidev_acpi_get_info(struct ihidev_softc *sc)
 {               
-       ACPI_HANDLE hdl = (void *)(uintptr_t)sc->sc_phandle;
+       ACPI_HANDLE hdl = devhandle_to_acpi(device_handle(sc->sc_dev));
        ACPI_STATUS status;
        ACPI_INTEGER val;
 
diff -r 4c0694a93177 -r cb45eea1ab26 sys/dev/i2c/ihidev.h
--- a/sys/dev/i2c/ihidev.h      Sat May 08 15:10:44 2021 +0000
+++ b/sys/dev/i2c/ihidev.h      Sat May 08 15:44:12 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.h,v 1.4 2020/01/09 04:04:01 thorpej Exp $ */
+/* $NetBSD: ihidev.h,v 1.4.10.1 2021/05/08 15:44:12 thorpej Exp $ */
 /* $OpenBSD ihidev.h,v 1.4 2016/01/31 18:24:35 jcs Exp $ */
 
 /*-
@@ -97,7 +97,6 @@
        device_t        sc_dev;
        i2c_tag_t       sc_tag;
        i2c_addr_t      sc_addr;
-       uint64_t        sc_phandle;
 
        void *          sc_ih;
        void *          sc_sih;



Home | Main Index | Thread Index | Old Index