示例#1
0
static int usf_set_rx_info(struct usf_type *usf, unsigned long arg)
{
	struct us_rx_info_type config_rx;
	struct usf_xx_type *usf_xx =  &usf->usf_rx;
	int rc = copy_from_user(&config_rx,
			    (void *) arg,
			    sizeof(config_rx));

	if (rc) {
		pr_err("%s: copy config_rx from user; rc=%d\n",
			__func__, rc);
		return -EFAULT;
	}

	usf_xx->new_region = USM_UNDEF_TOKEN;
	usf_xx->prev_region = USM_UNDEF_TOKEN;

	usf_xx->cb = usf_rx_cb;

	rc = config_xx(usf_xx, &config_rx.us_xx_info);
	if (rc)
		return rc;

	rc = q6usm_open_write(usf_xx->usc,
			      usf_xx->encdec_cfg.format_id);
	if (rc)
		return rc;

	rc = q6usm_us_client_buf_alloc(
				IN,
				usf_xx->usc,
				usf_xx->buffer_size,
				usf_xx->buffer_count);
	if (rc) {
		(void)q6usm_cmd(usf_xx->usc, CMD_CLOSE);
		return rc;
	}

	rc = q6usm_us_param_buf_alloc(IN, usf_xx->usc,
			config_rx.us_xx_info.max_get_set_param_buf_size);
	if (rc) {
		(void)q6usm_cmd(usf_xx->usc, CMD_CLOSE);
		return rc;
	}

	rc = q6usm_dec_cfg_blk(usf_xx->usc,
			       &usf_xx->encdec_cfg);
	if (rc)
		(void)q6usm_cmd(usf_xx->usc, CMD_CLOSE);
	else {
		init_waitqueue_head(&usf_xx->wait);
		usf_xx->usf_state = USF_CONFIGURED_STATE;
	}

	return rc;
} /* usf_set_rx_info */
示例#2
0
static int usf_set_rx_info(struct usf_type *usf, unsigned long arg)
{
	struct us_rx_info_type config_rx;
	struct usf_xx_type *usf_xx =  &usf->usf_rx;
	int rc = copy_from_user(&config_rx,
			    (void *) arg,
			    sizeof(config_rx));

	if (rc) {
		pr_err("%s: copy_from_user() failed[%d]\n",
			__func__, rc);
		return -EINVAL;
	}

	usf_xx->new_region = USM_UNDEF_TOKEN;
	usf_xx->prev_region = USM_UNDEF_TOKEN;

	usf_xx->cb = usf_rx_cb;

	rc = config_xx(usf_xx, &config_rx.us_xx_info);
	if (rc)
		return rc;

	rc = q6usm_open_write(usf_xx->usc,
			      usf_xx->encdec_cfg.format_id);
	if (rc)
		return rc;

	if (usf_xx->buffer_size && usf_xx->buffer_count) {
		rc = q6usm_us_client_buf_alloc(
					IN,
					usf_xx->usc,
					usf_xx->buffer_size,
					usf_xx->buffer_count);
		if (rc)
			return rc;
	}

	rc = q6usm_dec_cfg_blk(usf_xx->usc,
			       &usf_xx->encdec_cfg);
	if (!rc) {
		init_waitqueue_head(&usf_xx->wait);
		usf_xx->usf_state = USF_CONFIGURED_STATE;
	}

	return rc;
} /* usf_set_rx_info */