Added a shutdown command to the hfa384x_drvr set. It should be called

by the close() function (and is!).
This commit is contained in:
mark 2001-12-05 19:45:55 +00:00
parent 0e8ab8c309
commit fb5e98a964
3 changed files with 66 additions and 63 deletions

View File

@ -2928,6 +2928,66 @@ hfa384x_drvr_setconfig_async(
}
/*----------------------------------------------------------------
* hfa384x_drvr_shutdown
*
* Shuts down the MAC to the point where it is safe to unload the
* driver. Any subsystem that may be holding a data or function
* ptr into the driver must be cleared/deinitialized.
*
* Arguments:
* hw device structure
* Returns:
* 0 success
* >0 f/w reported error - f/w status code
* <0 driver reported error
*
* Side effects:
*
* Call context:
* process
----------------------------------------------------------------*/
int
hfa384x_drvr_shutdown(hfa384x_t *hw)
{
int result = 0;
int i;
DBFENTER;
/* Call initialize to leave the MAC in its 'reset' state */
result = hfa384x_cmd_initialize(hw);
if (result) {
WLAN_LOG_ERROR1(__FUNCTION__
": cmd_initialize() failed, result=%d.\n",
result);
goto done;
}
hw->state = HFA384x_STATE_INIT;
for ( i = 0; i < HFA384x_NUMPORTS_MAX; i++) {
hw->port_enabled[i] = 0;
}
wait_ms(100);
/* Cancel the rxurb */
if (hw->rxurb_posted) {
result = usb_unlink_urb(&hw->rx_urb);
if (result) {
WLAN_LOG_ERROR1(__FUNCTION__
":unlink_urb() failed, result=%d\n",
result);
goto done;
}
hw->rxurb_posted = 0;
}
done:
DBFEXIT;
return result;
}
/*----------------------------------------------------------------
* hfa384x_drvr_test_command
*

View File

@ -185,15 +185,6 @@ typedef struct pci_link {
static pci_link_t *dev_list = NULL; /* head of instance list */
#elif (WLAN_HOSTIF == WLAN_USB)
/* TODO: Determine if we need a device list for USB. Look into the
* protection on urb callback function pointers. That's the only place
* I can think of where the disappearance of the module could hurt us.
* I.e. if our netdev is closed (MOD_USE_COUNT==0) but we have outstanding
* URBs.
*/
#endif
/*-----------------------------------------------------------------*/
@ -674,8 +665,8 @@ int prism2sta_close(wlandevice_t *wlandev)
prism2sta_priv_t *priv = (prism2sta_priv_t*)wlandev->priv;
DBFENTER;
/* Shut down the MAC by issuing an "Initialize" command */
hfa384x_drvr_initialize(priv->hw);
/* Shut down the MAC */
hfa384x_drvr_shutdown(priv->hw);
MOD_DEC_USE_COUNT;
@ -955,48 +946,6 @@ int prism2sta_initmac(wlandevice_t *wlandev)
DBFENTER;
#if 0
#if (WLAN_HOSTIF == WLAN_PCMCIA)
{
conf_reg_t confreg;
/* Lets try a reset here */
/* Read the COR */
confreg.Function = 0;
confreg.Action = CS_READ;
confreg.Offset = CISREG_COR;
confreg.Value = 0;
CardServices(AccessConfigurationRegister,
priv->cs_link->handle, &confreg);
WLAN_LOG_DEBUG1(3,"Read COR=0x%02x\n", confreg.Value);
WLAN_LOG_DEBUG0(3,"Asserting reset.\n");
confreg.Function = 0;
confreg.Action = CS_WRITE;
confreg.Offset = CISREG_COR;
confreg.Value |= 0x80;
CardServices(AccessConfigurationRegister,
priv->cs_link->handle, &confreg);
/* Wait a while */
udelay(100);
WLAN_LOG_DEBUG0(3,"Clearing reset.\n");
confreg.Function = 0;
confreg.Action = CS_WRITE;
confreg.Offset = CISREG_COR;
confreg.Value &= ~0x80;
CardServices(AccessConfigurationRegister,
priv->cs_link->handle, &confreg);
/* Read the COR */
confreg.Function = 0;
confreg.Action = CS_READ;
confreg.Offset = CISREG_COR;
confreg.Value = 0;
CardServices(AccessConfigurationRegister,
priv->cs_link->handle, &confreg);
WLAN_LOG_DEBUG1(3,"Read COR=0x%02x\n", confreg.Value);
/* Now, wait for the MAC to finish intialization */
mdelay(500);
}
#endif
#endif
/* call initialize */
result = hfa384x_drvr_initialize(hw);
if (result != 0) {
@ -3340,7 +3289,7 @@ static void *prism2sta_probe_usb(
if ( usb_id_tbl[i].name == NULL ) return NULL;
/* Ok, we're going to claim the device. */
WLAN_LOG_INFO2("prism2_usb: Attempting to claiming device %s "
WLAN_LOG_INFO2("prism2_usb: Attempting to claim device %s "
"with devnum %d\n",
usb_id_tbl[i].name, dev->devnum);
@ -3613,17 +3562,9 @@ void cleanup_module(void)
pci_unregister_driver(&prism2_pci_drv_id);
#elif (WLAN_HOSTIF == WLAN_USB)
DBFENTER;
/* TODO: Need a "claimed device list".
* We need the ability to unclaim any claimed devices
* prior to the unload. Otherwise usbcore thinks there is still
* a driver here. NOTE: I believe some versions of usb will
* traverse the list of claimed devices associated with this
* and call disconnect() for each one. We'll have to deal w/
* that behavior too.
*/
usb_deregister(&prism2_usb_driver);
#endif
printk(KERN_NOTICE "%s Unloaded\n", version);

View File

@ -2427,6 +2427,8 @@ hfa384x_drvr_hostscanresults( hfa384x_t *hw);
int
hfa384x_drvr_initialize(hfa384x_t *hw);
int
hfa384x_drvr_shutdown(hfa384x_t *hw);
int
hfa384x_drvr_low_level(
hfa384x_t *hw,
UINT32 command,