software/drivers/sd8887/src/wlan/mlan/mlan_init.c
/**
 *  @brief This function frees the structure of adapter
 *
 *  @param pmadapter    A pointer to mlan_adapter structure
 *
 *  @return             N/A
 */
@brief This function frees the structure of adapter
@param pmadapter    A pointer to mlan_adapter structure

@return             N/A
@brief This function frees the structure of adapter @param pmadapter A pointer to mlan_adapter structure @return N / A
t_void
wlan_free_adapter(pmlan_adapter pmadapter)
{
	mlan_callbacks *pcb = (mlan_callbacks *)&pmadapter->callbacks;
	ENTER();
	if (!pmadapter) {
		PRINTM(MERROR, "The adapter is NULL\n");
		LEAVE();
		return;
	}
	wlan_cancel_all_pending_cmd(pmadapter);
	PRINTM(MINFO, "Free Command buffer\n");
	wlan_free_cmd_buffer(pmadapter);
	if (pmadapter->cmd_timer_is_set) {
		pcb->moal_stop_timer(pmadapter->pmoal_handle,
				     pmadapter->pmlan_cmd_timer);
		pmadapter->cmd_timer_is_set = MFALSE;
	}
	if (pmadapter->wakeup_fw_timer_is_set) {
		pcb->moal_stop_timer(pmadapter->pmoal_handle,
				     pmadapter->pwakeup_fw_timer);
		pmadapter->wakeup_fw_timer_is_set = MFALSE;
	}
	wlan_free_fw_cfp_tables(pmadapter);
#ifdef STA_SUPPORT
	PRINTM(MINFO, "Free ScanTable\n");
	if (pmadapter->pscan_table) {
		if (pcb->moal_vmalloc && pcb->moal_vfree)
			pcb->moal_vfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->pscan_table);
		else
			pcb->moal_mfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->pscan_table);
		pmadapter->pscan_table = MNULL;
	}
	if (pmadapter->pchan_stats) {
		if (pcb->moal_vmalloc && pcb->moal_vfree)
			pcb->moal_vfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->pchan_stats);
		else
			pcb->moal_mfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->pchan_stats);
		pmadapter->pchan_stats = MNULL;
	}
	if (pmadapter->bcn_buf) {
		pcb->moal_mfree(pmadapter->pmoal_handle,
				(t_u8 *)pmadapter->bcn_buf);
		pmadapter->bcn_buf = MNULL;
	}
#endif
	wlan_11h_cleanup(pmadapter);
	if (pmadapter->mp_regs_buf) {
		pcb->moal_mfree(pmadapter->pmoal_handle,
				(t_u8 *)pmadapter->mp_regs_buf);
		pmadapter->mp_regs_buf = MNULL;
		pmadapter->mp_regs = MNULL;
	}
#if defined(SDIO_MULTI_PORT_RX_AGGR)
	if (pmadapter->rx_buffer) {
		pcb->moal_mfree(pmadapter->pmoal_handle,
				(t_u8 *)pmadapter->rx_buffer);
		pmadapter->rx_buffer = MNULL;
		pmadapter->rx_buf = MNULL;
	}
#endif
#if defined(SDIO_MULTI_PORT_TX_AGGR) || defined(SDIO_MULTI_PORT_RX_AGGR)
	wlan_free_sdio_mpa_buffers(pmadapter);
#ifdef DEBUG_LEVEL1
	if (pmadapter->mpa_buf) {
		if (pcb->moal_vmalloc && pcb->moal_vfree)
			pcb->moal_vfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->mpa_buf);
		else
			pcb->moal_mfree(pmadapter->pmoal_handle,
					(t_u8 *)pmadapter->mpa_buf);
		pmadapter->mpa_buf = MNULL;
		pmadapter->mpa_buf_size = 0;
	}
#endif
#endif
	wlan_free_mlan_buffer(pmadapter, pmadapter->psleep_cfm);
	pmadapter->psleep_cfm = MNULL;
	LEAVE();
	return;
}
t_void wlan_free_adapter ( pmlan_adapter pmadapter ) { mlan_callbacks * pcb = ( mlan_callbacks * ) & pmadapter -> callbacks ; ENTER ( ) ; if ( ! pmadapter ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return ; } wlan_cancel_all_pending_cmd ( pmadapter ) ; PRINTM ( MINFO , " \n " ) ; wlan_free_cmd_buffer ( pmadapter ) ; if ( pmadapter -> cmd_timer_is_set ) { pcb -> moal_stop_timer ( pmadapter -> pmoal_handle , pmadapter -> pmlan_cmd_timer ) ; pmadapter -> cmd_timer_is_set = MFALSE ; } if ( pmadapter -> wakeup_fw_timer_is_set ) { pcb -> moal_stop_timer ( pmadapter -> pmoal_handle , pmadapter -> pwakeup_fw_timer ) ; pmadapter -> wakeup_fw_timer_is_set = MFALSE ; } wlan_free_fw_cfp_tables ( pmadapter ) ; #ifdef STA_SUPPORT PRINTM ( MINFO , " \n " ) ; if ( pmadapter -> pscan_table ) { if ( pcb -> moal_vmalloc && pcb -> moal_vfree ) pcb -> moal_vfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> pscan_table ) ; else pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> pscan_table ) ; pmadapter -> pscan_table = MNULL ; } if ( pmadapter -> pchan_stats ) { if ( pcb -> moal_vmalloc && pcb -> moal_vfree ) pcb -> moal_vfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> pchan_stats ) ; else pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> pchan_stats ) ; pmadapter -> pchan_stats = MNULL ; } if ( pmadapter -> bcn_buf ) { pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> bcn_buf ) ; pmadapter -> bcn_buf = MNULL ; } #endif wlan_11h_cleanup ( pmadapter ) ; if ( pmadapter -> mp_regs_buf ) { pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> mp_regs_buf ) ; pmadapter -> mp_regs_buf = MNULL ; pmadapter -> mp_regs = MNULL ; } #if defined ( SDIO_MULTI_PORT_RX_AGGR ) if ( pmadapter -> rx_buffer ) { pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> rx_buffer ) ; pmadapter -> rx_buffer = MNULL ; pmadapter -> rx_buf = MNULL ; } #endif #if defined ( SDIO_MULTI_PORT_TX_AGGR ) || defined ( SDIO_MULTI_PORT_RX_AGGR ) wlan_free_sdio_mpa_buffers ( pmadapter ) ; #ifdef DEBUG_LEVEL1 if ( pmadapter -> mpa_buf ) { if ( pcb -> moal_vmalloc && pcb -> moal_vfree ) pcb -> moal_vfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> mpa_buf ) ; else pcb -> moal_mfree ( pmadapter -> pmoal_handle , ( t_u8 * ) pmadapter -> mpa_buf ) ; pmadapter -> mpa_buf = MNULL ; pmadapter -> mpa_buf_size = 0 ; } #endif #endif wlan_free_mlan_buffer ( pmadapter , pmadapter -> psleep_cfm ) ; pmadapter -> psleep_cfm = MNULL ; LEAVE ( ) ; return ; }
@brief This function frees the structure of adapter
  @param pmadapter    A pointer to mlan_adapter structure
@brief This function frees the structure of adapter @param pmadapter A pointer to mlan_adapter structure
/* Free command buffer */ /* Cancel command timeout timer */ /* Cancel wakeup card timer */