software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief initialize p2p client for wpa_supplicant
 *
 * @param priv			A pointer to moal private structure
 *
 * @return              0 -- success, otherwise fail
 */
@brief initialize p2p client for wpa_supplicant
@param priv                  A pointer to moal private structure

@return              0 -- success, otherwise fail
@brief initialize p2p client for wpa_supplicant @param priv A pointer to moal private structure @return 0 -- success otherwise fail
int
woal_cfg80211_init_p2p_client(moal_private *priv)
{
	int ret = MLAN_STATUS_SUCCESS;
	t_u16 wifi_direct_mode = WIFI_DIRECT_MODE_DISABLE;
	t_u8 bss_role;
	ENTER();
	if (priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT) {
		PRINTM(MERROR, "Unexpected bss type when init p2p client\n");
		ret = -EFAULT;
		goto done;
	}
	if (MLAN_STATUS_SUCCESS !=
	    woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_GET, &bss_role)) {
		ret = -EFAULT;
		goto done;
	}
	if (bss_role != MLAN_BSS_ROLE_STA) {
		bss_role = MLAN_BSS_ROLE_STA;
		if (MLAN_STATUS_SUCCESS !=
		    woal_cfg80211_bss_role_cfg(priv, MLAN_ACT_SET, &bss_role)) {
			ret = -EFAULT;
			goto done;
		}
	}
	wifi_direct_mode = WIFI_DIRECT_MODE_DISABLE;
	if (MLAN_STATUS_SUCCESS !=
	    woal_wifi_direct_mode_cfg(priv, MLAN_ACT_SET, &wifi_direct_mode)) {
		ret = -EFAULT;
		goto done;
	}
	wifi_direct_mode = WIFI_DIRECT_MODE_LISTEN;
	if (MLAN_STATUS_SUCCESS !=
	    woal_wifi_direct_mode_cfg(priv, MLAN_ACT_SET, &wifi_direct_mode)) {
		ret = -EFAULT;
		goto done;
	}
	wifi_direct_mode = WIFI_DIRECT_MODE_CLIENT;
	if (MLAN_STATUS_SUCCESS !=
	    woal_wifi_direct_mode_cfg(priv, MLAN_ACT_SET, &wifi_direct_mode)) {
		ret = -EFAULT;
		goto done;
	}
done:
	LEAVE();
	return ret;
}
int woal_cfg80211_init_p2p_client ( moal_private * priv ) { int ret = MLAN_STATUS_SUCCESS ; t_u16 wifi_direct_mode = WIFI_DIRECT_MODE_DISABLE ; t_u8 bss_role ; ENTER ( ) ; if ( priv -> bss_type != MLAN_BSS_TYPE_WIFIDIRECT ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } if ( MLAN_STATUS_SUCCESS != woal_cfg80211_bss_role_cfg ( priv , MLAN_ACT_GET , & bss_role ) ) { ret = - EFAULT ; goto done ; } if ( bss_role != MLAN_BSS_ROLE_STA ) { bss_role = MLAN_BSS_ROLE_STA ; if ( MLAN_STATUS_SUCCESS != woal_cfg80211_bss_role_cfg ( priv , MLAN_ACT_SET , & bss_role ) ) { ret = - EFAULT ; goto done ; } } wifi_direct_mode = WIFI_DIRECT_MODE_DISABLE ; if ( MLAN_STATUS_SUCCESS != woal_wifi_direct_mode_cfg ( priv , MLAN_ACT_SET , & wifi_direct_mode ) ) { ret = - EFAULT ; goto done ; } wifi_direct_mode = WIFI_DIRECT_MODE_LISTEN ; if ( MLAN_STATUS_SUCCESS != woal_wifi_direct_mode_cfg ( priv , MLAN_ACT_SET , & wifi_direct_mode ) ) { ret = - EFAULT ; goto done ; } wifi_direct_mode = WIFI_DIRECT_MODE_CLIENT ; if ( MLAN_STATUS_SUCCESS != woal_wifi_direct_mode_cfg ( priv , MLAN_ACT_SET , & wifi_direct_mode ) ) { ret = - EFAULT ; goto done ; } done : LEAVE ( ) ; return ret ; }
@brief initialize p2p client for wpa_supplicant
 @param priv                  A pointer to moal private structure
@brief initialize p2p client for wpa_supplicant @param priv A pointer to moal private structure
/* bss type check */ /* get the bss role */ /* first, init wifi direct to listen mode */ /* second, init wifi direct client  */