Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Serialize sending of firmware commands to device.



details:   https://anonhg.NetBSD.org/src/rev/de641c50b69e
branches:  trunk
changeset: 1023593:de641c50b69e
user:      nat <nat%NetBSD.org@localhost>
date:      Fri Sep 17 12:58:31 2021 +0000

description:
Serialize sending of firmware commands to device.

diffstat:

 sys/dev/usb/if_urtwn.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 627c8cdeea08 -r de641c50b69e sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Fri Sep 17 12:55:10 2021 +0000
+++ b/sys/dev/usb/if_urtwn.c    Fri Sep 17 12:58:31 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $        */
+/*     $NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $        */
 /*     $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $       */
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.97 2021/09/17 12:55:10 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.98 2021/09/17 12:58:31 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1106,7 +1106,6 @@
        mutex_enter(&sc->sc_fwcmd_mtx);
        fwcur = sc->fwcur;
        sc->fwcur = (sc->fwcur + 1) % R92C_H2C_NBOX;
-       mutex_exit(&sc->sc_fwcmd_mtx);
 
        /* Wait for current FW box to be empty. */
        for (ntries = 0; ntries < 100; ntries++) {
@@ -1117,6 +1116,7 @@
        if (ntries == 100) {
                aprint_error_dev(sc->sc_dev,
                    "could not send firmware command %d\n", id);
+               mutex_exit(&sc->sc_fwcmd_mtx);
                return ETIMEDOUT;
        }
 
@@ -1145,6 +1145,7 @@
        } else {
                urtwn_write_region(sc, R92C_HMEBOX(fwcur), cp, len);
        }
+       mutex_exit(&sc->sc_fwcmd_mtx);
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index