software/drivers/sd8887/src/wlan/mlinux/moal_priv.c
/**
 *  @brief Set/Get auth type
 *
 *  @param priv     Pointer to the moal_private driver data struct
 *  @param wrq      A pointer to iwreq structure
 *
 *  @return         0 --success, otherwise fail
 */
@brief Set/Get auth type
@param priv     Pointer to the moal_private driver data struct
@param wrq      A pointer to iwreq structure

@return         0 --success, otherwise fail
@brief Set / Get auth type @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure @return 0 -- success otherwise fail
static int
woal_auth_type(moal_private *priv, struct iwreq *wrq)
{
	int auth_type;
	t_u32 auth_mode;
	int ret = 0;
	ENTER();
	if (wrq->u.data.length == 0) {
		if (MLAN_STATUS_SUCCESS !=
		    woal_get_auth_mode(priv, MOAL_IOCTL_WAIT, &auth_mode)) {
			ret = -EFAULT;
			goto done;
		}
		auth_type = auth_mode;
		if (copy_to_user
		    (wrq->u.data.pointer, &auth_type, sizeof(auth_type))) {
			PRINTM(MERROR, "Copy to user failed\n");
			ret = -EFAULT;
			goto done;
		}
		wrq->u.data.length = 1;
	} else {
		if (copy_from_user
		    (&auth_type, wrq->u.data.pointer, sizeof(auth_type))) {
			PRINTM(MERROR, "Copy from user failed\n");
			ret = -EFAULT;
			goto done;
		}
		PRINTM(MINFO, "SET: auth_type %d\n", auth_type);
		if (((auth_type < MLAN_AUTH_MODE_OPEN) ||
		     (auth_type > MLAN_AUTH_MODE_SHARED))
		    && (auth_type != MLAN_AUTH_MODE_AUTO)) {
			ret = -EINVAL;
			goto done;
		}
		auth_mode = auth_type;
		if (MLAN_STATUS_SUCCESS !=
		    woal_set_auth_mode(priv, MOAL_IOCTL_WAIT, auth_mode)) {
			ret = -EFAULT;
			goto done;
		}
	}
done:
	LEAVE();
	return ret;
}
static int woal_auth_type ( moal_private * priv , struct iwreq * wrq ) { int auth_type ; t_u32 auth_mode ; int ret = 0 ; ENTER ( ) ; if ( wrq -> u . data . length == 0 ) { if ( MLAN_STATUS_SUCCESS != woal_get_auth_mode ( priv , MOAL_IOCTL_WAIT , & auth_mode ) ) { ret = - EFAULT ; goto done ; } auth_type = auth_mode ; if ( copy_to_user ( wrq -> u . data . pointer , & auth_type , sizeof ( auth_type ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } wrq -> u . data . length = 1 ; } else { if ( copy_from_user ( & auth_type , wrq -> u . data . pointer , sizeof ( auth_type ) ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } PRINTM ( MINFO , " \n " , auth_type ) ; if ( ( ( auth_type < MLAN_AUTH_MODE_OPEN ) || ( auth_type > MLAN_AUTH_MODE_SHARED ) ) && ( auth_type != MLAN_AUTH_MODE_AUTO ) ) { ret = - EINVAL ; goto done ; } auth_mode = auth_type ; if ( MLAN_STATUS_SUCCESS != woal_set_auth_mode ( priv , MOAL_IOCTL_WAIT , auth_mode ) ) { ret = - EFAULT ; goto done ; } } done : LEAVE ( ) ; return ret ; }
@brief Set/Get auth type
  @param priv     Pointer to the moal_private driver data struct
  @param wrq      A pointer to iwreq structure
@brief Set / Get auth type @param priv Pointer to the moal_private driver data struct @param wrq A pointer to iwreq structure