Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpiec(4): Factor out if (state == FREE) cv_sig...



details:   https://anonhg.NetBSD.org/src/rev/841a1d248b59
branches:  trunk
changeset: 377598:841a1d248b59
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jul 18 10:10:49 2023 +0000

description:
acpiec(4): Factor out if (state == FREE) cv_signal(sc_cv).

In principle this could have a functional change, but at worst, it is
to signal more wakeups than needed, which should always be safe.

diffstat:

 sys/dev/acpi/acpi_ec.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 862e7c224404 -r 841a1d248b59 sys/dev/acpi/acpi_ec.c
--- a/sys/dev/acpi/acpi_ec.c    Tue Jul 18 10:06:55 2023 +0000
+++ b/sys/dev/acpi/acpi_ec.c    Tue Jul 18 10:10:49 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_ec.c,v 1.105 2023/07/18 10:06:55 riastradh Exp $  */
+/*     $NetBSD: acpi_ec.c,v 1.106 2023/07/18 10:10:49 riastradh Exp $  */
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.105 2023/07/18 10:06:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.106 2023/07/18 10:10:49 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_acpi_ec.h"
@@ -967,7 +967,6 @@ acpiec_gpe_state_machine(struct acpiec_s
                        break; /* Nothing of interest here. */
                sc->sc_cur_val = acpiec_read_data(sc);
                sc->sc_state = EC_STATE_FREE;
-               cv_signal(&sc->sc_cv);
                break;
 
        case EC_STATE_READ:
@@ -989,7 +988,6 @@ acpiec_gpe_state_machine(struct acpiec_s
                        break; /* Nothing of interest here. */
                sc->sc_cur_val = acpiec_read_data(sc);
                sc->sc_state = EC_STATE_FREE;
-               cv_signal(&sc->sc_cv);
                break;
 
        case EC_STATE_WRITE:
@@ -1009,9 +1007,8 @@ acpiec_gpe_state_machine(struct acpiec_s
        case EC_STATE_WRITE_VAL:
                if ((reg & EC_STATUS_IBF) != 0)
                        break; /* Nothing of interest here. */
+               acpiec_write_data(sc, sc->sc_cur_val);
                sc->sc_state = EC_STATE_FREE;
-               cv_signal(&sc->sc_cv);
-               acpiec_write_data(sc, sc->sc_cur_val);
                break;
 
        case EC_STATE_FREE:
@@ -1022,10 +1019,12 @@ acpiec_gpe_state_machine(struct acpiec_s
        }
 
        /*
-        * If we just ended a transaction, and an SCI was requested,
-        * notify the SCI thread.
+        * If we are not in a transaction, wake anyone waiting to start
+        * one.  If an SCI was requested, notify the SCI thread that it
+        * needs to handle the SCI.
         */
        if (sc->sc_state == EC_STATE_FREE) {
+               cv_signal(&sc->sc_cv);
                if (reg & EC_STATUS_SCI) {
                        DPRINTF(ACPIEC_DEBUG_TRANSITION, sc,
                            "wake SCI thread\n");



Home | Main Index | Thread Index | Old Index