software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Set user scan
 *
 *  @param priv     A pointer to moal_private structure
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, otherwise fail
 */
@brief Set user scan
@param priv     A pointer to moal_private structure
@param wrq      A pointer to iwreq structure


@brief Set user scan @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure
static mlan_status
woal_set_user_scan_ioctl(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0;
	mlan_ioctl_req *req = NULL;
	mlan_ds_scan *scan = NULL;
	mlan_status status = MLAN_STATUS_SUCCESS;
	union iwreq_data wrqu;
	moal_handle *handle = priv->phandle;
	ENTER();
	if (handle->scan_pending_on_block == MTRUE) {
		PRINTM(MINFO, "scan already in processing...\n");
		LEAVE();
		return ret;
	}
	if (MOAL_ACQ_SEMAPHORE_BLOCK(&handle->async_sem)) {
		PRINTM(MERROR, "Acquire semaphore error, request_scan\n");
		LEAVE();
		return MLAN_STATUS_FAILURE;
	}
	handle->scan_pending_on_block = MTRUE;
	handle->scan_priv = priv;
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_scan) +
					wrq->u.data.length);
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	scan = (mlan_ds_scan *)req->pbuf;
	scan->sub_command = MLAN_OID_SCAN_USER_CONFIG;
	req->req_id = MLAN_IOCTL_SCAN;
	req->action = MLAN_ACT_SET;
	if (copy_from_user(scan->param.user_scan.scan_cfg_buf,
			   wrq->u.data.pointer, wrq->u.data.length)) {
		PRINTM(MINFO, "Copy from user failed\n");
		ret = -EFAULT;
		goto done;
	}
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status == MLAN_STATUS_SUCCESS) {
		memset(&wrqu, 0, sizeof(union iwreq_data));
		wireless_send_event(priv->netdev, SIOCGIWSCAN, &wrqu, NULL);
	}
done:
	handle->scan_pending_on_block = MFALSE;
	handle->scan_priv = NULL;
	MOAL_REL_SEMAPHORE(&handle->async_sem);
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return status;
}
static mlan_status woal_set_user_scan_ioctl ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 ; mlan_ioctl_req * req = NULL ; mlan_ds_scan * scan = NULL ; mlan_status status = MLAN_STATUS_SUCCESS ; union iwreq_data wrqu ; moal_handle * handle = priv -> phandle ; ENTER ( ) ; if ( handle -> scan_pending_on_block == MTRUE ) { PRINTM ( MINFO , " \n " ) ; LEAVE ( ) ; return ret ; } if ( MOAL_ACQ_SEMAPHORE_BLOCK ( & handle -> async_sem ) ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return MLAN_STATUS_FAILURE ; } handle -> scan_pending_on_block = MTRUE ; handle -> scan_priv = priv ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_scan ) + wrq -> u . data . length ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } scan = ( mlan_ds_scan * ) req -> pbuf ; scan -> sub_command = MLAN_OID_SCAN_USER_CONFIG ; req -> req_id = MLAN_IOCTL_SCAN ; req -> action = MLAN_ACT_SET ; if ( copy_from_user ( scan -> param . user_scan . scan_cfg_buf , wrq -> u . data . pointer , wrq -> u . data . length ) ) { PRINTM ( MINFO , " \n " ) ; ret = - EFAULT ; goto done ; } status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status == MLAN_STATUS_SUCCESS ) { memset ( & wrqu , 0 , sizeof ( union iwreq_data ) ) ; wireless_send_event ( priv -> netdev , SIOCGIWSCAN , & wrqu , NULL ) ; } done : handle -> scan_pending_on_block = MFALSE ; handle -> scan_priv = NULL ; MOAL_REL_SEMAPHORE ( & handle -> async_sem ) ; if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return status ; }
@brief Set user scan
  @param priv     A pointer to moal_private structure
  @param wrq      A pointer to iwreq structure
@brief Set user scan @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure
/* Allocate an IOCTL request buffer */ /* Fill request buffer */ /* Send IOCTL request to MLAN */