aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2013-12-03 08:12:51 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-01-13 07:56:17 -0500
commitb80cb8dc4162bc954cc71efec192ed89f2061573 (patch)
treec186bb9193ed0ab7a4551fdda69144fbb277742e
parent4773ab99aa8bda57de22bf54ddbaa1a941b25fb0 (diff)
[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. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Cc: stable@vger.kernel.org Signed-off-by: Kamil Debski <k.debski@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc.c28
-rw-r--r--drivers/media/platform/s5p-mfc/s5p_mfc_common.h9
2 files changed, 7 insertions, 30 deletions
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index e46067a57853..e2aac592d29f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -177,21 +177,6 @@ unlock:
177 mutex_unlock(&dev->mfc_mutex); 177 mutex_unlock(&dev->mfc_mutex);
178} 178}
179 179
180static 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
195static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev) 180static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev)
196{ 181{
197 mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT); 182 mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT);
@@ -705,6 +690,7 @@ irq_cleanup_hw:
705/* Open an MFC node */ 690/* Open an MFC node */
706static int s5p_mfc_open(struct file *file) 691static int s5p_mfc_open(struct file *file)
707{ 692{
693 struct video_device *vdev = video_devdata(file);
708 struct s5p_mfc_dev *dev = video_drvdata(file); 694 struct s5p_mfc_dev *dev = video_drvdata(file);
709 struct s5p_mfc_ctx *ctx = NULL; 695 struct s5p_mfc_ctx *ctx = NULL;
710 struct vb2_queue *q; 696 struct vb2_queue *q;
@@ -742,7 +728,7 @@ static int s5p_mfc_open(struct file *file)
742 /* Mark context as idle */ 728 /* Mark context as idle */
743 clear_work_bit_irqsave(ctx); 729 clear_work_bit_irqsave(ctx);
744 dev->ctx[ctx->num] = ctx; 730 dev->ctx[ctx->num] = ctx;
745 if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { 731 if (vdev == dev->vfd_dec) {
746 ctx->type = MFCINST_DECODER; 732 ctx->type = MFCINST_DECODER;
747 ctx->c_ops = get_dec_codec_ops(); 733 ctx->c_ops = get_dec_codec_ops();
748 s5p_mfc_dec_init(ctx); 734 s5p_mfc_dec_init(ctx);
@@ -752,7 +738,7 @@ static int s5p_mfc_open(struct file *file)
752 mfc_err("Failed to setup mfc controls\n"); 738 mfc_err("Failed to setup mfc controls\n");
753 goto err_ctrls_setup; 739 goto err_ctrls_setup;
754 } 740 }
755 } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { 741 } else if (vdev == dev->vfd_enc) {
756 ctx->type = MFCINST_ENCODER; 742 ctx->type = MFCINST_ENCODER;
757 ctx->c_ops = get_enc_codec_ops(); 743 ctx->c_ops = get_enc_codec_ops();
758 /* only for encoder */ 744 /* only for encoder */
@@ -797,10 +783,10 @@ static int s5p_mfc_open(struct file *file)
797 q = &ctx->vq_dst; 783 q = &ctx->vq_dst;
798 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 784 q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
799 q->drv_priv = &ctx->fh; 785 q->drv_priv = &ctx->fh;
800 if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { 786 if (vdev == dev->vfd_dec) {
801 q->io_modes = VB2_MMAP; 787 q->io_modes = VB2_MMAP;
802 q->ops = get_dec_queue_ops(); 788 q->ops = get_dec_queue_ops();
803 } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { 789 } else if (vdev == dev->vfd_enc) {
804 q->io_modes = VB2_MMAP | VB2_USERPTR; 790 q->io_modes = VB2_MMAP | VB2_USERPTR;
805 q->ops = get_enc_queue_ops(); 791 q->ops = get_enc_queue_ops();
806 } else { 792 } else {
@@ -819,10 +805,10 @@ static int s5p_mfc_open(struct file *file)
819 q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; 805 q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
820 q->io_modes = VB2_MMAP; 806 q->io_modes = VB2_MMAP;
821 q->drv_priv = &ctx->fh; 807 q->drv_priv = &ctx->fh;
822 if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { 808 if (vdev == dev->vfd_dec) {
823 q->io_modes = VB2_MMAP; 809 q->io_modes = VB2_MMAP;
824 q->ops = get_dec_queue_ops(); 810 q->ops = get_dec_queue_ops();
825 } else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { 811 } else if (vdev == dev->vfd_enc) {
826 q->io_modes = VB2_MMAP | VB2_USERPTR; 812 q->io_modes = VB2_MMAP | VB2_USERPTR;
827 q->ops = get_enc_queue_ops(); 813 q->ops = get_enc_queue_ops();
828 } else { 814 } else {
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index d91f7575b088..3874f8b639fe 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -115,15 +115,6 @@ enum s5p_mfc_fmt_type {
115}; 115};
116 116
117/** 117/**
118 * enum s5p_mfc_node_type - The type of an MFC device node.
119 */
120enum s5p_mfc_node_type {
121 MFCNODE_INVALID = -1,
122 MFCNODE_DECODER = 0,
123 MFCNODE_ENCODER = 1,
124};
125
126/**
127 * enum s5p_mfc_inst_type - The type of an MFC instance. 118 * enum s5p_mfc_inst_type - The type of an MFC instance.
128 */ 119 */
129enum s5p_mfc_inst_type { 120enum s5p_mfc_inst_type {