software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Get scan table ioctl
 *
 *  @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 Get scan table ioctl
@param priv     A pointer to moal_private structure
@param wrq      A pointer to iwreq structure


@brief Get scan table ioctl @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure
static mlan_status
woal_get_scan_table_ioctl(moal_private *priv, struct iwreq *wrq)
{
	int ret = 0;
	mlan_ioctl_req *req = NULL;
	mlan_ds_scan *scan = NULL;
	int scan_start = 0;
	mlan_status status = MLAN_STATUS_SUCCESS;
	ENTER();
	req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_scan));
	if (req == NULL) {
		ret = -ENOMEM;
		goto done;
	}
	scan = (mlan_ds_scan *)req->pbuf;
	req->req_id = MLAN_IOCTL_SCAN;
	req->action = MLAN_ACT_GET;
	if (copy_from_user
	    (&scan_start, wrq->u.data.pointer, sizeof(scan_start))) {
		PRINTM(MERROR, "copy from user failed\n");
		ret = -EFAULT;
		goto done;
	}
	if (scan_start > 0)
		scan->sub_command = MLAN_OID_SCAN_NORMAL;
	else
		scan->sub_command = MLAN_OID_SCAN_GET_CURRENT_BSS;
	status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
	if (status == MLAN_STATUS_SUCCESS) {
		status = moal_ret_get_scan_table_ioctl(wrq,
						       &scan->param.scan_resp,
						       scan_start);
	}
done:
	if (status != MLAN_STATUS_PENDING)
		kfree(req);
	LEAVE();
	return status;
}
static mlan_status woal_get_scan_table_ioctl ( moal_private * priv , struct iwreq * wrq ) { int ret = 0 ; mlan_ioctl_req * req = NULL ; mlan_ds_scan * scan = NULL ; int scan_start = 0 ; mlan_status status = MLAN_STATUS_SUCCESS ; ENTER ( ) ; req = woal_alloc_mlan_ioctl_req ( sizeof ( mlan_ds_scan ) ) ; if ( req == NULL ) { ret = - ENOMEM ; goto done ; } scan = ( mlan_ds_scan * ) req -> pbuf ; req -> req_id = MLAN_IOCTL_SCAN ; req -> action = MLAN_ACT_GET ; if ( copy_from_user ( & scan_start , wrq -> u . data . pointer , sizeof ( scan_start ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } if ( scan_start > 0 ) scan -> sub_command = MLAN_OID_SCAN_NORMAL ; else scan -> sub_command = MLAN_OID_SCAN_GET_CURRENT_BSS ; status = woal_request_ioctl ( priv , req , MOAL_IOCTL_WAIT ) ; if ( status == MLAN_STATUS_SUCCESS ) { status = moal_ret_get_scan_table_ioctl ( wrq , & scan -> param . scan_resp , scan_start ) ; } done : if ( status != MLAN_STATUS_PENDING ) kfree ( req ) ; LEAVE ( ) ; return status ; }
@brief Get scan table ioctl
  @param priv     A pointer to moal_private structure
  @param wrq      A pointer to iwreq structure
@brief Get scan table ioctl @param priv A pointer to moal_private structure @param wrq A pointer to iwreq structure
/* Allocate an IOCTL request buffer */ /* Fill request buffer */ /* get the whole command from user */ /* Send IOCTL request to MLAN */