* 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
@@ -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);
@@ -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
}