提交 b80cb8dc 编写于 作者: M Marek Szyprowski 提交者: Mauro Carvalho Chehab

[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
1056e438 ("v4l2-dev: Fix race condition
on __video_register_device"), which has been merged in v3.12-rc1.
Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
Cc: stable@vger.kernel.org
Signed-off-by: NKamil Debski <k.debski@samsung.com>
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 4773ab99
...@@ -177,21 +177,6 @@ static void s5p_mfc_watchdog_worker(struct work_struct *work) ...@@ -177,21 +177,6 @@ static void s5p_mfc_watchdog_worker(struct work_struct *work)
mutex_unlock(&dev->mfc_mutex); mutex_unlock(&dev->mfc_mutex);
} }
static enum s5p_mfc_node_type s5p_mfc_get_node_type(struct file *file)
{
struct video_device *vdev = video_devdata(file);
if (!vdev) {
mfc_err("failed to get video_device");
return MFCNODE_INVALID;
}
if (vdev->index == 0)
return MFCNODE_DECODER;
else if (vdev->index == 1)
return MFCNODE_ENCODER;
return MFCNODE_INVALID;
}
static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev) static void s5p_mfc_clear_int_flags(struct s5p_mfc_dev *dev)
{ {
mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT); mfc_write(dev, 0, S5P_FIMV_RISC_HOST_INT);
...@@ -705,6 +690,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv) ...@@ -705,6 +690,7 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
/* Open an MFC node */ /* Open an MFC node */
static int s5p_mfc_open(struct file *file) static int s5p_mfc_open(struct file *file)
{ {
struct video_device *vdev = video_devdata(file);
struct s5p_mfc_dev *dev = video_drvdata(file); struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = NULL; struct s5p_mfc_ctx *ctx = NULL;
struct vb2_queue *q; struct vb2_queue *q;
...@@ -742,7 +728,7 @@ static int s5p_mfc_open(struct file *file) ...@@ -742,7 +728,7 @@ static int s5p_mfc_open(struct file *file)
/* Mark context as idle */ /* Mark context as idle */
clear_work_bit_irqsave(ctx); clear_work_bit_irqsave(ctx);
dev->ctx[ctx->num] = ctx; dev->ctx[ctx->num] = ctx;
if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { if (vdev == dev->vfd_dec) {
ctx->type = MFCINST_DECODER; ctx->type = MFCINST_DECODER;
ctx->c_ops = get_dec_codec_ops(); ctx->c_ops = get_dec_codec_ops();
s5p_mfc_dec_init(ctx); s5p_mfc_dec_init(ctx);
...@@ -752,7 +738,7 @@ static int s5p_mfc_open(struct file *file) ...@@ -752,7 +738,7 @@ static int s5p_mfc_open(struct file *file)
mfc_err("Failed to setup mfc controls\n"); mfc_err("Failed to setup mfc controls\n");
goto err_ctrls_setup; goto err_ctrls_setup;
} }
} else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { } else if (vdev == dev->vfd_enc) {
ctx->type = MFCINST_ENCODER; ctx->type = MFCINST_ENCODER;
ctx->c_ops = get_enc_codec_ops(); ctx->c_ops = get_enc_codec_ops();
/* only for encoder */ /* only for encoder */
...@@ -797,10 +783,10 @@ static int s5p_mfc_open(struct file *file) ...@@ -797,10 +783,10 @@ static int s5p_mfc_open(struct file *file)
q = &ctx->vq_dst; q = &ctx->vq_dst;
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
q->drv_priv = &ctx->fh; q->drv_priv = &ctx->fh;
if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { if (vdev == dev->vfd_dec) {
q->io_modes = VB2_MMAP; q->io_modes = VB2_MMAP;
q->ops = get_dec_queue_ops(); q->ops = get_dec_queue_ops();
} else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { } else if (vdev == dev->vfd_enc) {
q->io_modes = VB2_MMAP | VB2_USERPTR; q->io_modes = VB2_MMAP | VB2_USERPTR;
q->ops = get_enc_queue_ops(); q->ops = get_enc_queue_ops();
} else { } else {
...@@ -819,10 +805,10 @@ static int s5p_mfc_open(struct file *file) ...@@ -819,10 +805,10 @@ static int s5p_mfc_open(struct file *file)
q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE; q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
q->io_modes = VB2_MMAP; q->io_modes = VB2_MMAP;
q->drv_priv = &ctx->fh; q->drv_priv = &ctx->fh;
if (s5p_mfc_get_node_type(file) == MFCNODE_DECODER) { if (vdev == dev->vfd_dec) {
q->io_modes = VB2_MMAP; q->io_modes = VB2_MMAP;
q->ops = get_dec_queue_ops(); q->ops = get_dec_queue_ops();
} else if (s5p_mfc_get_node_type(file) == MFCNODE_ENCODER) { } else if (vdev == dev->vfd_enc) {
q->io_modes = VB2_MMAP | VB2_USERPTR; q->io_modes = VB2_MMAP | VB2_USERPTR;
q->ops = get_enc_queue_ops(); q->ops = get_enc_queue_ops();
} else { } else {
......
...@@ -114,15 +114,6 @@ enum s5p_mfc_fmt_type { ...@@ -114,15 +114,6 @@ enum s5p_mfc_fmt_type {
MFC_FMT_RAW, MFC_FMT_RAW,
}; };
/**
* enum s5p_mfc_node_type - The type of an MFC device node.
*/
enum s5p_mfc_node_type {
MFCNODE_INVALID = -1,
MFCNODE_DECODER = 0,
MFCNODE_ENCODER = 1,
};
/** /**
* enum s5p_mfc_inst_type - The type of an MFC instance. * enum s5p_mfc_inst_type - The type of an MFC instance.
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册