Commit 07e80305 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Mauro Carvalho Chehab

[media] v4l: mem2mem_testdev: remove BKL usage

Remove usage of BKL by usign per-device mutex.
Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
CC: Pawel Osciak <pawel@osciak.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dcd745b7
...@@ -524,7 +524,6 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f) ...@@ -524,7 +524,6 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
{ {
struct m2mtest_q_data *q_data; struct m2mtest_q_data *q_data;
struct videobuf_queue *vq; struct videobuf_queue *vq;
int ret = 0;
vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type);
if (!vq) if (!vq)
...@@ -534,12 +533,9 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f) ...@@ -534,12 +533,9 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
if (!q_data) if (!q_data)
return -EINVAL; return -EINVAL;
mutex_lock(&vq->vb_lock);
if (videobuf_queue_is_busy(vq)) { if (videobuf_queue_is_busy(vq)) {
v4l2_err(&ctx->dev->v4l2_dev, "%s queue busy\n", __func__); v4l2_err(&ctx->dev->v4l2_dev, "%s queue busy\n", __func__);
ret = -EBUSY; return -EBUSY;
goto out;
} }
q_data->fmt = find_format(f); q_data->fmt = find_format(f);
...@@ -553,9 +549,7 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f) ...@@ -553,9 +549,7 @@ static int vidioc_s_fmt(struct m2mtest_ctx *ctx, struct v4l2_format *f)
"Setting format for type %d, wxh: %dx%d, fmt: %d\n", "Setting format for type %d, wxh: %dx%d, fmt: %d\n",
f->type, q_data->width, q_data->height, q_data->fmt->fourcc); f->type, q_data->width, q_data->height, q_data->fmt->fourcc);
out: return 0;
mutex_unlock(&vq->vb_lock);
return ret;
} }
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
...@@ -845,10 +839,12 @@ static void queue_init(void *priv, struct videobuf_queue *vq, ...@@ -845,10 +839,12 @@ static void queue_init(void *priv, struct videobuf_queue *vq,
enum v4l2_buf_type type) enum v4l2_buf_type type)
{ {
struct m2mtest_ctx *ctx = priv; struct m2mtest_ctx *ctx = priv;
struct m2mtest_dev *dev = ctx->dev;
videobuf_queue_vmalloc_init(vq, &m2mtest_qops, ctx->dev->v4l2_dev.dev, videobuf_queue_vmalloc_init(vq, &m2mtest_qops, dev->v4l2_dev.dev,
&ctx->dev->irqlock, type, V4L2_FIELD_NONE, &dev->irqlock, type, V4L2_FIELD_NONE,
sizeof(struct m2mtest_buffer), priv, NULL); sizeof(struct m2mtest_buffer), priv,
&dev->dev_mutex);
} }
...@@ -920,7 +916,7 @@ static const struct v4l2_file_operations m2mtest_fops = { ...@@ -920,7 +916,7 @@ static const struct v4l2_file_operations m2mtest_fops = {
.open = m2mtest_open, .open = m2mtest_open,
.release = m2mtest_release, .release = m2mtest_release,
.poll = m2mtest_poll, .poll = m2mtest_poll,
.ioctl = video_ioctl2, .unlocked_ioctl = video_ioctl2,
.mmap = m2mtest_mmap, .mmap = m2mtest_mmap,
}; };
...@@ -965,6 +961,7 @@ static int m2mtest_probe(struct platform_device *pdev) ...@@ -965,6 +961,7 @@ static int m2mtest_probe(struct platform_device *pdev)
} }
*vfd = m2mtest_videodev; *vfd = m2mtest_videodev;
vfd->lock = &dev->dev_mutex;
ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0); ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment