Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb actually set ure_stopping, and don't follow it i...



details:   https://anonhg.NetBSD.org/src/rev/425d119dd07d
branches:  trunk
changeset: 452250:425d119dd07d
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jun 24 04:42:06 2019 +0000

description:
actually set ure_stopping, and don't follow it in init.

pointed out by sc.dying on source-changes-d.  thanks.

diffstat:

 sys/dev/usb/if_ure.c |  13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r c3ebe3139f41 -r 425d119dd07d sys/dev/usb/if_ure.c
--- a/sys/dev/usb/if_ure.c      Mon Jun 24 02:48:51 2019 +0000
+++ b/sys/dev/usb/if_ure.c      Mon Jun 24 04:42:06 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ure.c,v 1.11 2019/06/23 02:14:14 mrg Exp $  */
+/*     $NetBSD: if_ure.c,v 1.12 2019/06/24 04:42:06 mrg Exp $  */
 
 /*     $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.11 2019/06/23 02:14:14 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.12 2019/06/24 04:42:06 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -521,7 +521,7 @@
 
        KASSERT(mutex_owned(&sc->ure_lock));
 
-       if (sc->ure_stopping || sc->ure_dying)
+       if (sc->ure_dying)
                return EIO;
 
        /* Cancel pending I/O. */
@@ -689,6 +689,13 @@
        usbd_status err;
        int i;
 
+       KASSERT(mutex_owned(&sc->ure_lock));
+       mutex_enter(&sc->ure_rxlock);
+       mutex_enter(&sc->ure_txlock);
+       sc->ure_stopping = true;
+       mutex_exit(&sc->ure_txlock);
+       mutex_exit(&sc->ure_rxlock);
+
        ure_reset(sc);
 
        ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);



Home | Main Index | Thread Index | Old Index