Don't use a global variable to indicate that we are stge1023. Use an sc member.

Pointed out by thorpej.
This commit is contained in:
christos 2005-07-28 16:04:24 +00:00
parent 49b19c5f09
commit 292dcda123
1 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_stge.c,v 1.30 2005/07/25 05:44:36 kleink Exp $ */
/* $NetBSD: if_stge.c,v 1.31 2005/07/28 16:04:24 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.30 2005/07/25 05:44:36 kleink Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.31 2005/07/28 16:04:24 christos Exp $");
#include "bpfilter.h"
@ -207,7 +207,8 @@ struct stge_softc {
struct mbuf **sc_rxtailp;
int sc_txthresh; /* Tx threshold */
int sc_usefiber; /* if we're fiber */
uint32_t sc_usefiber:1; /* if we're fiber */
uint32_t sc_stge1023:1; /* are we a 1023 */
uint32_t sc_DMACtrl; /* prototype DMACtrl register */
uint32_t sc_MACCtrl; /* prototype MacCtrl register */
uint16_t sc_IntEnable; /* prototype IntEnable register */
@ -299,7 +300,6 @@ static int stge_match(struct device *, struct cfdata *, void *);
static void stge_attach(struct device *, struct device *, void *);
int stge_copy_small = 0;
int stge_1023_bug = 0; /* XXX: ST1023 works only in promisc mode */
CFATTACH_DECL(stge, sizeof(struct stge_softc),
stge_match, stge_attach, NULL, NULL);
@ -583,6 +583,7 @@ stge_attach(struct device *parent, struct device *self, void *aux)
STGE_StationAddress2) & 0xff;
enaddr[5] = bus_space_read_2(sc->sc_st, sc->sc_sh,
STGE_StationAddress2) >> 8;
sc->sc_stge1023 = 0;
} else {
uint16_t myaddr[ETHER_ADDR_LEN / 2];
for (i = 0; i <ETHER_ADDR_LEN / 2; i++) {
@ -591,7 +592,7 @@ stge_attach(struct device *parent, struct device *self, void *aux)
myaddr[i] = le16toh(myaddr[i]);
}
(void)memcpy(enaddr, myaddr, sizeof(enaddr));
stge_1023_bug = 1;
sc->sc_stge1023 = 1;
}
printf("%s: Ethernet address %s\n", sc->sc_dev.dv_xname,
@ -1876,7 +1877,7 @@ stge_set_filter(struct stge_softc *sc)
sc->sc_ReceiveMode |= RM_ReceiveBroadcast;
/* XXX: ST1023 only works in promiscuous mode */
if (stge_1023_bug)
if (sc->sc_stge1023)
ifp->if_flags |= IFF_PROMISC;
if (ifp->if_flags & IFF_PROMISC) {