summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2013-11-25 09:58:14 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-11-18 03:01:09 (GMT)
commitfe432e367465fc7fdc04958d5fdcd26f9c9474ec (patch)
treef7cd6e577b846b7638a28c8981e2aedec847313a
parente0cd151b5010c5cf1daaaefea78ed70c08319c13 (diff)
downloadlinux-3.10-fe432e367465fc7fdc04958d5fdcd26f9c9474ec.zip
linux-3.10-fe432e367465fc7fdc04958d5fdcd26f9c9474ec.tar.gz
linux-3.10-fe432e367465fc7fdc04958d5fdcd26f9c9474ec.tar.bz2
[media] s5p-jpeg: Fix lack of spin_lock protection
s5p_jpeg_device_run and s5p_jpeg_runtime_resume callbacks should have spin_lock protection as they alter device registers. Change-Id: I56f19f6314c58e21284562e3e92c08409664aee4 Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 2d70003..e780d17 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -930,7 +930,9 @@ static void s5p_jpeg_device_run(void *priv)
struct s5p_jpeg_ctx *ctx = priv;
struct s5p_jpeg *jpeg = ctx->jpeg;
struct vb2_buffer *src_buf, *dst_buf;
- unsigned long src_addr, dst_addr;
+ unsigned long src_addr, dst_addr, flags;
+
+ spin_lock_irqsave(&ctx->jpeg->slock, flags);
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
@@ -998,6 +1000,8 @@ static void s5p_jpeg_device_run(void *priv)
}
jpeg_start(jpeg->regs);
+
+ spin_unlock_irqrestore(&ctx->jpeg->slock, flags);
}
static int s5p_jpeg_job_ready(void *priv)
@@ -1419,12 +1423,15 @@ static int s5p_jpeg_runtime_suspend(struct device *dev)
static int s5p_jpeg_runtime_resume(struct device *dev)
{
struct s5p_jpeg *jpeg = dev_get_drvdata(dev);
+ unsigned long flags;
int ret;
ret = clk_prepare_enable(jpeg->clk);
if (ret < 0)
return ret;
+ spin_lock_irqsave(&jpeg->slock, flags);
+
/*
* JPEG IP allows storing two Huffman tables for each component
* We fill table 0 for each component
@@ -1434,6 +1441,8 @@ static int s5p_jpeg_runtime_resume(struct device *dev)
s5p_jpeg_set_hactbl(jpeg->regs);
s5p_jpeg_set_hactblg(jpeg->regs);
+ spin_unlock_irqrestore(&jpeg->slock, flags);
+
return 0;
}