software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Set/get user provisioned local power constraint
 *
 *  @param priv     A pointer to moal_private structure
 *  @param wrq      A pointer to iwreq structure
 *  @return         0 --success, otherwise fail
 */
@brief Set/get user provisioned local power constraint
@param priv     A pointer to moal_private structure
@param wrq      A pointer to iwreq structure
@return         0 --success, otherwise fail
@brief Set / get user provisioned local power constraint @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
static int
woal_set_get_11h_local_pwr_constraint(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0, data = 0;
	mlan_ioctl_req *req = NULL;
	mlan_ds_11h_cfg *ds_11hcfg = NULL;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11h_cfg));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	ds_11hcfg = (mlan_ds_11h_cfg *)req->pbuf;
	if (wrq->u.data.length) {
		if (copy_from_user(&data, wrq->u.data.pointer, sizeof(int))) {
			PRINTM(MINFO, "Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		ds_11hcfg->param.usr_local_power_constraint = (t_s8)data;
		req->action = MLAN_ACT_SET;
	} else
		req->action = MLAN_ACT_GET;
	ds_11hcfg->sub_command = MLAN_OID_11H_LOCAL_POWER_CONSTRAINT;
	req->req_id = MLAN_IOCTL_11H_CFG;
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status != MLAN_STATUS_SUCCESS) {
		ret = -EFAULT;
		goto done;
	}
	if (req->action == MLAN_ACT_GET) {
		data = (int)ds_11hcfg->param.usr_local_power_constraint;
		if (copy_to_user(wrq->u.data.pointer, &data, sizeof(int))) {
			PRINTM(MINFO, "Copy to user failed\n");
			ret = -EFAULT;
			goto done;
		}
		wrq->u.data.length = 1;
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return ret;
}
static int woal_set_get_11h_local_pwr_constraint ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 , data = 0 ; mlan_ioctl_req * req = NULL ; mlan_ds_11h_cfg * ds_11hcfg = NULL ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_11h_cfg ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } ds_11hcfg = ( mlan_ds_11h_cfg * ) req -> pbuf ; if ( wrq -> u . data . length ) { if ( copy_from_user ( & data , wrq -> u . data . pointer , sizeof ( int ) ) ) { PRINTM ( MINFO , " \n " ) ; ret = - EFAULT ; goto done ; } ds_11hcfg -> param . usr_local_power_constraint = ( t_s8 ) data ; req -> action = MLAN_ACT_SET ; } else req -> action = MLAN_ACT_GET ; ds_11hcfg -> sub_command = MLAN_OID_11H_LOCAL_POWER_CONSTRAINT ; req -> req_id = MLAN_IOCTL_11H_CFG ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status != MLAN_STATUS_SUCCESS ) { ret = - EFAULT ; goto done ; } if ( req -> action == MLAN_ACT_GET ) { data = ( int ) ds_11hcfg -> param . usr_local_power_constraint ; if ( copy_to_user ( wrq -> u . data . pointer , & data , sizeof ( int ) ) ) { PRINTM ( MINFO , " \n " ) ; ret = - EFAULT ; goto done ; } wrq -> u . data . length = 1 ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return ret ; }
@brief Set/get user provisioned local power constraint
  @param priv     A pointer to moal_private structure
  @param wrq      A pointer to iwreq structure
  @return         0 --success, otherwise fail
@brief Set / get user provisioned local power constraint @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
/* Copy response to user */