FreeBSD/sys/dev/qlxge/qls_os.c
/*
 * Name:	qls_release
 * Function:	Releases the resources allocated for the device
 */
qls_release
Function:    Releases the resources allocated for the device
qls_release Function : Releases the resources allocated for the device
static void
qls_release(qla_host_t *ha)
{
	device_t dev;
	int i;
	dev = ha->pci_dev;
	if (ha->err_tq) {
		taskqueue_drain(ha->err_tq, &ha->err_task);
		taskqueue_free(ha->err_tq);
	}
	if (ha->tx_tq) {
		taskqueue_drain(ha->tx_tq, &ha->tx_task);
		taskqueue_free(ha->tx_tq);
	}
	qls_del_cdev(ha);
	if (ha->flags.qla_watchdog_active) {
		ha->flags.qla_watchdog_exit = 1;
		while (ha->qla_watchdog_exited == 0)
			qls_mdelay(__func__, 1);
	}
	if (ha->flags.qla_callout_init)
		callout_stop(&ha->tx_callout);
	if (ha->ifp != NULL)
		ether_ifdetach(ha->ifp);
	qls_free_dma(ha); 
	qls_free_parent_dma_tag(ha);
        for (i = 0; i < ha->num_rx_rings; i++) {
                if (ha->irq_vec[i].handle) {
                        (void)bus_teardown_intr(dev, ha->irq_vec[i].irq,
                                        ha->irq_vec[i].handle);
                }
                if (ha->irq_vec[i].irq) {
                        (void)bus_release_resource(dev, SYS_RES_IRQ,
                                ha->irq_vec[i].irq_rid,
                                ha->irq_vec[i].irq);
                }
        }
	if (ha->msix_count)
		pci_release_msi(dev);
	if (ha->flags.lock_init) {
		mtx_destroy(&ha->tx_lock);
		mtx_destroy(&ha->hw_lock);
	}
        if (ha->pci_reg)
                (void) bus_release_resource(dev, SYS_RES_MEMORY, ha->reg_rid,
				ha->pci_reg);
        if (ha->pci_reg1)
                (void) bus_release_resource(dev, SYS_RES_MEMORY, ha->reg_rid1,
				ha->pci_reg1);
}
static void qls_release ( qla_host_t * ha ) { device_t dev ; int i ; dev = ha -> pci_dev ; if ( ha -> err_tq ) { taskqueue_drain ( ha -> err_tq , & ha -> err_task ) ; taskqueue_free ( ha -> err_tq ) ; } if ( ha -> tx_tq ) { taskqueue_drain ( ha -> tx_tq , & ha -> tx_task ) ; taskqueue_free ( ha -> tx_tq ) ; } qls_del_cdev ( ha ) ; if ( ha -> flags . qla_watchdog_active ) { ha -> flags . qla_watchdog_exit = 1 ; while ( ha -> qla_watchdog_exited == 0 ) qls_mdelay ( __func__ , 1 ) ; } if ( ha -> flags . qla_callout_init ) callout_stop ( & ha -> tx_callout ) ; if ( ha -> ifp != NULL ) ether_ifdetach ( ha -> ifp ) ; qls_free_dma ( ha ) ; qls_free_parent_dma_tag ( ha ) ; for ( i = 0 ; i < ha -> num_rx_rings ; i ++ ) { if ( ha -> irq_vec [ i ] . handle ) { ( void ) bus_teardown_intr ( dev , ha -> irq_vec [ i ] . irq , ha -> irq_vec [ i ] . handle ) ; } if ( ha -> irq_vec [ i ] . irq ) { ( void ) bus_release_resource ( dev , SYS_RES_IRQ , ha -> irq_vec [ i ] . irq_rid , ha -> irq_vec [ i ] . irq ) ; } } if ( ha -> msix_count ) pci_release_msi ( dev ) ; if ( ha -> flags . lock_init ) { mtx_destroy ( & ha -> tx_lock ) ; mtx_destroy ( & ha -> hw_lock ) ; } if ( ha -> pci_reg ) ( void ) bus_release_resource ( dev , SYS_RES_MEMORY , ha -> reg_rid , ha -> pci_reg ) ; if ( ha -> pci_reg1 ) ( void ) bus_release_resource ( dev , SYS_RES_MEMORY , ha -> reg_rid1 , ha -> pci_reg1 ) ; }
Name:        qls_release
 Function:    Releases the resources allocated for the device
Name : qls_release Function : Releases the resources allocated for the device