summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2019-07-19 04:17:34 +0000
committermrg <mrg@NetBSD.org>2019-07-19 04:17:34 +0000
commit5d4e5faeeb4888b92e278faa169bbfc5de93db4d (patch)
tree2ce73b7cb5f1a0a0303c8d5cb453b307ce3ec8a6 /sys/dev/usb
parentce6639ebc5e1d6f856738a09e102ae4997a19614 (diff)
call ure_stop_locked(), not ure_stop(), from ure_init_locked() to
avoid locking botch. fixes assert reported by sc.dying.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_ure.c7
-rw-r--r--sys/dev/usb/usb_subr.c40
2 files changed, 42 insertions, 5 deletions
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index ec10f213ef4..662ce8b38f0 100644
--- a/sys/dev/usb/if_ure.c
+++ b/sys/dev/usb/if_ure.c
@@ -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 void ure_ocp_reg_write(struct ure_softc *, uint16_t, uint16_t);
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 @@ ure_init_locked(struct ifnet *ifp)
/* 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 --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c
index ccf01178642..1d30d3dae0e 100644
--- a/sys/dev/usb/usb_subr.c
+++ b/sys/dev/usb/usb_subr.c
@@ -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 @@ usbd_errstr(usbd_status err)
}
}
+#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)