* Using atomic_{get|set} instead of HAIKU_INTR* macros.

* Using conditional compiliation instead of just deleting original code
  to easen future driver updates.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34816 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Colin Günther
2009-12-29 22:48:07 +00:00
parent 8645a5715e
commit f9ee2947df
3 changed files with 32 additions and 33 deletions
@@ -821,11 +821,25 @@ mwl_intr(void *arg)
struct mwl_softc *sc = arg; struct mwl_softc *sc = arg;
struct mwl_hal *mh = sc->sc_mh; struct mwl_hal *mh = sc->sc_mh;
uint32_t status; uint32_t status;
HAIKU_INTR_REGISTER_STATE;
HAIKU_INTR_REGISTER_ENTER(); #if !defined(__HAIKU__)
status = sc->sc_lastisr; if (sc->sc_invalid) {
HAIKU_INTR_REGISTER_LEAVE(); /*
* The hardware is not ready/present, don't touch anything.
* Note this can happen early on if the IRQ is shared.
*/
DPRINTF(sc, MWL_DEBUG_ANY, "%s: invalid; ignored\n", __func__);
return;
}
/*
* Figure out the reason(s) for the interrupt.
*/
mwl_hal_getisr(mh, &status); /* NB: clears ISR too */
if (status == 0) /* must be a shared irq */
return;
#else
status = atomic_get((int32 *)&sc->sc_intr_status);
#endif
DPRINTF(sc, MWL_DEBUG_INTR, "%s: status 0x%x imask 0x%x\n", DPRINTF(sc, MWL_DEBUG_INTR, "%s: status 0x%x imask 0x%x\n",
__func__, status, sc->sc_imask); __func__, status, sc->sc_imask);
@@ -332,7 +332,9 @@ struct mwl_softc {
struct mwl_tx_radiotap_header sc_tx_th; struct mwl_tx_radiotap_header sc_tx_th;
struct mwl_rx_radiotap_header sc_rx_th; struct mwl_rx_radiotap_header sc_rx_th;
uint32_t sc_lastisr; #if defined(__HAIKU__)
uint32_t sc_intr_status;
#endif
}; };
#define MWL_LOCK_INIT(_sc) \ #define MWL_LOCK_INIT(_sc) \
@@ -28,41 +28,24 @@ HAIKU_CHECK_DISABLE_INTERRUPTS(device_t dev)
{ {
struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev); struct mwl_softc* sc = (struct mwl_softc*)device_get_softc(dev);
struct mwl_hal* mh = sc->sc_mh; struct mwl_hal* mh = sc->sc_mh;
HAIKU_INTR_REGISTER_STATE; uint32_t intr_status;
if (sc->sc_invalid) { if (sc->sc_invalid)
/* // The hardware is not ready/present, don't touch anything.
* The hardware is not ready/present, don't touch anything. // Note this can happen early on if the IRQ is shared.
* Note this can happen early on if the IRQ is shared.
*/
return 0; return 0;
}
HAIKU_INTR_REGISTER_ENTER(); mwl_hal_getisr(mh, &intr_status);
// NB: clears ISR too
/* if (intr_status == 0)
* We have to save the isr status right now. // must be a shared irq
* Some devices don't like having the interrupt disabled
* before accessing the isr status.
*
* Those devices return status 0, when status access
* occurs after disabling the interrupts with mwl_hal_intrset.
*
* Note: This glue.c is based on the one for the atheros wlan driver.
* So the comment above isn't based on tests on real marvell hardware.
* But due to the similarities in both drivers I just go the safe
* route here. It doesn't do any harm, but may prevent hard to spot
* bugs.
*/
mwl_hal_getisr(mh, &sc->sc_lastisr); /* NB: clears ISR too */
if (sc->sc_lastisr == 0) { /* must be a shared irq */
HAIKU_INTR_REGISTER_LEAVE();
return 0; return 0;
}
mwl_hal_intrset(mh, 0); // disable further intr's atomic_set((int32*)&sc->sc_intr_status, intr_status);
HAIKU_INTR_REGISTER_LEAVE(); mwl_hal_intrset(mh, 0);
// disable further intr's
return 1; return 1;
} }