소스 검색

video: driver: rename inst->event_handler to inst->fh

The current name is misleading as this file handler
doesn't only handles v4l2 event but used to provide
a way to easily keep file handle specific data
that is used by the V4L2 framework.

Change-Id: I902d86d69b1f3f2651521ef35aa2989a7b58051c
Signed-off-by: Dikshita Agarwal <[email protected]>
Dikshita Agarwal 2 년 전
부모
커밋
4e75ab1954

+ 2 - 2
driver/vidc/inc/msm_vidc_driver.h

@@ -486,8 +486,8 @@ int cancel_stability_work_sync(struct msm_vidc_inst *inst);
 void msm_vidc_fw_unload_handler(struct work_struct *work);
 int msm_vidc_suspend(struct msm_vidc_core *core);
 void msm_vidc_batch_handler(struct work_struct *work);
-int msm_vidc_event_queue_init(struct msm_vidc_inst *inst);
-int msm_vidc_event_queue_deinit(struct msm_vidc_inst *inst);
+int msm_vidc_v4l2_fh_init(struct msm_vidc_inst *inst);
+int msm_vidc_v4l2_fh_deinit(struct msm_vidc_inst *inst);
 int msm_vidc_vb2_queue_init(struct msm_vidc_inst *inst);
 int msm_vidc_vb2_queue_deinit(struct msm_vidc_inst *inst);
 int msm_vidc_get_control(struct msm_vidc_inst *inst, struct v4l2_ctrl *ctrl);

+ 1 - 1
driver/vidc/inc/msm_vidc_inst.h

@@ -84,7 +84,7 @@ struct msm_vidc_inst {
 	u32                                packet_size;
 	struct v4l2_format                 fmts[MAX_PORT];
 	struct v4l2_ctrl_handler           ctrl_handler;
-	struct v4l2_fh                     event_handler;
+	struct v4l2_fh                     fh;
 	struct v4l2_m2m_dev               *m2m_dev;
 	struct v4l2_m2m_ctx               *m2m_ctx;
 	u32                                num_ctrls;

+ 4 - 4
driver/vidc/src/msm_vdec.c

@@ -1466,7 +1466,7 @@ int msm_vdec_input_port_settings_change(struct msm_vidc_inst *inst)
 
 	event.type = V4L2_EVENT_SOURCE_CHANGE;
 	event.u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION;
-	v4l2_event_queue_fh(&inst->event_handler, &event);
+	v4l2_event_queue_fh(&inst->fh, &event);
 
 	return rc;
 }
@@ -2523,13 +2523,13 @@ int msm_vdec_subscribe_event(struct msm_vidc_inst *inst,
 
 	switch (sub->type) {
 	case V4L2_EVENT_EOS:
-		rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
+		rc = v4l2_event_subscribe(&inst->fh, sub, MAX_EVENTS, NULL);
 		break;
 	case V4L2_EVENT_SOURCE_CHANGE:
-		rc = v4l2_src_change_event_subscribe(&inst->event_handler, sub);
+		rc = v4l2_src_change_event_subscribe(&inst->fh, sub);
 		break;
 	case V4L2_EVENT_CTRL:
-		rc = v4l2_ctrl_subscribe_event(&inst->event_handler, sub);
+		rc = v4l2_ctrl_subscribe_event(&inst->fh, sub);
 		break;
 	default:
 		i_vpr_e(inst, "%s: invalid type %d id %d\n", __func__, sub->type, sub->id);

+ 2 - 2
driver/vidc/src/msm_venc.c

@@ -1682,10 +1682,10 @@ int msm_venc_subscribe_event(struct msm_vidc_inst *inst,
 
 	switch (sub->type) {
 	case V4L2_EVENT_EOS:
-		rc = v4l2_event_subscribe(&inst->event_handler, sub, MAX_EVENTS, NULL);
+		rc = v4l2_event_subscribe(&inst->fh, sub, MAX_EVENTS, NULL);
 		break;
 	case V4L2_EVENT_CTRL:
-		rc = v4l2_ctrl_subscribe_event(&inst->event_handler, sub);
+		rc = v4l2_ctrl_subscribe_event(&inst->fh, sub);
 		break;
 	default:
 		i_vpr_e(inst, "%s: invalid type %d id %d\n", __func__, sub->type, sub->id);

+ 6 - 6
driver/vidc/src/msm_vidc.c

@@ -82,13 +82,13 @@ int msm_vidc_poll(struct msm_vidc_inst *inst, struct file *filp,
 		return POLLERR;
 	}
 
-	poll_wait(filp, &inst->event_handler.wait, wait);
+	poll_wait(filp, &inst->fh.wait, wait);
 	poll_wait(filp, &inst->bufq[INPUT_META_PORT].vb2q->done_wq, wait);
 	poll_wait(filp, &inst->bufq[OUTPUT_META_PORT].vb2q->done_wq, wait);
 	poll_wait(filp, &inst->bufq[INPUT_PORT].vb2q->done_wq, wait);
 	poll_wait(filp, &inst->bufq[OUTPUT_PORT].vb2q->done_wq, wait);
 
-	if (v4l2_event_pending(&inst->event_handler))
+	if (v4l2_event_pending(&inst->fh))
 		poll |= POLLPRI;
 
 	poll |= get_poll_flags(inst, INPUT_META_PORT);
@@ -676,7 +676,7 @@ int msm_vidc_unsubscribe_event(struct msm_vidc_inst *inst,
 	int rc = 0;
 
 	i_vpr_h(inst, "%s: type %d id %d\n", __func__, sub->type, sub->id);
-	rc = v4l2_event_unsubscribe(&inst->event_handler, sub);
+	rc = v4l2_event_unsubscribe(&inst->fh, sub);
 	if (rc)
 		i_vpr_e(inst, "%s: failed, type %d id %d\n",
 			 __func__, sub->type, sub->id);
@@ -687,7 +687,7 @@ int msm_vidc_dqevent(struct msm_vidc_inst *inst, struct v4l2_event *event)
 {
 	int rc = 0;
 
-	rc = v4l2_event_dequeue(&inst->event_handler, event, false);
+	rc = v4l2_event_dequeue(&inst->fh, event, false);
 	if (rc)
 		i_vpr_e(inst, "%s: fialed\n", __func__);
 	return rc;
@@ -803,7 +803,7 @@ void *msm_vidc_open(struct msm_vidc_core *core, u32 session_type)
 	INIT_DELAYED_WORK(&inst->stats_work, msm_vidc_stats_handler);
 	INIT_WORK(&inst->stability_work, msm_vidc_stability_handler);
 
-	rc = msm_vidc_event_queue_init(inst);
+	rc = msm_vidc_v4l2_fh_init(inst);
 	if (rc)
 		goto fail_eventq_init;
 
@@ -850,7 +850,7 @@ fail_fence_init:
 fail_inst_init:
 	msm_vidc_vb2_queue_deinit(inst);
 fail_vb2q_init:
-	msm_vidc_event_queue_deinit(inst);
+	msm_vidc_v4l2_fh_deinit(inst);
 fail_eventq_init:
 	destroy_workqueue(inst->workq);
 fail_create_workq:

+ 15 - 15
driver/vidc/src/msm_vidc_driver.c

@@ -1350,7 +1350,7 @@ int msm_vidc_process_drain_last_flag(struct msm_vidc_inst *inst)
 	}
 
 	event.type = V4L2_EVENT_EOS;
-	v4l2_event_queue_fh(&inst->event_handler, &event);
+	v4l2_event_queue_fh(&inst->fh, &event);
 
 	return rc;
 }
@@ -1370,7 +1370,7 @@ int msm_vidc_process_psc_last_flag(struct msm_vidc_inst *inst)
 	}
 
 	event.type = V4L2_EVENT_EOS;
-	v4l2_event_queue_fh(&inst->event_handler, &event);
+	v4l2_event_queue_fh(&inst->fh, &event);
 
 	return rc;
 }
@@ -3011,7 +3011,7 @@ int msm_vidc_vb2_buffer_done(struct msm_vidc_inst *inst,
 	return 0;
 }
 
-int msm_vidc_event_queue_init(struct msm_vidc_inst *inst)
+int msm_vidc_v4l2_fh_init(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 	int index;
@@ -3019,7 +3019,7 @@ int msm_vidc_event_queue_init(struct msm_vidc_inst *inst)
 	core = inst->core;
 
 	/* do not init, if already inited */
-	if (inst->event_handler.vdev) {
+	if (inst->fh.vdev) {
 		i_vpr_e(inst, "%s: already inited\n", __func__);
 		return -EINVAL;
 	}
@@ -3031,26 +3031,26 @@ int msm_vidc_event_queue_init(struct msm_vidc_inst *inst)
 	else
 		return -EINVAL;
 
-	v4l2_fh_init(&inst->event_handler, &core->vdev[index].vdev);
-	inst->event_handler.ctrl_handler = &inst->ctrl_handler;
-	v4l2_fh_add(&inst->event_handler);
+	v4l2_fh_init(&inst->fh, &core->vdev[index].vdev);
+	inst->fh.ctrl_handler = &inst->ctrl_handler;
+	v4l2_fh_add(&inst->fh);
 
 	return rc;
 }
 
-int msm_vidc_event_queue_deinit(struct msm_vidc_inst *inst)
+int msm_vidc_v4l2_fh_deinit(struct msm_vidc_inst *inst)
 {
 	int rc = 0;
 
 	/* do not deinit, if not already inited */
-	if (!inst->event_handler.vdev) {
+	if (!inst->fh.vdev) {
 		i_vpr_h(inst, "%s: already not inited\n", __func__);
 		return 0;
 	}
 
-	v4l2_fh_del(&inst->event_handler);
-	inst->event_handler.ctrl_handler = NULL;
-	v4l2_fh_exit(&inst->event_handler);
+	v4l2_fh_del(&inst->fh);
+	inst->fh.ctrl_handler = NULL;
+	v4l2_fh_exit(&inst->fh);
 
 	return rc;
 }
@@ -3138,7 +3138,7 @@ int msm_vidc_vb2_queue_init(struct msm_vidc_inst *inst)
 		i_vpr_e(inst, "%s: v4l2_m2m_ctx_init failed\n", __func__);
 		goto fail_m2m_ctx_init;
 	}
-	inst->event_handler.m2m_ctx = inst->m2m_ctx;
+	inst->fh.m2m_ctx = inst->m2m_ctx;
 
 	rc = msm_vidc_vmem_alloc(sizeof(struct vb2_queue),
 			(void **)&inst->bufq[INPUT_META_PORT].vb2q, "input meta port");
@@ -3173,7 +3173,7 @@ fail_in_meta_vb2q_init:
 fail_in_meta_alloc:
 	v4l2_m2m_ctx_release(inst->m2m_ctx);
 	inst->m2m_ctx = NULL;
-	inst->event_handler.m2m_ctx = NULL;
+	inst->fh.m2m_ctx = NULL;
 	inst->bufq[OUTPUT_PORT].vb2q = NULL;
 	inst->bufq[INPUT_PORT].vb2q = NULL;
 fail_m2m_ctx_init:
@@ -4574,7 +4574,7 @@ static void msm_vidc_close_helper(struct kref *kref)
 	 */
 	inst_lock(inst, __func__);
 	msm_vidc_vb2_queue_deinit(inst);
-	msm_vidc_event_queue_deinit(inst);
+	msm_vidc_v4l2_fh_deinit(inst);
 	inst_unlock(inst, __func__);
 	destroy_workqueue(inst->workq);
 	msm_vidc_destroy_buffers(inst);

+ 4 - 4
driver/vidc/src/msm_vidc_v4l2.c

@@ -20,7 +20,7 @@ static struct msm_vidc_inst *get_vidc_inst(struct file *filp, void *fh)
 	if (!filp || !filp->private_data)
 		return NULL;
 	return container_of(filp->private_data,
-					struct msm_vidc_inst, event_handler);
+					struct msm_vidc_inst, fh);
 }
 
 unsigned int msm_v4l2_poll(struct file *filp, struct poll_table_struct *pt)
@@ -60,7 +60,7 @@ int msm_v4l2_open(struct file *filp)
 		trace_msm_v4l2_vidc_open("END", NULL);
 		return -ENOMEM;
 	}
-	filp->private_data = &(inst->event_handler);
+	filp->private_data = &(inst->fh);
 	trace_msm_v4l2_vidc_open("END", inst);
 	return 0;
 }
@@ -552,7 +552,7 @@ int msm_v4l2_subscribe_event(struct v4l2_fh *fh,
 	struct msm_vidc_inst *inst;
 	int rc = 0;
 
-	inst = container_of(fh, struct msm_vidc_inst, event_handler);
+	inst = container_of(fh, struct msm_vidc_inst, fh);
 	inst = get_inst_ref(g_core, inst);
 	if (!inst || !sub) {
 		d_vpr_e("%s: invalid instance\n", __func__);
@@ -584,7 +584,7 @@ int msm_v4l2_unsubscribe_event(struct v4l2_fh *fh,
 	struct msm_vidc_inst *inst;
 	int rc = 0;
 
-	inst = container_of(fh, struct msm_vidc_inst, event_handler);
+	inst = container_of(fh, struct msm_vidc_inst, fh);
 	inst = get_inst_ref(g_core, inst);
 	if (!inst || !sub) {
 		d_vpr_e("%s: invalid instance\n", __func__);