kernels/linux-2.4.0/drivers/net/wan/sdlamain.c
/*============================================================================
 * Shut down WAN link driver. 
 * o shut down adapter hardware
 * o release system resources.
 *
 * This function is called by the router when device is being unregistered or
 * when it handles ROUTER_DOWN IOCTL.
 */
Shut down WAN link driver.
o shut down adapter hardware
o release system resources.

This function is called by the router when device is being unregistered or
when it handles ROUTER_DOWN IOCTL.
Shut down WAN link driver . o shut down adapter hardware o release system resources . This function is called by the router when device is being unregistered or when it handles ROUTER_DOWN IOCTL .
static int shutdown (wan_device_t* wandev)
{
	sdla_t *card;
	if ((wandev == NULL) || (wandev->private == NULL))
		return -EFAULT;
	if (wandev->state == WAN_UNCONFIGURED)
		return 0;
	if (test_and_set_bit(0, (void*)&wandev->critical))
		return -EAGAIN;
	card = wandev->private;
	wandev->state = WAN_UNCONFIGURED;
	if (--active == 0)
		schedule();	
	release_hw(card);
	if (wandev->hw_opt[0] != SDLA_S514 && !card->configured){
              	release_region(card->hw.port, card->hw.io_range);
	}
	if (!card->configured){
		memset(&card->hw, 0, sizeof(sdlahw_t));
	      	if (card->next){
			memset(&card->next->hw, 0, sizeof(sdlahw_t));
		}
	}
	wandev->critical = 0;
	return 0;
}
static int shutdown ( wan_device_t * wandev ) { sdla_t * card ; if ( ( wandev == NULL ) || ( wandev -> private == NULL ) ) return - EFAULT ; if ( wandev -> state == WAN_UNCONFIGURED ) return 0 ; if ( test_and_set_bit ( 0 , ( void * ) & wandev -> critical ) ) return - EAGAIN ; card = wandev -> private ; wandev -> state = WAN_UNCONFIGURED ; if ( -- active == 0 ) schedule ( ) ; release_hw ( card ) ; if ( wandev -> hw_opt [ 0 ] != SDLA_S514 && ! card -> configured ) { release_region ( card -> hw . port , card -> hw . io_range ) ; } if ( ! card -> configured ) { memset ( & card -> hw , 0 , sizeof ( sdlahw_t ) ) ; if ( card -> next ) { memset ( & card -> next -> hw , 0 , sizeof ( sdlahw_t ) ) ; } } wandev -> critical = 0 ; return 0 ; }
Shut down WAN link driver.
Shut down WAN link driver .
/* sanity checks */ /* If we are in a critical section we lose */ /* stop background thread */ /* Release Resources */ /* only free the allocated I/O range if not an S514 adapter */