summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_aue.c9
-rw-r--r--sys/dev/usb/if_axe.c6
-rw-r--r--sys/dev/usb/if_axen.c6
-rw-r--r--sys/dev/usb/if_cdce.c6
-rw-r--r--sys/dev/usb/if_cue.c6
-rw-r--r--sys/dev/usb/if_kue.c6
-rw-r--r--sys/dev/usb/if_mos.c6
-rw-r--r--sys/dev/usb/if_mue.c6
-rw-r--r--sys/dev/usb/if_smsc.c6
-rw-r--r--sys/dev/usb/if_udav.c9
-rw-r--r--sys/dev/usb/if_upl.c6
-rw-r--r--sys/dev/usb/if_ure.c6
-rw-r--r--sys/dev/usb/if_url.c6
-rw-r--r--sys/dev/usb/if_urndis.c13
-rw-r--r--sys/dev/usb/usbnet.c11
15 files changed, 47 insertions, 61 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 89e2c5f5544..c7dca671f3b 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aue.c,v 1.171 2020/03/18 11:33:32 kre Exp $ */
+/* $NetBSD: if_aue.c,v 1.172 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.171 2020/03/18 11:33:32 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.172 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1000,11 +1000,9 @@ aue_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
usbnet_busy(un);
rv = aue_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rv;
}
@@ -1012,6 +1010,7 @@ aue_uno_init(struct ifnet *ifp)
static int
aue_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
+ struct usbnet * const un = ifp->if_softc;
AUEHIST_FUNC();
AUEHIST_CALLARGSN(5, "aue%jd: enter cmd %#jx data %#jx",
@@ -1021,7 +1020,9 @@ aue_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
switch (cmd) {
case SIOCADDMULTI:
case SIOCDELMULTI:
+ usbnet_lock_core(un);
aue_uno_init(ifp);
+ usbnet_unlock_core(un);
break;
default:
break;
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index eba67386e77..18bfea71d07 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axe.c,v 1.132 2021/03/01 17:41:00 jakllsch Exp $ */
+/* $NetBSD: if_axe.c,v 1.133 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
/*
@@ -87,7 +87,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.132 2021/03/01 17:41:00 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.133 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1317,11 +1317,9 @@ axe_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = axe_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 97587735f23..8552e4b2cc8 100644
--- a/sys/dev/usb/if_axen.c
+++ b/sys/dev/usb/if_axen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_axen.c,v 1.74 2022/03/03 05:48:06 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.75 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */
/*
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.74 2022/03/03 05:48:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.75 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -935,11 +935,9 @@ axen_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = axen_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index 3edf73d856c..76d3c687204 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cdce.c,v 1.72 2020/05/15 19:28:10 maxv Exp $ */
+/* $NetBSD: if_cdce.c,v 1.73 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.72 2020/05/15 19:28:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.73 2022/03/03 05:50:22 riastradh Exp $");
#include <sys/param.h>
@@ -261,7 +261,6 @@ cdce_uno_init(struct ifnet *ifp)
struct usbnet *un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
if (usbnet_isdying(un))
rv = EIO;
else {
@@ -269,7 +268,6 @@ cdce_uno_init(struct ifnet *ifp)
rv = usbnet_init_rx_tx(un);
usbnet_set_link(un, rv == 0);
}
- usbnet_unlock_core(un);
return rv;
}
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index b810408b2c7..0fb79daa239 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_cue.c,v 1.92 2022/03/03 05:49:51 riastradh Exp $ */
+/* $NetBSD: if_cue.c,v 1.93 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.92 2022/03/03 05:49:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.93 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -673,11 +673,9 @@ cue_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
usbnet_busy(un);
rv = cue_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rv;
}
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 172bc93fa30..2de25539682 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_kue.c,v 1.105 2021/06/13 09:26:24 mlelstv Exp $ */
+/* $NetBSD: if_kue.c,v 1.106 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.105 2021/06/13 09:26:24 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.106 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -633,11 +633,9 @@ kue_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
usbnet_busy(un);
rv = kue_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rv;
}
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index 347104b7b0d..a8341fdea31 100644
--- a/sys/dev/usb/if_mos.c
+++ b/sys/dev/usb/if_mos.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mos.c,v 1.7 2020/04/02 04:09:36 nisimura Exp $ */
+/* $NetBSD: if_mos.c,v 1.8 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_mos.c,v 1.40 2019/07/07 06:40:10 kevlo Exp $ */
/*
@@ -72,7 +72,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.7 2020/04/02 04:09:36 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.8 2022/03/03 05:50:22 riastradh Exp $");
#include <sys/param.h>
@@ -760,11 +760,9 @@ mos_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = mos_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_mue.c b/sys/dev/usb/if_mue.c
index c347e02e01b..19f9f919bc9 100644
--- a/sys/dev/usb/if_mue.c
+++ b/sys/dev/usb/if_mue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_mue.c,v 1.63 2022/03/03 05:48:06 riastradh Exp $ */
+/* $NetBSD: if_mue.c,v 1.64 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */
/*
@@ -20,7 +20,7 @@
/* Driver for Microchip LAN7500/LAN7800 chipsets. */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.63 2022/03/03 05:48:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.64 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1255,11 +1255,9 @@ mue_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
usbnet_busy(un);
rv = mue_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rv;
}
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index 82e9f3da243..65a8cf16f31 100644
--- a/sys/dev/usb/if_smsc.c
+++ b/sys/dev/usb/if_smsc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_smsc.c,v 1.71 2022/03/03 05:48:06 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.72 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */
/* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.71 2022/03/03 05:48:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.72 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -552,11 +552,9 @@ smsc_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = smsc_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index a38a83a53df..259b6496816 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_udav.c,v 1.78 2021/04/02 09:27:44 skrll Exp $ */
+/* $NetBSD: if_udav.c,v 1.79 2022/03/03 05:50:22 riastradh Exp $ */
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
/*
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.78 2021/04/02 09:27:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.79 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -478,10 +478,7 @@ udav_uno_init(struct ifnet *ifp)
DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__));
- usbnet_lock_core(un);
-
if (usbnet_isdying(un)) {
- usbnet_unlock_core(un);
return EIO;
}
@@ -522,7 +519,6 @@ udav_uno_init(struct ifnet *ifp)
if (rc != 0) {
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rc;
}
@@ -532,7 +528,6 @@ udav_uno_init(struct ifnet *ifp)
rc = usbnet_init_rx_tx(un);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return rc;
}
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index fb99702f160..5ca19d2a4c6 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_upl.c,v 1.71 2020/03/15 23:04:51 thorpej Exp $ */
+/* $NetBSD: if_upl.c,v 1.72 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.71 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.72 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -257,12 +257,10 @@ upl_uno_init(struct ifnet *ifp)
struct usbnet * const un = ifp->if_softc;
int rv;
- usbnet_lock_core(un);
if (usbnet_isdying(un))
rv = EIO;
else
rv = usbnet_init_rx_tx(un);
- usbnet_unlock_core(un);
return rv;
}
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index ea5b3023dd3..5398746828a 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.40 2020/03/27 18:04:45 nisimura Exp $ */
+/* $NetBSD: if_ure.c,v 1.41 2022/03/03 05:50:22 riastradh 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.40 2020/03/27 18:04:45 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.41 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -456,11 +456,9 @@ ure_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = ure_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index 9962e4beeeb..3b92d71dfe1 100644
--- a/sys/dev/usb/if_url.c
+++ b/sys/dev/usb/if_url.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_url.c,v 1.78 2022/03/03 05:48:14 riastradh Exp $ */
+/* $NetBSD: if_url.c,v 1.79 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.78 2022/03/03 05:48:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.79 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -408,11 +408,9 @@ url_uno_init(struct ifnet *ifp)
{
struct usbnet * const un = ifp->if_softc;
- usbnet_lock_core(un);
usbnet_busy(un);
int ret = url_init_locked(ifp);
usbnet_unbusy(un);
- usbnet_unlock_core(un);
return ret;
}
diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 381207450d7..0993dcea535 100644
--- a/sys/dev/usb/if_urndis.c
+++ b/sys/dev/usb/if_urndis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urndis.c,v 1.39 2020/03/15 23:04:51 thorpej Exp $ */
+/* $NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $ */
/* $OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
/*
@@ -21,7 +21,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.39 2020/03/15 23:04:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -883,8 +883,15 @@ static int
urndis_uno_init(struct ifnet *ifp)
{
struct usbnet *un = ifp->if_softc;
+ int error;
- return urndis_init_un(ifp, un);
+ KASSERT(IFNET_LOCKED(ifp));
+
+ usbnet_unlock_core(un);
+ error = urndis_init_un(ifp, un);
+ usbnet_lock_core(un);
+
+ return error;
}
static int
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index 9ba615da433..71f650ed980 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.70 2022/03/03 05:50:12 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.71 2022/03/03 05:50:22 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.70 2022/03/03 05:50:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.71 2022/03/03 05:50:22 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1291,6 +1291,7 @@ usbnet_if_init(struct ifnet *ifp)
USBNETHIST_FUNC(); USBNETHIST_CALLED();
struct usbnet * const un = ifp->if_softc;
bool dying;
+ int error;
KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
@@ -1304,7 +1305,11 @@ usbnet_if_init(struct ifnet *ifp)
if (dying)
return EIO;
- return uno_init(un, ifp);
+ mutex_enter(&un->un_pri->unp_core_lock);
+ error = uno_init(un, ifp);
+ mutex_exit(&un->un_pri->unp_core_lock);
+
+ return error;
}