Beispiel #1
0
static u32 vcd_term_cmn
	(struct vcd_drv_ctxt *drv_ctxt, s32 driver_handle)
{
	struct vcd_dev_ctxt *dev_ctxt = &drv_ctxt->dev_ctxt;

	if (!vcd_validate_driver_handle(dev_ctxt, driver_handle)) {
		VCD_MSG_ERROR("Invalid driver handle = %d", driver_handle);

		return VCD_ERR_BAD_HANDLE;
	}

	if (vcd_check_for_client_context(dev_ctxt,
				driver_handle - 1)) {
		VCD_MSG_ERROR("Driver has active client");

		return VCD_ERR_BAD_STATE;
	}

	--dev_ctxt->refs;
	dev_ctxt->driver_ids[driver_handle - 1] = false;

	VCD_MSG_HIGH("Driver_id %d terminated. No of driver instances = %d",
			 driver_handle - 1, dev_ctxt->refs);

	return VCD_S_SUCCESS;
}
Beispiel #2
0
static u32 vcd_open_cmn
	(struct vcd_drv_ctxt *drv_ctxt,
	 s32 driver_handle,
	 u32 decoding,
	 void (*callback) (u32 event, u32 status, void *info, size_t sz,
			   void *handle, void *const client_data),
	 void *client_data, struct vcd_clnt_ctxt ** clnt_cctxt)
{
	struct vcd_dev_ctxt *dev_ctxt = &drv_ctxt->dev_ctxt;
	struct vcd_clnt_ctxt *cctxt;
	struct vcd_clnt_ctxt *client;

	if (!vcd_validate_driver_handle(dev_ctxt, driver_handle)) {
		VCD_MSG_ERROR("Invalid driver handle = %d", driver_handle);

		return VCD_ERR_BAD_HANDLE;
	}

	cctxt =	(struct vcd_clnt_ctxt *)
		kmalloc(sizeof(struct vcd_clnt_ctxt), GFP_KERNEL);
	if (!cctxt) {
		VCD_MSG_ERROR("No memory for client ctxt");

		return VCD_ERR_ALLOC_FAIL;
	}

	memset(cctxt, 0, sizeof(struct vcd_clnt_ctxt));
	cctxt->dev_ctxt = dev_ctxt;
	cctxt->driver_id = driver_handle - 1;
	cctxt->decoding = decoding;
	cctxt->callback = callback;
	cctxt->client_data = client_data;
	cctxt->status.last_evt = VCD_EVT_RESP_OPEN;
	INIT_LIST_HEAD(&cctxt->in_buf_pool.queue);
	INIT_LIST_HEAD(&cctxt->out_buf_pool.queue);
	client = dev_ctxt->cctxt_list_head;
	dev_ctxt->cctxt_list_head = cctxt;
	cctxt->next = client;
	#if 1//FEATURE_PANTECH_MMP_QCOM_CR ,QC Case#00859255 for[WTR]Video lagging issue
	dev_ctxt->turbo_mode_set = 0; 
	#endif //QC Case#00859255 for[WTR]Video lagging issue

	*clnt_cctxt = cctxt;

	return VCD_S_SUCCESS;

}
static u32 vcd_open_cmn
(struct vcd_drv_ctxt_type_t *p_drv_ctxt,
 s32 driver_handle,
 u32 b_decoding,
 void (*callback) (u32 event, u32 status, void *p_info, u32 n_size,
                   void *handle, void *const p_client_data),
 void *p_client_data, struct vcd_clnt_ctxt_type_t ** pp_cctxt)
{
    struct vcd_dev_ctxt_type *p_dev_ctxt = &p_drv_ctxt->dev_ctxt;
    struct vcd_clnt_ctxt_type_t *p_cctxt;
    struct vcd_clnt_ctxt_type_t *p_client;

    if (!vcd_validate_driver_handle(p_dev_ctxt, driver_handle)) {
        VCD_MSG_ERROR("Invalid driver handle = %d", driver_handle);

        return VCD_ERR_BAD_HANDLE;
    }

    p_cctxt =
        (struct vcd_clnt_ctxt_type_t *)
        vcd_malloc(sizeof(struct vcd_clnt_ctxt_type_t));
    if (!p_cctxt) {
        VCD_MSG_ERROR("No memory for client ctxt");

        return VCD_ERR_ALLOC_FAIL;
    }

    memset(p_cctxt, 0, sizeof(struct vcd_clnt_ctxt_type_t));
    p_cctxt->p_dev_ctxt = p_dev_ctxt;
    p_cctxt->driver_id = driver_handle - 1;
    p_cctxt->b_decoding = b_decoding;
    p_cctxt->callback = callback;
    p_cctxt->p_client_data = p_client_data;

    p_client = p_dev_ctxt->p_cctxt_list_head;
    p_dev_ctxt->p_cctxt_list_head = p_cctxt;
    p_cctxt->p_next = p_client;

    *pp_cctxt = p_cctxt;

    return VCD_S_SUCCESS;

}