diff options
| author | riastradh <riastradh@NetBSD.org> | 2022-03-03 05:51:44 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2022-03-03 05:51:44 +0000 |
| commit | 6d9d9de05710cf1f43e36e3fd0db6d7bed2cbea0 (patch) | |
| tree | 7e36459e8854fa96ff27510f748228dcba9ad2e5 /sys/dev | |
| parent | e7be0ef54811a9ad4bdc5e45528692dcaa1ada84 (diff) | |
usbnet drivers: No need for usbnet_busy during attach.
usbnet_detach cannot run until the attach routine has finished
(unless a driver goes out of its way to tie its shoelaces together
and explicitly call it during the attach routine, which none of them
do), so there is no need to hang onto a reference count that we
release before attach returns.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/if_axe.c | 8 | ||||
| -rw-r--r-- | sys/dev/usb/if_axen.c | 10 | ||||
| -rw-r--r-- | sys/dev/usb/if_smsc.c | 6 | ||||
| -rw-r--r-- | sys/dev/usb/if_udav.c | 6 | ||||
| -rw-r--r-- | sys/dev/usb/if_url.c | 6 |
5 files changed, 10 insertions, 26 deletions
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 120b48972c0..a2bac202db5 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.136 2022/03/03 05:51:27 riastradh Exp $ */ +/* $NetBSD: if_axe.c,v 1.137 2022/03/03 05:51:44 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.136 2022/03/03 05:51:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.137 2022/03/03 05:51:44 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -930,10 +930,8 @@ axe_attach(device_t parent, device_t self, void *aux) /* We need the PHYID for init dance in some cases */ usbnet_lock_core(un); - usbnet_busy(un); if (axe_cmd(sc, AXE_CMD_READ_PHYID, 0, 0, &sc->axe_phyaddrs)) { aprint_error_dev(self, "failed to read phyaddrs\n"); - usbnet_unbusy(un); usbnet_unlock_core(un); return; } @@ -964,13 +962,11 @@ axe_attach(device_t parent, device_t self, void *aux) } else { if (axe_cmd(sc, AXE_CMD_READ_IPG012, 0, 0, sc->axe_ipgs)) { aprint_error_dev(self, "failed to read ipg\n"); - usbnet_unbusy(un); usbnet_unlock_core(un); return; } } - usbnet_unbusy(un); usbnet_unlock_core(un); if (!AXE_IS_172(un)) diff --git a/sys/dev/usb/if_axen.c b/sys/dev/usb/if_axen.c index 623f1e92de3..41705c376c7 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.79 2022/03/03 05:51:35 riastradh Exp $ */ +/* $NetBSD: if_axen.c,v 1.80 2022/03/03 05:51:44 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.79 2022/03/03 05:51:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.80 2022/03/03 05:51:44 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -368,7 +368,6 @@ axen_ax88179_init(struct usbnet *un) uint8_t val; usbnet_lock_core(un); - usbnet_busy(un); /* XXX: ? */ axen_cmd(un, AXEN_CMD_MAC_READ, 1, AXEN_UNK_05, &val); @@ -452,7 +451,6 @@ axen_ax88179_init(struct usbnet *un) default: aprint_error_dev(un->un_dev, "unknown uplink bus:0x%02x\n", val); - usbnet_unbusy(un); usbnet_unlock_core(un); return; } @@ -512,7 +510,6 @@ axen_ax88179_init(struct usbnet *un) usbnet_mii_writereg(un->un_dev, un->un_phyno, 0x1F, 0x0000); #endif - usbnet_unbusy(un); usbnet_unlock_core(un); } @@ -682,14 +679,11 @@ axen_attach(device_t parent, device_t self, void *aux) /* Get station address. */ usbnet_lock_core(un); - usbnet_busy(un); if (axen_get_eaddr(un, &un->un_eaddr)) { - usbnet_unbusy(un); usbnet_unlock_core(un); printf("EEPROM checksum error\n"); return; } - usbnet_unbusy(un); usbnet_unlock_core(un); axen_ax88179_init(un); diff --git a/sys/dev/usb/if_smsc.c b/sys/dev/usb/if_smsc.c index 28ac45171d8..a9343feb429 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.77 2022/03/03 05:51:35 riastradh Exp $ */ +/* $NetBSD: if_smsc.c,v 1.78 2022/03/03 05:51:44 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.77 2022/03/03 05:51:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_smsc.c,v 1.78 2022/03/03 05:51:44 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -884,7 +884,6 @@ smsc_attach(device_t parent, device_t self, void *aux) un->un_phyno = 1; usbnet_lock_core(un); - usbnet_busy(un); /* * Attempt to get the mac address, if an EEPROM is not attached this * will just return FF:FF:FF:FF:FF:FF, so in such cases we invent a MAC @@ -912,7 +911,6 @@ smsc_attach(device_t parent, device_t self, void *aux) un->un_eaddr[0] = (uint8_t)((mac_l) & 0xff); } } - usbnet_unbusy(un); usbnet_unlock_core(un); usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 267e8f67f97..9c75418b475 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.83 2022/03/03 05:51:27 riastradh Exp $ */ +/* $NetBSD: if_udav.c,v 1.84 2022/03/03 05:51:44 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.83 2022/03/03 05:51:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.84 2022/03/03 05:51:44 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -240,14 +240,12 @@ udav_attach(device_t parent, device_t self, void *aux) usbnet_attach(un, "udavdet"); usbnet_lock_core(un); - usbnet_busy(un); // /* reset the adapter */ // udav_reset(un); /* Get Ethernet Address */ err = udav_csr_read(un, UDAV_PAR, un->un_eaddr, ETHER_ADDR_LEN); - usbnet_unbusy(un); usbnet_unlock_core(un); if (err) { aprint_error_dev(self, "read MAC address failed\n"); diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index f8b89fe996d..01011e6c7e8 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.83 2022/03/03 05:51:27 riastradh Exp $ */ +/* $NetBSD: if_url.c,v 1.84 2022/03/03 05:51:44 riastradh Exp $ */ /* * Copyright (c) 2001, 2002 @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.83 2022/03/03 05:51:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.84 2022/03/03 05:51:44 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -244,7 +244,6 @@ url_attach(device_t parent, device_t self, void *aux) usbnet_attach(un, "urldet"); usbnet_lock_core(un); - usbnet_busy(un); /* reset the adapter */ url_reset(un); @@ -252,7 +251,6 @@ url_attach(device_t parent, device_t self, void *aux) /* Get Ethernet Address */ err = url_mem(un, URL_CMD_READMEM, URL_IDR0, (void *)un->un_eaddr, ETHER_ADDR_LEN); - usbnet_unbusy(un); usbnet_unlock_core(un); if (err) { aprint_error_dev(self, "read MAC address failed\n"); |
