summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-03-03 05:56:09 +0000
committerriastradh <riastradh@NetBSD.org>2022-03-03 05:56:09 +0000
commitae3a079bdca95c7bd6f86efccb02d0c63b6275d5 (patch)
tree2b65dc2c9ed545b7f6262519ab8f61af073fd369 /sys/dev
parent1259ae721995d38dc3292a7f90e140f057e725ef (diff)
usbnet: Factor usbnet_init_rx_tx out into usbnet_if_init.
Make it private; no need for drivers to call it any more.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_aue.c6
-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.c7
-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.c6
-rw-r--r--sys/dev/usb/if_upl.c7
-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.c6
-rw-r--r--sys/dev/usb/usbnet.c13
-rw-r--r--sys/dev/usb/usbnet.h5
16 files changed, 52 insertions, 52 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 865d78224fb..042e930f334 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.188 2022/03/03 05:55:19 riastradh Exp $ */
+/* $NetBSD: if_aue.c,v 1.189 2022/03/03 05:56:09 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.188 2022/03/03 05:55:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.189 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -972,7 +972,7 @@ aue_uno_init(struct ifnet *ifp)
AUE_SETBIT(sc, AUE_CTL0, AUE_CTL0_TX_ENB);
AUE_SETBIT(sc, AUE_CTL2, AUE_CTL2_EP3_CLR);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index c95307fe15d..8b857075f18 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.148 2022/03/03 05:55:38 riastradh Exp $ */
+/* $NetBSD: if_axe.c,v 1.149 2022/03/03 05:56:09 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.148 2022/03/03 05:55:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.149 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1286,7 +1286,7 @@ axe_uno_init(struct ifnet *ifp)
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c
index a49c043c50f..fa9ce7551b9 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.91 2022/03/03 05:55:29 riastradh Exp $ */
+/* $NetBSD: if_axen.c,v 1.92 2022/03/03 05:56:09 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.91 2022/03/03 05:55:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.92 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -896,7 +896,7 @@ axen_uno_init(struct ifnet *ifp)
wval = htole16(rxmode);
axen_cmd(un, AXEN_CMD_MAC_WRITE2, 2, AXEN_MAC_RXCTL, &wval);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index 948c8e32797..44db06c6716 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.78 2022/03/03 05:56:00 riastradh Exp $ */
+/* $NetBSD: if_cdce.c,v 1.79 2022/03/03 05:56:09 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.78 2022/03/03 05:56:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.79 2022/03/03 05:56:09 riastradh Exp $");
#include <sys/param.h>
@@ -258,9 +258,8 @@ cdce_attach(device_t parent, device_t self, void *aux)
static int
cdce_uno_init(struct ifnet *ifp)
{
- struct usbnet *un = ifp->if_softc;
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 257ccd229aa..b56307c73b4 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.104 2022/03/03 05:55:29 riastradh Exp $ */
+/* $NetBSD: if_cue.c,v 1.105 2022/03/03 05:56:09 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.104 2022/03/03 05:55:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.105 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -654,7 +654,7 @@ cue_uno_init(struct ifnet *ifp)
/* Program the LED operation. */
cue_csr_write_1(un, CUE_LEDCTL, CUE_LEDCTL_FOLLOW_LINK);
- return usbnet_init_rx_tx(un);
+ return 0;
}
/* Stop and reset the adapter. */
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index a2a074fcd47..b99d79100d5 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.116 2022/03/03 05:55:29 riastradh Exp $ */
+/* $NetBSD: if_kue.c,v 1.117 2022/03/03 05:56:09 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.116 2022/03/03 05:55:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.117 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -615,7 +615,7 @@ kue_uno_init(struct ifnet *ifp)
#endif
kue_setword(un, KUE_CMD_SET_URB_SIZE, 64);
- return usbnet_init_rx_tx(un);
+ return 0;
}
#ifdef _MODULE
diff --git a/sys/dev/usb/if_mos.c b/sys/dev/usb/if_mos.c
index 432d7ca87bc..26277a41ca8 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.20 2022/03/03 05:55:38 riastradh Exp $ */
+/* $NetBSD: if_mos.c,v 1.21 2022/03/03 05:56:09 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.20 2022/03/03 05:55:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mos.c,v 1.21 2022/03/03 05:56:09 riastradh Exp $");
#include <sys/param.h>
@@ -750,7 +750,7 @@ mos_uno_init(struct ifnet *ifp)
rxmode &= ~(MOS_CTL_SLEEP);
mos_reg_write_1(un, MOS_CTL, rxmode);
- return usbnet_init_rx_tx(un);
+ return 0;
}
void
diff --git a/sys/dev/usb/if_mue.c b/sys/dev/usb/if_mue.c
index a70bce98560..c74dc8d31a9 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.79 2022/03/03 05:55:19 riastradh Exp $ */
+/* $NetBSD: if_mue.c,v 1.80 2022/03/03 05:56:09 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.79 2022/03/03 05:55:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.80 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -1244,7 +1244,7 @@ mue_uno_init(struct ifnet *ifp)
/* Set MTU. */
mue_setmtu_locked(un);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static int
diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c
index c24ae308f3d..34a8f152997 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.90 2022/03/03 05:55:38 riastradh Exp $ */
+/* $NetBSD: if_smsc.c,v 1.91 2022/03/03 05:56:09 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.90 2022/03/03 05:55:38 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.91 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -561,7 +561,7 @@ smsc_uno_init(struct ifnet *ifp)
/* TCP/UDP checksum offload engines. */
smsc_setoe_locked(un);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 7babb913db5..276968592eb 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.95 2022/03/03 05:56:00 riastradh Exp $ */
+/* $NetBSD: if_udav.c,v 1.96 2022/03/03 05:56:09 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.95 2022/03/03 05:56:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.96 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -504,7 +504,7 @@ udav_uno_init(struct ifnet *ifp)
if (usbnet_isdying(un))
return EIO;
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index aa41953cd43..a8341070e6a 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.74 2022/03/03 05:56:00 riastradh Exp $ */
+/* $NetBSD: if_upl.c,v 1.75 2022/03/03 05:56:09 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.74 2022/03/03 05:56:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.75 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -254,9 +254,8 @@ upl_uno_tx_prepare(struct usbnet *un, struct mbuf *m, struct usbnet_chain *c)
static int
upl_uno_init(struct ifnet *ifp)
{
- struct usbnet * const un = ifp->if_softc;
- return usbnet_init_rx_tx(un);
+ return 0;
}
static int
diff --git a/sys/dev/usb/if_ure.c b/sys/dev/usb/if_ure.c
index c3ea4d524ae..d7209de0821 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.54 2022/03/03 05:55:19 riastradh Exp $ */
+/* $NetBSD: if_ure.c,v 1.55 2022/03/03 05:56:09 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.54 2022/03/03 05:55:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.55 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -438,7 +438,7 @@ ure_uno_init(struct ifnet *ifp)
ure_read_2(un, URE_PLA_MISC_1, URE_MCU_TYPE_PLA) &
~URE_RXDY_GATED_EN);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c
index 89edeb6ad26..3fb4eeb07f7 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.94 2022/03/03 05:55:45 riastradh Exp $ */
+/* $NetBSD: if_url.c,v 1.95 2022/03/03 05:56:09 riastradh Exp $ */
/*
* Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.94 2022/03/03 05:55:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.95 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -388,7 +388,7 @@ url_uno_init(struct ifnet *ifp)
/* Enable RX and TX */
URL_SETBIT(un, URL_CR, URL_CR_TE | URL_CR_RE);
- return usbnet_init_rx_tx(un);
+ return 0;
}
static void
diff --git a/sys/dev/usb/if_urndis.c b/sys/dev/usb/if_urndis.c
index 7e2ec9982e5..a7da7150b1d 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.44 2022/03/03 05:56:00 riastradh Exp $ */
+/* $NetBSD: if_urndis.c,v 1.45 2022/03/03 05:56:09 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.44 2022/03/03 05:56:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.45 2022/03/03 05:56:09 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -878,7 +878,7 @@ urndis_uno_init(struct ifnet *ifp)
if (error)
return EIO; /* XXX */
- return usbnet_init_rx_tx(un);
+ return 0;
}
static int
diff --git a/sys/dev/usb/usbnet.c b/sys/dev/usb/usbnet.c
index f2a6d8b274a..2daf2d188a9 100644
--- a/sys/dev/usb/usbnet.c
+++ b/sys/dev/usb/usbnet.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.c,v 1.87 2022/03/03 05:55:52 riastradh Exp $ */
+/* $NetBSD: usbnet.c,v 1.88 2022/03/03 05:56:09 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.87 2022/03/03 05:55:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.88 2022/03/03 05:56:09 riastradh Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -834,7 +834,7 @@ usbnet_ep_stop_pipes(struct usbnet * const un)
return err;
}
-int
+static int
usbnet_init_rx_tx(struct usbnet * const un)
{
USBNETHIST_FUNC(); USBNETHIST_CALLED();
@@ -1290,7 +1290,12 @@ usbnet_if_init(struct ifnet *ifp)
mutex_enter(&un->un_pri->unp_core_lock);
error = uno_init(un, ifp);
- mutex_exit(&un->un_pri->unp_core_lock);
+ if (error)
+ goto out;
+ error = usbnet_init_rx_tx(un);
+ if (error)
+ goto out;
+out: mutex_exit(&un->un_pri->unp_core_lock);
return error;
}
diff --git a/sys/dev/usb/usbnet.h b/sys/dev/usb/usbnet.h
index 36c4b3b0cf5..88d47491799 100644
--- a/sys/dev/usb/usbnet.h
+++ b/sys/dev/usb/usbnet.h
@@ -1,4 +1,4 @@
-/* $NetBSD: usbnet.h,v 1.29 2022/03/03 05:55:29 riastradh Exp $ */
+/* $NetBSD: usbnet.h,v 1.30 2022/03/03 05:56:09 riastradh Exp $ */
/*
* Copyright (c) 2019 Matthew R. Green
@@ -307,10 +307,7 @@ bool usbnet_isdying(struct usbnet *);
* usbnet_detach() frees the rx/tx chains
*
* Setup un_ed[] with valid end points before calling usbnet_attach().
- * Call usbnet_init_rx_tx() to initialise pipes, which will be open
- * upon success.
*/
-int usbnet_init_rx_tx(struct usbnet * const);
/* interrupt handling */
void usbnet_enqueue(struct usbnet * const, uint8_t *, size_t, int,