summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-03-11 08:41:30 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-03-11 08:41:30 +0000
commit2cd2e328e0c47a0061b2453a00881e5aea7c81ea (patch)
tree7d289d69dd9d2ca4f4aeedda70ba8273167dd555 /sys
parenta1d6761729579478880bb7cefef4147aafcffe2c (diff)
make those loops time-bound, space police
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pcmcia/if_wi.c33
-rw-r--r--sys/dev/pcmcia/if_wireg.h4
2 files changed, 18 insertions, 19 deletions
diff --git a/sys/dev/pcmcia/if_wi.c b/sys/dev/pcmcia/if_wi.c
index b80fe80c58b..5a376a9c5d8 100644
--- a/sys/dev/pcmcia/if_wi.c
+++ b/sys/dev/pcmcia/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.23 2001/02/20 19:39:46 mickey Exp $ */
+/* $OpenBSD: if_wi.c,v 1.24 2001/03/11 08:41:28 mickey Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -50,7 +50,7 @@
* without an NDA (if at all). What they do release is an API library
* called the HCF (Hardware Control Functions) which is supposed to
* do the device-specific operations of a device driver for you. The
- * publically available version of the HCF library (the 'HCF Light') is
+ * publically available version of the HCF library (the 'HCF Light') is
* a) extremely gross, b) lacks certain features, particularly support
* for 802.11 frames, and c) is contaminated by the GNU Public License.
*
@@ -133,7 +133,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.23 2001/02/20 19:39:46 mickey Exp $";
+ "$OpenBSD: if_wi.c,v 1.24 2001/03/11 08:41:28 mickey Exp $";
#endif /* lint */
#ifdef foo
@@ -187,7 +187,7 @@ wi_pcmcia_match(parent, match, aux)
void *match, *aux;
{
struct pcmcia_attach_args *pa = aux;
-
+
if (pa->pf->function != PCMCIA_FUNCTION_NETWORK)
return (0);
@@ -665,7 +665,7 @@ wi_cmd(sc, cmd, val)
CSR_WRITE_2(sc, WI_PARAM0, val);
CSR_WRITE_2(sc, WI_COMMAND, cmd);
- for (i = 0; i < WI_TIMEOUT; i++) {
+ for (i = WI_TIMEOUT; i--; DELAY(10)) {
/*
* Wait for 'command complete' bit to be
* set in the event status register.
@@ -685,7 +685,7 @@ wi_cmd(sc, cmd, val)
}
}
- if (i == WI_TIMEOUT)
+ if (i < 0)
return(ETIMEDOUT);
return(0);
@@ -803,12 +803,11 @@ wi_seek(sc, id, off, chan)
CSR_WRITE_2(sc, selreg, id);
CSR_WRITE_2(sc, offreg, off);
- for (i = 0; i < WI_TIMEOUT; i++) {
+ for (i = WI_TIMEOUT; i--; DELAY(10))
if (!(CSR_READ_2(sc, offreg) & (WI_OFF_BUSY|WI_OFF_ERR)))
break;
- }
- if (i == WI_TIMEOUT)
+ if (i < 0)
return(ETIMEDOUT);
return(0);
@@ -900,12 +899,12 @@ wi_alloc_nicmem(sc, len, id)
return(ENOMEM);
}
- for (i = 0; i < WI_TIMEOUT; i++) {
+ for (i = WI_TIMEOUT; i--; DELAY(10)) {
if (CSR_READ_2(sc, WI_EVENT_STAT) & WI_EV_ALLOC)
break;
}
- if (i == WI_TIMEOUT)
+ if (i < 0)
return(ETIMEDOUT);
CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_ALLOC);
@@ -983,7 +982,7 @@ wi_setdef(sc, wreq)
sdl = (struct sockaddr_dl *)ifa->ifa_addr;
bcopy((char *)&wreq->wi_val, LLADDR(sdl), ETHER_ADDR_LEN);
bcopy((char *)&wreq->wi_val, (char *)&sc->arpcom.ac_enaddr,
- ETHER_ADDR_LEN);
+ ETHER_ADDR_LEN);
break;
case WI_RID_PORTTYPE:
sc->wi_ptype = wreq->wi_val[0];
@@ -1068,7 +1067,7 @@ wi_ioctl(ifp, command, data)
}
DPRINTF (WID_IOCTL, ("wi_ioctl: command %lu data %p\n",
- command, data));
+ command, data));
if ((error = ether_ioctl(ifp, &sc->arpcom, command, data)) > 0) {
splx(s);
@@ -1128,7 +1127,7 @@ wi_ioctl(ifp, command, data)
if (error == ENETRESET) {
/*
* Multicast list has changed; set the hardware filter
- * accordingly.
+ * accordingly.
*/
wi_setmulti(sc);
error = 0;
@@ -1146,10 +1145,10 @@ wi_ioctl(ifp, command, data)
/* For non-root user, return all-zeroes keys */
if (suser(p->p_ucred, &p->p_acflag))
bzero((char *)&wreq,
- sizeof(struct wi_ltv_keys));
+ sizeof(struct wi_ltv_keys));
else
bcopy((char *)&sc->wi_keys, (char *)&wreq,
- sizeof(struct wi_ltv_keys));
+ sizeof(struct wi_ltv_keys));
} else {
if (wi_read_record(sc, (struct wi_ltv_gen *)&wreq)) {
error = EINVAL;
@@ -1430,7 +1429,7 @@ wi_mgmt_xmit(sc, data, len)
return(0);
}
-STATIC void
+STATIC void
wi_stop(sc)
struct wi_softc *sc;
{
diff --git a/sys/dev/pcmcia/if_wireg.h b/sys/dev/pcmcia/if_wireg.h
index 46447988d60..c211af8f5a5 100644
--- a/sys/dev/pcmcia/if_wireg.h
+++ b/sys/dev/pcmcia/if_wireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wireg.h,v 1.6 2000/06/30 01:04:28 art Exp $ */
+/* $OpenBSD: if_wireg.h,v 1.7 2001/03/11 08:41:29 mickey Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -117,7 +117,7 @@ struct wi_softc {
struct timeout sc_timo;
};
-#define WI_TIMEOUT 65536
+#define WI_TIMEOUT 50000
#define WI_PORT0 0
#define WI_PORT1 1