Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb usbnet drivers: From *_uno_init, call *_uno_stop...



details:   https://anonhg.NetBSD.org/src/rev/537e4655ae65
branches:  trunk
changeset: 362546:537e4655ae65
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:55:29 2022 +0000

description:
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:

 sys/dev/usb/if_axe.c  |  6 +++---
 sys/dev/usb/if_axen.c |  6 +++---
 sys/dev/usb/if_cdce.c |  5 ++---
 sys/dev/usb/if_cue.c  |  6 +++---
 sys/dev/usb/if_kue.c  |  7 ++-----
 sys/dev/usb/if_mos.c  |  6 +++---
 sys/dev/usb/if_smsc.c |  6 +++---
 sys/dev/usb/if_url.c  |  6 +++---
 sys/dev/usb/usbnet.c  |  8 +++-----
 sys/dev/usb/usbnet.h  |  5 +----
 10 files changed, 26 insertions(+), 35 deletions(-)

diffs (266 lines):

diff -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_axe.c
--- a/sys/dev/usb/if_axe.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_axe.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        int rxmode;
 
        /* Cancel pending I/O */
-       usbnet_stop(un, ifp, 1);
+       axe_uno_stop(ifp, 1);
 
        /* Reset the ethernet interface. */
        axe_reset(un);
diff -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_axen.c
--- a/sys/dev/usb/if_axen.c     Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_axen.c     Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_cdce.c
--- a/sys/dev/usb/if_cdce.c     Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_cdce.c     Thu Mar 03 05:55:29 2022 +0000
@@ -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@localhost>
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_cue.c
--- a/sys/dev/usb/if_cue.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_cue.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_kue.c
--- a/sys/dev/usb/if_kue.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_kue.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
 
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_mos.c
--- a/sys/dev/usb/if_mos.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_mos.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_smsc.c
--- a/sys/dev/usb/if_smsc.c     Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_smsc.c     Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/if_url.c
--- a/sys/dev/usb/if_url.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/if_url.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
        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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
  *     - 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 -r c96edad68d0c -r 537e4655ae65 sys/dev/usb/usbnet.h
--- a/sys/dev/usb/usbnet.h      Thu Mar 03 05:55:19 2022 +0000
+++ b/sys/dev/usb/usbnet.h      Thu Mar 03 05:55:29 2022 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index