Changed hw->auxen to be an enable counter. This allows multiple enables

and disables to overlap.
This commit is contained in:
mark 2000-01-30 17:00:39 +00:00
parent f6bb3e9527
commit a5d1388fe3
1 changed files with 19 additions and 15 deletions

View File

@ -407,12 +407,11 @@ int hfa384x_drvr_setconfig32(hfa384x_t *hw, UINT16 rid, UINT32 *val)
* Side effects:
*
* Call context:
* process thread or interrupt (but not recommended)
* process thread or non-card interrupt.
----------------------------------------------------------------*/
int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
{
int result = 0;
int local_enable = 0;
UINT16 *pda = buf;
int pdaok = 0;
int morepdrs = 1;
@ -421,14 +420,12 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
UINT32 cardaddr[] = {HFA384x_PDA_BASE, HFA384x_PDA_BOGUS_BASE};
DBFENTER;
/* Check for aux available */
if ( !hw->auxen ) {
local_enable = 1;
result = hfa384x_cmd_aux_enable(hw);
if ( result ) {
WLAN_LOG_DEBUG1(1,"aux_enable() failed. result=%d\n", result);
goto failed;
}
result = hfa384x_cmd_aux_enable(hw);
if ( result ) {
WLAN_LOG_DEBUG1(1,"aux_enable() failed. result=%d\n", result);
goto failed;
}
/* Read the pda from each known address. */
for ( i = 0; i < (sizeof(cardaddr)/sizeof(cardaddr[0])); i++) {
hfa384x_copy_from_aux(hw, cardaddr[i], buf, len);
@ -462,10 +459,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, UINT len)
}
result = pdaok ? 0 : -ENODATA;
/* If we enabled the aux locally, disable it */
if ( local_enable ) {
hfa384x_cmd_aux_disable(hw);
}
hfa384x_cmd_aux_disable(hw);
failed:
DBFEXIT;
return result;
@ -971,6 +965,13 @@ int hfa384x_cmd_aux_enable(hfa384x_t *hw)
UINT16 reg = 0;
DBFENTER;
/* Check for existing enable */
if ( hw->auxen ) {
hw->auxen++;
return 0;
}
/* acquire the lock */
spin_lock_irqsave( &(hw->cmdlock), flags);
/* wait for cmd the busy bit to clear */
@ -1000,7 +1001,7 @@ int hfa384x_cmd_aux_enable(hfa384x_t *hw)
}
if ( (reg & (BIT14|BIT15)) == HFA384x_CONTROL_AUX_ISENABLED ) {
result = 0;
hw->auxen = 1;
hw->auxen++;
}
}
spin_unlock_irqrestore( &(hw->cmdlock), flags);
@ -1036,6 +1037,10 @@ int hfa384x_cmd_aux_disable(hfa384x_t *hw)
DBFENTER;
/* See if there's more than one enable */
if (hw->auxen) hw->auxen--;
if (hw->auxen) return 0;
/* Set the aux enable in the Control register */
outw(0, HFA384x_PARAM0(hw->iobase));
outw(0, HFA384x_PARAM1(hw->iobase));
@ -1053,7 +1058,6 @@ int hfa384x_cmd_aux_disable(hfa384x_t *hw)
}
if ((reg & (BIT14|BIT15)) == HFA384x_CONTROL_AUX_ISDISABLED ) {
result = 0;
hw->auxen = 0;
}
DBFEXIT;
return result;