History

[media] media: s5p_mfc: remove s5p_mfc_get_node_type() function

s5p_mfc_get_node_type() relies on get_index() helper function, which in turn relies on video_device index numbers assigned on driver registration. All this code is not really needed, because there is already access to respective video_device structures via common s5p_mfc_dev structure. This fixes the issues introduced by patch 1056e4388b0454917a512618c8416a98628fc9ce ("v4l2-dev: Fix race condition on __video_register_device"), which has been merged in v3.12-rc1.

Marek Szyprowski committed 12 years ago

Commit b80cb8d1 parent 4773ab92 files · +7 −30Browse files

Unified · Split

2 files
  1. drivers/media/platform/s5p-mfc/s5p_mfc.c +7 −21
  2. drivers/media/platform/s5p-mfc/s5p_mfc_common.h +0 −9
drivers/media/platform/s5p-mfc/s5p_mfc.c+7−21
@@ -177,21 +177,6 @@ unlock: · 176 unmodified lines
177177 mutex_unlock(&dev->mfc_mutex);
178178 }
179179
180−static enum s5p_mfc_node_type s5p_mfc_get_node_type(struct file *file)
181−{
182− struct video_device *vdev = video_devdata(file);
183−
184− if (!vdev) {
185− mfc_err("failed to get video_device");
186− return MFCNODE_INVALID;
187− }
188− if (vdev->index == 0)
189− return MFCNODE_DECODER;
190− else if (vdev->index == 1)
191− return MFCNODE_ENCODER;
192− return MFCNODE_INVALID;
193−}
194−
195180 static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev)
196181 {
197182 mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT);
@@ -705,6 +690,7 @@ irq_cleanup_hw: · 507 unmodified lines
705690 /* Open an MFC node */
706691 static int s5p_mfc_open(struct file *file)
707692 {
693+ struct video_device *vdev = video_devdata(file);
708694 struct s5p_mfc_dev *dev = video_drvdata(file);
709695 struct s5p_mfc_ctx *ctx = NULL;
710696 struct vb2_queue *q;
@@ -742,7 +728,7 @@ static int s5p_mfc_open(struct file *file) · 31 unmodified lines
742728 /* Mark context as idle */
743729 clear_work_bit_irqsave(ctx);
744730 dev->ctx[ctx->num] = ctx;
745− if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) {
731+ if (vdev == dev->vfd_dec) {
746732 ctx->type = MFCINST_DECODER;
747733 ctx->c_ops = get_dec_codec_ops();
748734 s5p_mfc_dec_init(ctx);
@@ -752,7 +738,7 @@ static int s5p_mfc_open(struct file *file) · 3 unmodified lines
752738 mfc_err("Failed to setup mfc controls\n");
753739 goto err_ctrls_setup;
754740 }
755− } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) {
741+ } else if (vdev == dev->vfd_enc) {
756742 ctx->type = MFCINST_ENCODER;
757743 ctx->c_ops = get_enc_codec_ops();
758744 /* only for encoder */
@@ -797,10 +783,10 @@ static int s5p_mfc_open(struct file *file) · 38 unmodified lines
797783 q = &ctx->vq_dst;
798784 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
799785 q->drv_priv = &ctx->fh;
800− if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) {
786+ if (vdev == dev->vfd_dec) {
801787 q->io_modes = VB2_MMAP;
802788 q->ops = get_dec_queue_ops();
803− } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) {
789+ } else if (vdev == dev->vfd_enc) {
804790 q->io_modes = VB2_MMAP | VB2_USERPTR;
805791 q->ops = get_enc_queue_ops();
806792 } else {
@@ -819,10 +805,10 @@ static int s5p_mfc_open(struct file *file) · 12 unmodified lines
819805 q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
820806 q->io_modes = VB2_MMAP;
821807 q->drv_priv = &ctx->fh;
822− if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) {
808+ if (vdev == dev->vfd_dec) {
823809 q->io_modes = VB2_MMAP;
824810 q->ops = get_dec_queue_ops();
825− } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) {
811+ } else if (vdev == dev->vfd_enc) {
826812 q->io_modes = VB2_MMAP | VB2_USERPTR;
827813 q->ops = get_enc_queue_ops();
828814 } else {
drivers/media/platform/s5p-mfc/s5p_mfc_common.h+0−9
@@ -114,15 +114,6 @@ enum s5p_mfc_fmt_type { · 113 unmodified lines
114114 MFC_FMT_RAW,
115115 };
116116
117−/**
118− * enum s5p_mfc_node_type - The type of an MFC device node.
119− */
120−enum s5p_mfc_node_type {
121− MFCNODE_INVALID = -1,
122− MFCNODE_DECODER = 0,
123− MFCNODE_ENCODER = 1,
124−};
125−
126117 /**
127118 * enum s5p_mfc_inst_type - The type of an MFC instance.
128119 */