software/drivers/sd8887/src/wlan/mlinux/moal_ioctl.c
/**
 * @brief Set Country Code
 *
 * @param priv     A pointer to moal_private structure
 * @param region   A pointer to region string
 *
 * @return         MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, otherwise fail
 */
@brief Set Country Code
@param priv     A pointer to moal_private structure
@param region   A pointer to region string


@brief Set Country Code @param priv A pointer to moal_private structure @param region A pointer to region string
int
woal_set_countrycode(moal_private *priv, char *country)
{
	int ret = 0;
	mlan_ioctl_req *req = NULL;
	mlan_ds_misc_cfg *pcfg_misc = NULL;
	mlan_ds_misc_country_code *country_code = NULL;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	pcfg_misc = (mlan_ds_misc_cfg *)req->pbuf;
	country_code = &pcfg_misc->param.country_code;
	pcfg_misc->sub_command = MLAN_OID_MISC_COUNTRY_CODE;
	req->req_id = MLAN_IOCTL_MISC_CFG;
	memset(country_code->country_code, 0, COUNTRY_CODE_LEN);
	memcpy(country_code->country_code, country, COUNTRY_CODE_LEN - 1);
	req->action = MLAN_ACT_SET;
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		ret = -EFAULT;
		goto done;
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
int woal_set_countrycode ( moal_private * priv , char * country ) { int ret = 0 ; mlan_ioctl_req * req = NULL ; mlan_ds_misc_cfg * pcfg_misc = NULL ; mlan_ds_misc_country_code * country_code = NULL ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_misc_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } pcfg_misc = ( mlan_ds_misc_cfg * ) req -> pbuf ; country_code = & pcfg_misc -> param . country_code ; pcfg_misc -> sub_command = MLAN_OID_MISC_COUNTRY_CODE ; req -> req_id = MLAN_IOCTL_MISC_CFG ; memset ( country_code -> country_code , 0 , COUNTRY_CODE_LEN ) ; memcpy ( country_code -> country_code , country , COUNTRY_CODE_LEN - 1 ) ; req -> action = MLAN_ACT_SET ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set Country Code
 @param priv     A pointer to moal_private structure
 @param region   A pointer to region string
@brief Set Country Code @param priv A pointer to moal_private structure @param region A pointer to region string
/* Allocate an IOCTL request buffer */ /* Fill request buffer */ /* Send IOCTL request to MLAN */