summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2005-10-02 13:50:30 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2005-10-02 13:50:30 +0000
commit5664c3e79ee33a697cde57a4aefe607e2d8e58a9 (patch)
treed3cdf1de2b385df594f08583997911ed1abaa6dc /sys/dev/ic
parent49e545872b2146679f71b37442b4c94d38678400 (diff)
avoid multiple calls to sc_enable(). cardbus_intr_establish() was called
multiple times without calling cardbus_intr_disestablish() in between.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/ral.c21
-rw-r--r--sys/dev/ic/ralvar.h5
2 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/ic/ral.c b/sys/dev/ic/ral.c
index bbe973430f7..a2509a520e7 100644
--- a/sys/dev/ic/ral.c
+++ b/sys/dev/ic/ral.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ral.c,v 1.60 2005/10/02 13:01:54 damien Exp $ */
+/* $OpenBSD: ral.c,v 1.61 2005/10/02 13:50:29 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -2642,8 +2642,13 @@ ral_init(struct ifnet *ifp)
int i;
/* for CardBus, power on the socket */
- if (sc->sc_enable != NULL)
- (*sc->sc_enable)(sc);
+ if (!(sc->sc_flags & RAL_ENABLED)) {
+ if (sc->sc_enable != NULL && (*sc->sc_enable)(sc) != 0) {
+ printf("%s: could not enable device\n");
+ return EIO;
+ }
+ sc->sc_flags |= RAL_ENABLED;
+ }
ral_stop(ifp, 0);
@@ -2687,7 +2692,7 @@ ral_init(struct ifnet *ifp)
if (ral_bbp_init(sc) != 0) {
ral_stop(ifp, 1);
- return 1;
+ return EIO;
}
/* set default BSS channel */
@@ -2760,8 +2765,12 @@ ral_stop(struct ifnet *ifp, int disable)
ral_reset_rx_ring(sc, &sc->rxq);
/* for CardBus, power down the socket */
- if (disable && sc->sc_disable != NULL)
- (*sc->sc_disable)(sc);
+ if (disable && sc->sc_disable != NULL) {
+ if (sc->sc_flags & RAL_ENABLED) {
+ (*sc->sc_disable)(sc);
+ sc->sc_flags &= ~RAL_ENABLED;
+ }
+ }
}
struct cfdriver ral_cd = {
diff --git a/sys/dev/ic/ralvar.h b/sys/dev/ic/ralvar.h
index 4e61d738783..76ae8aa022e 100644
--- a/sys/dev/ic/ralvar.h
+++ b/sys/dev/ic/ralvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ralvar.h,v 1.7 2005/03/11 19:39:35 damien Exp $ */
+/* $OpenBSD: ralvar.h,v 1.8 2005/10/02 13:50:29 damien Exp $ */
/*-
* Copyright (c) 2005
@@ -111,6 +111,9 @@ struct ral_softc {
struct timeout scan_ch;
struct timeout rssadapt_ch;
+ int sc_flags;
+#define RAL_ENABLED (1 << 0)
+
int sc_tx_timer;
uint32_t asic_rev;