Module Name: src Committed By: riastradh Date: Tue Jul 18 10:06:33 UTC 2023
Modified Files: src/sys/dev/acpi: acpi_ec.c Log Message: acpiec(4): Pass softc, not device_t, to acpiec_read/write. Simpler, type-safer. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/dev/acpi/acpi_ec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi_ec.c diff -u src/sys/dev/acpi/acpi_ec.c:1.102 src/sys/dev/acpi/acpi_ec.c:1.103 --- src/sys/dev/acpi/acpi_ec.c:1.102 Tue Jul 18 10:06:22 2023 +++ src/sys/dev/acpi/acpi_ec.c Tue Jul 18 10:06:33 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_ec.c,v 1.102 2023/07/18 10:06:22 riastradh Exp $ */ +/* $NetBSD: acpi_ec.c,v 1.103 2023/07/18 10:06:33 riastradh Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger <jo...@netbsd.org>. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.102 2023/07/18 10:06:22 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.103 2023/07/18 10:06:33 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_acpi_ec.h" @@ -697,9 +697,8 @@ acpiec_wait_timeout(struct acpiec_softc } static ACPI_STATUS -acpiec_read(device_t dv, uint8_t addr, uint8_t *val) +acpiec_read(struct acpiec_softc *sc, uint8_t addr, uint8_t *val) { - struct acpiec_softc *sc = device_private(dv); ACPI_STATUS rv; acpiec_lock(sc); @@ -736,9 +735,8 @@ out: mutex_exit(&sc->sc_mtx); } static ACPI_STATUS -acpiec_write(device_t dv, uint8_t addr, uint8_t val) +acpiec_write(struct acpiec_softc *sc, uint8_t addr, uint8_t val) { - struct acpiec_softc *sc = device_private(dv); ACPI_STATUS rv; acpiec_lock(sc); @@ -810,7 +808,8 @@ static ACPI_STATUS acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr, uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg) { - device_t dv; + device_t dv = arg; + struct acpiec_softc *sc = device_private(dv); ACPI_STATUS rv; uint8_t addr, *buf; unsigned int i; @@ -820,7 +819,6 @@ acpiec_space_handler(uint32_t func, ACPI return AE_BAD_PARAMETER; addr = paddr; - dv = arg; buf = (uint8_t *)value; rv = AE_OK; @@ -828,7 +826,7 @@ acpiec_space_handler(uint32_t func, ACPI switch (func) { case ACPI_READ: for (i = 0; i < width; i += 8, ++addr, ++buf) { - rv = acpiec_read(dv, addr, buf); + rv = acpiec_read(sc, addr, buf); if (rv != AE_OK) break; } @@ -841,14 +839,15 @@ acpiec_space_handler(uint32_t func, ACPI break; case ACPI_WRITE: for (i = 0; i < width; i += 8, ++addr, ++buf) { - rv = acpiec_write(dv, addr, *buf); + rv = acpiec_write(sc, addr, *buf); if (rv != AE_OK) break; } break; default: - aprint_error("%s: invalid Address Space function called: %x\n", - device_xname(dv), (unsigned int)func); + aprint_error_dev(sc->sc_dev, + "invalid Address Space function called: %x\n", + (unsigned int)func); return AE_BAD_PARAMETER; }