summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Anaszewski <j.anaszewski@samsung.com>2014-04-10 07:32:13 (GMT)
committerChanho Park <chanho61.park@samsung.com>2014-11-18 03:01:12 (GMT)
commit37572357e0aafbde4d8d86869f05bdb6e8105795 (patch)
treec3196ef0d8b26f30f51fbbc916179cf10f4bcbb9
parent7e6219aa75312a5660cba94d1ae6c8d4ee6805c3 (diff)
downloadlinux-3.10-37572357e0aafbde4d8d86869f05bdb6e8105795.zip
linux-3.10-37572357e0aafbde4d8d86869f05bdb6e8105795.tar.gz
linux-3.10-37572357e0aafbde4d8d86869f05bdb6e8105795.tar.bz2
[media] s5p-jpeg: Add m2m_ops field to the s5p_jpeg_variant structure
Simplify the code by adding m2m_ops field to the s5p_jpeg_variant structure which allows to avoid "if" statement in the s5p_jpeg_probe function. Change-Id: I3ae0bc8e5af4ee26aa13f136255342eb3c50e89e Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.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.c12
-rw-r--r--drivers/media/platform/s5p-jpeg/jpeg-core.h7
2 files changed, 8 insertions, 11 deletions
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 5cf7835..4a98154 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1566,7 +1566,7 @@ static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = {
.job_abort = s5p_jpeg_job_abort,
}
;
-static struct v4l2_m2m_ops exynos_jpeg_m2m_ops = {
+static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = {
.device_run = exynos4_jpeg_device_run,
.job_ready = s5p_jpeg_job_ready,
.job_abort = s5p_jpeg_job_abort,
@@ -1850,7 +1850,6 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
{
struct s5p_jpeg *jpeg;
struct resource *res;
- struct v4l2_m2m_ops *samsung_jpeg_m2m_ops;
int ret;
if (!pdev->dev.of_node)
@@ -1904,13 +1903,8 @@ static int s5p_jpeg_probe(struct platform_device *pdev)
goto clk_get_rollback;
}
- if (jpeg->variant->version == SJPEG_S5P)
- samsung_jpeg_m2m_ops = &s5p_jpeg_m2m_ops;
- else
- samsung_jpeg_m2m_ops = &exynos_jpeg_m2m_ops;
-
/* mem2mem device */
- jpeg->m2m_dev = v4l2_m2m_init(samsung_jpeg_m2m_ops);
+ jpeg->m2m_dev = v4l2_m2m_init(jpeg->variant->m2m_ops);
if (IS_ERR(jpeg->m2m_dev)) {
v4l2_err(&jpeg->v4l2_dev, "Failed to init mem2mem device\n");
ret = PTR_ERR(jpeg->m2m_dev);
@@ -2099,12 +2093,14 @@ static const struct dev_pm_ops s5p_jpeg_pm_ops = {
static struct s5p_jpeg_variant s5p_jpeg_drvdata = {
.version = SJPEG_S5P,
.jpeg_irq = s5p_jpeg_irq,
+ .m2m_ops = &s5p_jpeg_m2m_ops,
.fmt_ver_flag = SJPEG_FMT_FLAG_S5P,
};
static struct s5p_jpeg_variant exynos4_jpeg_drvdata = {
.version = SJPEG_EXYNOS4,
.jpeg_irq = exynos4_jpeg_irq,
+ .m2m_ops = &exynos4_jpeg_m2m_ops,
.fmt_ver_flag = SJPEG_FMT_FLAG_EXYNOS4,
};
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.h b/drivers/media/platform/s5p-jpeg/jpeg-core.h
index c222436..3e47863 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.h
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.h
@@ -117,9 +117,10 @@ struct s5p_jpeg {
};
struct s5p_jpeg_variant {
- unsigned int version;
- unsigned int fmt_ver_flag;
- irqreturn_t (*jpeg_irq)(int irq, void *priv);
+ unsigned int version;
+ unsigned int fmt_ver_flag;
+ struct v4l2_m2m_ops *m2m_ops;
+ irqreturn_t (*jpeg_irq)(int irq, void *priv);
};
/**