Remove improper use of if_addrhead in device drivers to check

if the link-level address has been initialized already.

The majority of modern drivers never does this and works fine, which
makes me think that the check is totally unnecessary and a residue
of cut&paste from other drivers.

This change is done to simplify locking because now almost none of the
drivers uses this field. The exceptions are "ct" "ctau" and "cx"
where i am not sure if i can remove that part.
This commit is contained in:
Luigi Rizzo 2004-04-15 20:31:10 +00:00
parent 621b79c4d5
commit 0318355d0e
10 changed files with 0 additions and 55 deletions

View File

@ -701,9 +701,6 @@ arl_init(xsc)
D(("init\n"));
if (TAILQ_EMPTY(&ifp->if_addrhead))
return;
s = splimp();
if (ARL_CHECKREG(sc))

View File

@ -699,10 +699,6 @@ cs_init(void *xsc)
struct ifnet *ifp = &sc->arpcom.ac_if;
int i, s, rx_cfg;
/* address not known */
if (TAILQ_EMPTY(&ifp->if_addrhead)) /* unlikely? XXX */
return;
/*
* reset whatchdog timer
*/

View File

@ -1884,10 +1884,6 @@ ed_init(xsc)
if (sc->gone)
return;
/* address not known */
if (TAILQ_EMPTY(&ifp->if_addrhead)) /* unlikely? XXX */
return;
/*
* Initialize the NIC in the exact order outlined in the NS manual.
* This init procedure is "mandatory"...don't change what or when

View File

@ -305,9 +305,6 @@ ex_init(void *xsc)
DODEBUG(Start_End, printf("%s: ex_init: start\n", ifp->if_xname););
if (TAILQ_FIRST(&ifp->if_addrhead) == NULL) {
return;
}
s = splimp();
ifp->if_timer = 0;

View File

@ -1007,14 +1007,6 @@ fe_init (void * xsc)
struct fe_softc *sc = xsc;
int s;
/* We need an address. */
if (TAILQ_EMPTY(&sc->sc_if.if_addrhead)) { /* XXX unlikely */
#ifdef DIAGNOSTIC
printf("%s: init() without any address\n", sc->sc_xname);
#endif
return;
}
/* Start initializing 86960. */
s = splimp();

View File

@ -911,13 +911,6 @@ lnc_init(xsc)
int s, i;
char *lnc_mem;
/* Check that interface has valid address */
if (TAILQ_EMPTY(&sc->arpcom.ac_if.if_addrhead)) { /* XXX unlikely */
printf("XXX no address?\n");
return;
}
/* Shut down interface */
s = splimp();

View File

@ -264,10 +264,6 @@ sbni_init(void *xsc)
sc = (struct sbni_softc *)xsc;
ifp = &sc->arpcom.ac_if;
/* address not known */
if (TAILQ_EMPTY(&ifp->if_addrhead))
return;
/*
* kludge to avoid multiple initialization when more than once
* protocols configured

View File

@ -215,24 +215,6 @@ sn_attach(device_t dev)
ether_ifattach(ifp, sc->arpcom.ac_enaddr);
/*
* Fill the hardware address into ifa_addr if we find an AF_LINK
* entry. We need to do this so bpf's can get the hardware addr of
* this card. netstat likes this too!
*/
ifa = TAILQ_FIRST(&ifp->if_addrhead);
while ((ifa != 0) && (ifa->ifa_addr != 0) &&
(ifa->ifa_addr->sa_family != AF_LINK))
ifa = TAILQ_NEXT(ifa, ifa_link);
if ((ifa != 0) && (ifa->ifa_addr != 0)) {
sdl = (struct sockaddr_dl *) ifa->ifa_addr;
sdl->sdl_type = IFT_ETHER;
sdl->sdl_alen = ETHER_ADDR_LEN;
sdl->sdl_slen = 0;
bcopy(sc->arpcom.ac_enaddr, LLADDR(sdl), ETHER_ADDR_LEN);
}
/*
* Activate the interrupt so we can get card interrupts. This
* needs to be done last so that we don't have/hold the lock

View File

@ -806,8 +806,6 @@ wlinit(void *xsc)
if (sc->wl_if.if_flags & IFF_DEBUG)
printf("wl%d: entered wlinit()\n",sc->unit);
#endif
if (TAILQ_FIRST(&ifp->if_addrhead) == (struct ifaddr *)0)
return;
WL_LOCK(sc);
oldpri = splimp();
if ((stat = wlhwrst(sc)) == TRUE) {

View File

@ -317,8 +317,6 @@ xe_init(void *xscp) {
unsigned i;
int s;
if (TAILQ_EMPTY(&scp->ifp->if_addrhead)) return;
if (scp->autoneg_status != XE_AUTONEG_NONE) return;
DEVPRINTF(2, (scp->dev, "init\n"));