Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb call ure_stop_locked(), not ure_stop(), from ure...



details:   https://anonhg.NetBSD.org/src/rev/e49f529bffb6
branches:  trunk
changeset: 962400:e49f529bffb6
user:      mrg <mrg%NetBSD.org@localhost>
date:      Fri Jul 19 04:17:34 2019 +0000

description:
call ure_stop_locked(), not ure_stop(), from ure_init_locked() to
avoid locking botch.  fixes assert reported by sc.dying.

diffstat:

 sys/dev/usb/if_ure.c   |   7 ++++---
 sys/dev/usb/usb_subr.c |  40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 5 deletions(-)

diffs (96 lines):

diff -r cffc57791aef -r e49f529bffb6 sys/dev/usb/if_ure.c
--- a/sys/dev/usb/if_ure.c      Thu Jul 18 20:10:46 2019 +0000
+++ b/sys/dev/usb/if_ure.c      Fri Jul 19 04:17:34 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ure.c,v 1.13 2019/06/28 01:57:43 mrg Exp $  */
+/*     $NetBSD: if_ure.c,v 1.14 2019/07/19 04:17:34 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.13 2019/06/28 01:57:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14 2019/07/19 04:17:34 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -116,6 +116,7 @@
 
 static int     ure_init(struct ifnet *);
 static void    ure_stop(struct ifnet *, int);
+static void    ure_stop_locked(struct ifnet *, int);
 static void    ure_start(struct ifnet *);
 static void    ure_reset(struct ure_softc *);
 static void    ure_miibus_statchg(struct ifnet *);
@@ -530,7 +531,7 @@
 
        /* Cancel pending I/O. */
        if (ifp->if_flags & IFF_RUNNING)
-               ure_stop(ifp, 1);
+               ure_stop_locked(ifp, 1);
 
        /* Set MAC address. */
        memset(eaddr, 0, sizeof(eaddr));
diff -r cffc57791aef -r e49f529bffb6 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Thu Jul 18 20:10:46 2019 +0000
+++ b/sys/dev/usb/usb_subr.c    Fri Jul 19 04:17:34 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.232 2019/07/06 08:00:19 maxv Exp $      */
+/*     $NetBSD: usb_subr.c,v 1.233 2019/07/19 04:17:34 mrg Exp $       */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.232 2019/07/06 08:00:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.233 2019/07/19 04:17:34 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -113,6 +113,42 @@
        }
 }
 
+#if 0
+int
+usbd_err_to_errno(usbd_status err)
+{
+       switch (err) {
+       case USBD_NORMAL_COMPLETION:
+       case USBD_IN_PROGRESS:
+               return 0;
+       case USBD_PENDING_REQUESTS:
+       case USBD_NOT_STARTED:
+               return EAGAIN;
+       case USBD_INVAL:
+               return EINVAL;
+       case USBD_NOMEM:
+               return ENOMEM;
+       case USBD_CANCELLED: // ?
+       case USBD_INTERRUPTED:
+               return EINTR;
+       case USBD_BAD_ADDRESS:
+               return EFAULT;
+       case USBD_IN_USE:
+       case USBD_NO_ADDR:
+               return EBUSY;
+       case USBD_TOO_DEEP:
+               return ENOSPC;
+       case USBD_NOT_CONFIGURED:
+               return ENXIO;
+       case USBD_TIMEOUT:
+       case USBD_STALLED:
+               return ETIMEDOUT;
+       default:
+               return EIO;
+       }
+}
+#endif
+
 usbd_status
 usbd_get_string_desc(struct usbd_device *dev, int sindex, int langid,
                     usb_string_descriptor_t *sdesc, int *sizep)



Home | Main Index | Thread Index | Old Index