From dabdd4e4d04bde060500ac756d380a2629a67c0c Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Mon, 17 Jul 2023 22:57:05 +0000 Subject: [PATCH] device_printf(9): Lock to avoid interleaving output. XXX pullup-9 XXX pullup-10 --- sys/dev/acpi/acpi_ec.c | 6 ++++++ sys/kern/subr_prf.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sys/dev/acpi/acpi_ec.c b/sys/dev/acpi/acpi_ec.c index bd615a0e0d02..9bd17529521d 100644 --- a/sys/dev/acpi/acpi_ec.c +++ b/sys/dev/acpi/acpi_ec.c @@ -937,7 +937,9 @@ acpiec_gpe_state_machine(device_t dv) if (reg & EC_STATUS_SCI) { DPRINTF(ACPIEC_DEBUG_TRANSITION, sc, "recording SCI request\n"); +#ifdef OFFBYSCI sc->sc_got_sci = true; +#endif } switch (sc->sc_state) { @@ -1008,6 +1010,10 @@ acpiec_gpe_state_machine(device_t dv) break; case EC_STATE_FREE: +#ifndef OFFBYSCI + if (reg & EC_STATUS_SCI) + sc->sc_got_sci = true; +#endif if (sc->sc_got_sci) { DPRINTF(ACPIEC_DEBUG_TRANSITION, sc, "waking SCI thread\n"); diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 8b0c95962eef..9e83357f1fe3 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1241,11 +1241,12 @@ device_printf(device_t dev, const char *fmt, ...) { va_list ap; + kprintf_lock(); + kprintf_internal("%s: ", TOCONS|TOLOG, NULL, NULL, device_xname(dev)); va_start(ap, fmt); - printf("%s: ", device_xname(dev)); - vprintf(fmt, ap); + kprintf(fmt, TOCONS|TOLOG, NULL, NULL, ap); va_end(ap); - return; + kprintf_unlock(); } /*