Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic tpm(4): Switch tsleep to kpause.



details:   https://anonhg.NetBSD.org/src/rev/d13b79700b37
branches:  trunk
changeset: 377256:d13b79700b37
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue Jul 04 01:02:26 2023 +0000

description:
tpm(4): Switch tsleep to kpause.

Nothing is interrupt-driven here, so no need for condvars to allow
more prompt wakeups.

diffstat:

 sys/dev/ic/tpm.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r fcb663bebc16 -r d13b79700b37 sys/dev/ic/tpm.c
--- a/sys/dev/ic/tpm.c  Mon Jul 03 21:36:16 2023 +0000
+++ b/sys/dev/ic/tpm.c  Tue Jul 04 01:02:26 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tpm.c,v 1.27 2022/09/25 18:43:32 thorpej Exp $ */
+/*     $NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $       */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.27 2022/09/25 18:43:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.28 2023/07/04 01:02:26 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -113,7 +113,8 @@ tpm_getburst(struct tpm_softc *sc)
                if (burst)
                        return burst;
 
-               rv = tsleep(sc, PCATCH, "tpm_getburst", 1);
+               rv = kpause("tpm_getburst", /*intr*/true, /*timo*/1,
+                   /*lock*/NULL);
                if (rv && rv != EWOULDBLOCK) {
                        return 0;
                }
@@ -359,7 +360,7 @@ tpm_poll(struct tpm_softc *sc, uint8_t m
        int rv;
 
        while (((sc->sc_status = tpm_status(sc)) & mask) != mask && to--) {
-               rv = tsleep(chan, PCATCH, "tpm_poll", 1);
+               rv = kpause("tpm_poll", /*intr*/true, /*timo*/1, /*lock*/NULL);
                if (rv && rv != EWOULDBLOCK) {
                        return rv;
                }
@@ -432,7 +433,8 @@ tpm12_request_locality(struct tpm_softc 
        while ((r = bus_space_read_1(sc->sc_bt, sc->sc_bh, TPM_ACCESS) &
            (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY)) !=
            (TPM_ACCESS_VALID | TPM_ACCESS_ACTIVE_LOCALITY) && to--) {
-               rv = tsleep(sc->sc_intf->init, PCATCH, "tpm_locality", 1);
+               rv = kpause("tpm_locality", /*intr*/true, /*timo*/1,
+                   /*lock*/NULL);
                if (rv && rv != EWOULDBLOCK) {
                        return rv;
                }



Home | Main Index | Thread Index | Old Index