software/drivers/sd8887/src/wlan/mlan/mlan_cmdevt.c
/**
 *  @brief This function executes next command in command
 *      pending queue. It will put firmware back to PS mode
 *      if applicable.
 *
 *  @param pmadapter     A pointer to mlan_adapter structure
 *
 *  @return             MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function executes next command in command
pending queue. It will put firmware back to PS mode
if applicable.

@param pmadapter     A pointer to mlan_adapter structure


@brief This function executes next command in command pending queue . It will put firmware back to PS mode if applicable . @param pmadapter A pointer to mlan_adapter structure
mlan_status
wlan_exec_next_cmd(mlan_adapter *pmadapter)
{
	mlan_private *priv = MNULL;
	cmd_ctrl_node *pcmd_node = MNULL;
	mlan_status ret = MLAN_STATUS_SUCCESS;
	HostCmd_DS_COMMAND *pcmd;
	ENTER();
	if (pmadapter == MNULL) {
		PRINTM(MERROR, "EXEC_NEXT_CMD: pmadapter is MNULL\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	if (pmadapter->curr_cmd) {
		PRINTM(MERROR,
		       "EXEC_NEXT_CMD: there is command in processing!\n");
		ret = MLAN_STATUS_FAILURE;
		goto done;
	}
	wlan_request_cmd_lock(pmadapter);
	pcmd_node =
		(cmd_ctrl_node *)util_peek_list(pmadapter->pmoal_handle,
						&pmadapter->cmd_pending_q,
						MNULL, MNULL);
	if (pcmd_node) {
		pcmd = (HostCmd_DS_COMMAND *)(pcmd_node->cmdbuf->pbuf +
					      pcmd_node->cmdbuf->data_offset);
		priv = pcmd_node->priv;
		if (pmadapter->ps_state != PS_STATE_AWAKE) {
			PRINTM(MERROR,
			       "Cannot send command in sleep state, this should not happen\n");
			wlan_release_cmd_lock(pmadapter);
			goto done;
		}
		util_unlink_list(pmadapter->pmoal_handle,
				 &pmadapter->cmd_pending_q,
				 (pmlan_linked_list)pcmd_node, MNULL, MNULL);
		wlan_release_cmd_lock(pmadapter);
		ret = wlan_dnld_cmd_to_fw(priv, pcmd_node);
		priv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY);
		if (priv &&
		    (pcmd->command !=
		     wlan_cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH))) {
			if (pmadapter->hs_activated == MTRUE) {
				pmadapter->is_hs_configured = MFALSE;
				wlan_host_sleep_activated_event(priv, MFALSE);
			}
		}
		goto done;
	} else {
		wlan_release_cmd_lock(pmadapter);
	}
	ret = MLAN_STATUS_SUCCESS;
done:
	LEAVE();
	return ret;
}
mlan_status wlan_exec_next_cmd ( mlan_adapter * pmadapter ) { mlan_private * priv = MNULL ; cmd_ctrl_node * pcmd_node = MNULL ; mlan_status ret = MLAN_STATUS_SUCCESS ; HostCmd_DS_COMMAND * pcmd ; ENTER ( ) ; if ( pmadapter == MNULL ) { PRINTM ( MERROR , " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } if ( pmadapter -> curr_cmd ) { PRINTM ( MERROR , " \n " ) ; ret = MLAN_STATUS_FAILURE ; goto done ; } wlan_request_cmd_lock ( pmadapter ) ; pcmd_node = ( cmd_ctrl_node * ) util_peek_list ( pmadapter -> pmoal_handle , & pmadapter -> cmd_pending_q , MNULL , MNULL ) ; if ( pcmd_node ) { pcmd = ( HostCmd_DS_COMMAND * ) ( pcmd_node -> cmdbuf -> pbuf + pcmd_node -> cmdbuf -> data_offset ) ; priv = pcmd_node -> priv ; if ( pmadapter -> ps_state != PS_STATE_AWAKE ) { PRINTM ( MERROR , " \n " ) ; wlan_release_cmd_lock ( pmadapter ) ; goto done ; } util_unlink_list ( pmadapter -> pmoal_handle , & pmadapter -> cmd_pending_q , ( pmlan_linked_list ) pcmd_node , MNULL , MNULL ) ; wlan_release_cmd_lock ( pmadapter ) ; ret = wlan_dnld_cmd_to_fw ( priv , pcmd_node ) ; priv = wlan_get_priv ( pmadapter , MLAN_BSS_ROLE_ANY ) ; if ( priv && ( pcmd -> command != wlan_cpu_to_le16 ( HostCmd_CMD_802_11_HS_CFG_ENH ) ) ) { if ( pmadapter -> hs_activated == MTRUE ) { pmadapter -> is_hs_configured = MFALSE ; wlan_host_sleep_activated_event ( priv , MFALSE ) ; } } goto done ; } else { wlan_release_cmd_lock ( pmadapter ) ; } ret = MLAN_STATUS_SUCCESS ; done : LEAVE ( ) ; return ret ; }
@brief This function executes next command in command
      pending queue.
@brief This function executes next command in command pending queue .
/* Sanity test */ /* Check if already in processing */ /* Check if any command is pending */ /* Any command sent to the firmware when host is in sleep mode, should de-configure host sleep */ /* We should skip the host sleep configuration command itself though */