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.
This commit is contained in:
riastradh 2022-03-03 05:55:29 +00:00
parent cd2c73ebff
commit 48639f8993
10 changed files with 26 additions and 35 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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++)

View File

@ -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;

View File

@ -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