* Ensuring reading of interrupt status is done only once.

* Code style cleanup.
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34815 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther
2009-12-29 22:31:43 +00:00
parent 2d939304db
commit 8645a5715e
3 changed files with 21 additions and 17 deletions
@@ -395,11 +395,11 @@ iwi_attach(device_t dev)
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2);
macaddr[4] = val & 0xff;
macaddr[5] = val >> 8;
bands = 0;
setbit(&bands, IEEE80211_MODE_11B);
setbit(&bands, IEEE80211_MODE_11G);
if (pci_get_device(dev) >= 0x4223)
if (pci_get_device(dev) >= 0x4223)
setbit(&bands, IEEE80211_MODE_11A);
ieee80211_init_channels(ic, NULL, &bands);
@@ -567,7 +567,7 @@ iwi_alloc_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring, int count)
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 4, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
count * IWI_CMD_DESC_SIZE, 1, count * IWI_CMD_DESC_SIZE, 0,
count * IWI_CMD_DESC_SIZE, 1, count * IWI_CMD_DESC_SIZE, 0,
NULL, NULL, &ring->desc_dmat);
if (error != 0) {
device_printf(sc->sc_dev, "could not create desc DMA tag\n");
@@ -612,7 +612,7 @@ iwi_free_cmd_ring(struct iwi_softc *sc, struct iwi_cmd_ring *ring)
}
if (ring->desc_dmat != NULL)
bus_dma_tag_destroy(ring->desc_dmat);
bus_dma_tag_destroy(ring->desc_dmat);
}
static int
@@ -629,7 +629,7 @@ iwi_alloc_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring, int count,
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 4, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
count * IWI_TX_DESC_SIZE, 1, count * IWI_TX_DESC_SIZE, 0, NULL,
count * IWI_TX_DESC_SIZE, 1, count * IWI_TX_DESC_SIZE, 0, NULL,
NULL, &ring->desc_dmat);
if (error != 0) {
device_printf(sc->sc_dev, "could not create desc DMA tag\n");
@@ -908,7 +908,7 @@ iwi_node_free(struct ieee80211_node *ni)
sc->sc_node_free(ni);
}
/*
/*
* Convert h/w rate code to IEEE rate code.
*/
static int
@@ -1657,10 +1657,14 @@ iwi_intr(void *arg)
IWI_LOCK(sc);
#if !defined(__HAIKU__)
if ((r = CSR_READ_4(sc, IWI_CSR_INTR)) == 0 || r == 0xffffffff) {
IWI_UNLOCK(sc);
return;
}
#else
r = atomic_get((int32 *)&sc->sc_intr_status);
#endif
/* acknowledge interrupts */
CSR_WRITE_4(sc, IWI_CSR_INTR, r);
@@ -2901,7 +2905,7 @@ iwi_auth_and_assoc(struct iwi_softc *sc, struct ieee80211vap *vap)
* key setup. This typically is due to a user app bug
* but if we blindly grab the key the firmware will
* barf so avoid it for now.
*/
*/
if (vap->iv_def_txkey != IEEE80211_KEYIX_NONE)
assoc->auth |= vap->iv_def_txkey << 4;
@@ -216,6 +216,10 @@ struct iwi_softc {
struct iwi_rx_radiotap_header sc_rxtap;
struct iwi_tx_radiotap_header sc_txtap;
#if defined(__HAIKU__)
uint32_t sc_intr_status;
#endif;
};
#define IWI_STATE_BEGIN(_sc, _state) do { \
@@ -29,19 +29,15 @@ HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{
struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
uint32 r;
HAIKU_INTR_REGISTER_STATE;
HAIKU_INTR_REGISTER_ENTER();
if ((r = CSR_READ_4(sc, IWI_CSR_INTR)) == 0 || r == 0xffffffff) {
HAIKU_INTR_REGISTER_LEAVE();
r = CSR_READ_4(sc, IWI_CSR_INTR);
if (r == 0 || r == 0xffffffff)
return 0;
}
/* disable interrupts */
atomic_set((int32*)&sc->sc_intr_status, r);
CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, 0);
HAIKU_INTR_REGISTER_LEAVE();
// disable interrupts
return 1;
}
@@ -51,6 +47,6 @@ HAIKU_REENABLE_INTERRUPTS(device_t dev)
{
struct iwi_softc* sc = (struct iwi_softc*)device_get_softc(dev);
/* enable interrupts */
CSR_WRITE_4(sc, IWI_CSR_INTR_MASK, IWI_INTR_MASK);
// reenable interrupts
}