summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-03 05:55:29 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-03 05:55:29 +0000
commit09fba8a14fdec95b46e03e0b9c2a0efe1ae3f64c (patch)
treec8bb8a42522af7e3a970585378e848f28b899d2a /sys/dev
parent520d61f0712f86c69937b476593da7fe782d9af2 (diff)
usbnet drivers: From *_uno_init, call *_uno_stop, not usbnet_stop.
Make usbnet_stop private now that no drivers use it. None of the driver-independent logic in usbnet_stop has any effect at this point because we are guaranteed not to be running, so only the driver-dependent logic in *_uno_stop (at most) is needed. For drivers with no *_uno_stop, just omit the call to usbnet_stop altogether. Some of this logic is obviously redundant with the subsequent call to *_reset -- to be addressed in a subsequent commit.
Diffstat (limited to 'sys/dev')
-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.c5
-rw-r--r--sys/dev/usb/if_cue.c6
-rw-r--r--sys/dev/usb/if_kue.c7
-rw-r--r--sys/dev/usb/if_mos.c6
-rw-r--r--sys/dev/usb/if_smsc.c6
-rw-r--r--sys/dev/usb/if_url.c6
-rw-r--r--sys/dev/usb/usbnet.c8
-rw-r--r--sys/dev/usb/usbnet.h5
10 files changed, 26 insertions, 35 deletions
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index cf6bf508d6c..d9c38ad3bba 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.146 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_axe.c,v 1.147 2022/03/03 05:55:29 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.146 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.147 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1212,7 +1212,7 @@ axe_uno_init(struct ifnet *ifp)
int rxmode;
/* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
+ axe_uno_stop(ifp, 1);
/* Reset the ethernet interface. */
axe_reset(un);
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index 667aeeac39e..a49c043c50f 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.90 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.91 2022/03/03 05:55:29 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.90 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.91 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -877,7 +877,7 @@ axen_uno_init(struct ifnet *ifp)
uint8_t bval;
/* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
+ axen_uno_stop(ifp, 1);
/* Reset the ethernet interface. */
axen_reset(un);
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index 7380e03919c..16f6ecb829a 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.75 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_cdce.c,v 1.76 2022/03/03 05:55:29 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.75 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.76 2022/03/03 05:55:29 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_stop(un, ifp, 1);
rv = usbnet_init_rx_tx(un);
usbnet_set_link(un, rv == 0);
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 7ea4cd2bd10..257ccd229aa 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.103 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_cue.c,v 1.104 2022/03/03 05:55:29 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.103 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.104 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -618,7 +618,7 @@ cue_uno_init(struct ifnet *ifp)
DPRINTFN(10,("%s: %s: enter\n", device_xname(un->un_dev),__func__));
/* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
+ cue_uno_stop(ifp, 1);
/* Reset the interface. */
#if 1
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index 2a0144fdcf8..a2a074fcd47 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.115 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_kue.c,v 1.116 2022/03/03 05:55:29 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.115 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.116 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -599,9 +599,6 @@ kue_uno_init(struct ifnet *ifp)
DPRINTFN(5,("%s: %s: enter\n", device_xname(un->un_dev),__func__));
- /* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
-
memcpy(eaddr, CLLADDR(ifp->if_sadl), sizeof(eaddr));
/* Set MAC address */
kue_ctl(un, KUE_CTL_WRITE, KUE_CMD_SET_MAC, 0, eaddr, ETHER_ADDR_LEN);
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index 5198df0cb7f..d2b371b412f 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.18 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_mos.c,v 1.19 2022/03/03 05:55:29 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.18 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.19 2022/03/03 05:55:29 riastradh Exp $");
#include <sys/param.h>
@@ -733,7 +733,7 @@ mos_uno_init(struct ifnet *ifp)
unsigned char ipgs[2];
/* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
+ mos_uno_stop(ifp, 1);
/* Reset the ethernet interface. */
mos_reset(un);
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index 50393f5e06b..78b485339f3 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.88 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.89 2022/03/03 05:55:29 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.88 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.89 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -556,7 +556,7 @@ smsc_uno_init(struct ifnet *ifp)
struct smsc_softc * const sc = usbnet_softc(un);
/* Cancel pending I/O */
- usbnet_stop(un, ifp, 1);
+ smsc_uno_stop(ifp, 1);
/* Reset the ethernet interface. */
smsc_reset(sc);
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index d15540e537c..9c584ca861a 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.92 2022/03/03 05:55:01 riastradh Exp $ */
+/* $NetBSD: if_url.c,v 1.93 2022/03/03 05:55:29 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.92 2022/03/03 05:55:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.93 2022/03/03 05:55:29 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -371,7 +371,7 @@ url_uno_init(struct ifnet *ifp)
DPRINTF(("%s: %s: enter\n", device_xname(un->un_dev), __func__));
/* Cancel pending I/O and free all TX/RX buffers */
- usbnet_stop(un, ifp, 1);
+ url_uno_stop(ifp, 1);
eaddr = CLLADDR(ifp->if_sadl);
for (i = 0; i < ETHER_ADDR_LEN; i++)
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index b10cd8baf9b..1896e3622d1 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.85 2022/03/03 05:55:10 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.86 2022/03/03 05:55:29 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.85 2022/03/03 05:55:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.86 2022/03/03 05:55:29 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -1077,11 +1077,9 @@ usbnet_if_ioctl(struct ifnet *ifp, u_long cmd, void *data)
* - free RX and TX resources
* - close pipes
*
- * usbnet_stop() is exported for drivers to use, expects lock held.
- *
* usbnet_if_stop() is for the if_stop handler.
*/
-void
+static void
usbnet_stop(struct usbnet *un, struct ifnet *ifp, int disable)
{
struct usbnet_private * const unp = un->un_pri;
diff --git a/sys/dev/usb/usbnet.h b/sys/dev/usb/usbnet.h
index 166e3defa27..36c4b3b0cf5 100644
--- a/sys/dev/usb/usbnet.h
+++ b/sys/dev/usb/usbnet.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.h,v 1.28 2022/03/03 05:54:52 riastradh Exp $ */
+/* $NetBSD: usbnet.h,v 1.29 2022/03/03 05:55:29 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -324,9 +324,6 @@ void usbnet_attach_ifp(struct usbnet *, unsigned, unsigned,
int usbnet_detach(device_t, int);
int usbnet_activate(device_t, devact_t);
-/* stop backend */
-void usbnet_stop(struct usbnet *, struct ifnet *, int);
-
/* module hook up */
#ifdef _MODULE