iwn(4) again.
ok deraadt@
-/* $OpenBSD: if_ipw.c,v 1.87 2010/07/28 21:21:38 deraadt Exp $ */
+/* $OpenBSD: if_ipw.c,v 1.88 2010/08/03 18:26:25 kettenis Exp $ */
/*-
* Copyright (c) 2004-2008
struct ipw_softc *sc = arg;
struct ifnet *ifp = &sc->sc_ic.ic_if;
pcireg_t data;
+ int s;
if (why != PWR_RESUME) {
ipw_stop(ifp, 0);
data &= ~0x0000ff00;
pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, data);
+ s = splnet();
+ sc->sc_flags |= IPW_FLAG_BUSY;
+
if (ifp->if_flags & IFF_UP)
ipw_init(ifp);
+
+ sc->sc_flags &= ~IPW_FLAG_BUSY;
+ splx(s);
}
int
int s, error = 0;
s = splnet();
+ /*
+ * Prevent processes from entering this function while another
+ * process is tsleep'ing in it.
+ */
+ if (sc->sc_flags & IPW_FLAG_BUSY) {
+ splx(s);
+ return EBUSY;
+ }
+ sc->sc_flags |= IPW_FLAG_BUSY;
switch (cmd) {
case SIOCSIFADDR:
error = 0;
}
+ sc->sc_flags &= ~IPW_FLAG_BUSY;
splx(s);
return error;
}
tmp = CSR_READ_4(sc, IPW_CSR_RST);
CSR_WRITE_4(sc, IPW_CSR_RST, tmp | IPW_RST_PRINCETON_RESET);
- sc->flags &= ~IPW_FLAG_FW_INITED;
+ sc->sc_flags &= ~IPW_FLAG_FW_INITED;
}
int
printf("%s: could not load firmware\n", sc->sc_dev.dv_xname);
goto fail2;
}
- sc->flags |= IPW_FLAG_FW_INITED;
+ sc->sc_flags |= IPW_FLAG_FW_INITED;
free(fw.data, M_DEVBUF);
/* retrieve information tables base addresses */
-/* $OpenBSD: if_ipwvar.h,v 1.19 2010/07/28 21:21:38 deraadt Exp $ */
+/* $OpenBSD: if_ipwvar.h,v 1.20 2010/08/03 18:26:25 kettenis Exp $ */
/*-
* Copyright (c) 2004-2006
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
- uint32_t flags;
+ uint32_t sc_flags;
#define IPW_FLAG_FW_INITED (1 << 0)
+#define IPW_FLAG_BUSY (1 << 1)
bus_space_tag_t sc_st;
bus_space_handle_t sc_sh;
-/* $OpenBSD: if_iwi.c,v 1.104 2010/07/28 21:21:38 deraadt Exp $ */
+/* $OpenBSD: if_iwi.c,v 1.105 2010/08/03 18:26:25 kettenis Exp $ */
/*-
* Copyright (c) 2004-2008
pci_conf_write(sc->sc_pct, sc->sc_pcitag, 0x40, data);
s = splnet();
+ sc->sc_flags |= IWI_FLAG_BUSY;
+
if (ifp->if_flags & IFF_UP)
iwi_init(ifp);
+
+ sc->sc_flags &= ~IWI_FLAG_BUSY;
splx(s);
}
int s, error = 0;
s = splnet();
+ /*
+ * Prevent processes from entering this function while another
+ * process is tsleep'ing in it.
+ */
+ if (sc->sc_flags & IWI_FLAG_BUSY) {
+ splx(s);
+ return EBUSY;
+ }
+ sc->sc_flags |= IWI_FLAG_BUSY;
switch (cmd) {
case SIOCSIFADDR:
error = 0;
}
+ sc->sc_flags &= ~IWI_FLAG_BUSY;
splx(s);
return error;
}
tmp = CSR_READ_4(sc, IWI_CSR_RST);
CSR_WRITE_4(sc, IWI_CSR_RST, tmp | IWI_RST_PRINCETON_RESET);
- sc->flags &= ~IWI_FLAG_FW_INITED;
+ sc->sc_flags &= ~IWI_FLAG_FW_INITED;
}
int
}
free(data, M_DEVBUF);
- sc->flags |= IWI_FLAG_FW_INITED;
+ sc->sc_flags |= IWI_FLAG_FW_INITED;
if ((error = iwi_config(sc)) != 0) {
printf("%s: device configuration failed\n",
-/* $OpenBSD: if_iwivar.h,v 1.21 2010/07/28 21:21:38 deraadt Exp $ */
+/* $OpenBSD: if_iwivar.h,v 1.22 2010/08/03 18:26:25 kettenis Exp $ */
/*-
* Copyright (c) 2004-2006
int (*sc_newstate)(struct ieee80211com *,
enum ieee80211_state, int);
- uint32_t flags;
+ uint32_t sc_flags;
#define IWI_FLAG_FW_INITED (1 << 0)
+#define IWI_FLAG_BUSY (1 << 1)
bus_dma_tag_t sc_dmat;
-/* $OpenBSD: if_wpi.c,v 1.103 2010/07/28 21:21:38 deraadt Exp $ */
+/* $OpenBSD: if_wpi.c,v 1.104 2010/08/03 18:26:25 kettenis Exp $ */
/*-
* Copyright (c) 2006-2008
s = splnet();
sc->sc_flags |= WPI_FLAG_BUSY;
- if (ifp->if_flags & IFF_UP) {
- ifp->if_init(ifp);
- if (ifp->if_flags & IFF_RUNNING)
- ifp->if_start(ifp);
- }
+ if (ifp->if_flags & IFF_UP)
+ wpi_init(ifp);
sc->sc_flags &= ~WPI_FLAG_BUSY;
splx(s);