Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] constify v4l2_m2m_ops structures
@ 2017-08-06  8:25 Julia Lawall
  2017-08-06  8:25 ` [PATCH 05/12] [media] vcodec: mediatek: " Julia Lawall
  2017-08-06  8:25 ` [PATCH 12/12] [media] mtk-mdp: " Julia Lawall
  0 siblings, 2 replies; 4+ messages in thread
From: Julia Lawall @ 2017-08-06  8:25 UTC (permalink / raw)
  To: linux-mediatek
  Cc: bhumirks, kernel-janitors, linux-arm-kernel,
	Mauro Carvalho Chehab, linux-media, linux-kernel,
	linux-samsung-soc

The v4l2_m2m_ops structures are only passed as the only
argument to v4l2_m2m_init, which is declared as const.
Thus the v4l2_m2m_ops structures themselves can be const.

Done with the help of Coccinelle.

---

 drivers/media/platform/exynos-gsc/gsc-m2m.c     |    2 +-
 drivers/media/platform/exynos4-is/fimc-m2m.c    |    2 +-
 drivers/media/platform/m2m-deinterlace.c        |    2 +-
 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |    2 +-
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c    |    2 +-
 drivers/media/platform/mx2_emmaprp.c            |    2 +-
 drivers/media/platform/rcar_jpu.c               |    2 +-
 drivers/media/platform/s5p-g2d/g2d.c            |    2 +-
 drivers/media/platform/sti/bdisp/bdisp-v4l2.c   |    2 +-
 drivers/media/platform/sti/delta/delta-v4l2.c   |    2 +-
 drivers/media/platform/ti-vpe/vpe.c             |    2 +-
 drivers/media/platform/vim2m.c                  |    2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 05/12] [media] vcodec: mediatek: constify v4l2_m2m_ops structures
  2017-08-06  8:25 [PATCH 00/12] constify v4l2_m2m_ops structures Julia Lawall
@ 2017-08-06  8:25 ` Julia Lawall
  2017-08-07  2:42   ` Rick Chang
  2017-08-06  8:25 ` [PATCH 12/12] [media] mtk-mdp: " Julia Lawall
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2017-08-06  8:25 UTC (permalink / raw)
  To: Rick Chang
  Cc: Bin Liu, kernel-janitors, linux-kernel, linux-mediatek,
	linux-arm-kernel, Matthias Brugger, Mauro Carvalho Chehab,
	bhumirks, linux-media

The v4l2_m2m_ops structures are only passed as the only
argument to v4l2_m2m_init, which is declared as const.
Thus the v4l2_m2m_ops structures themselves can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct v4l2_m2m_ops i@p = { ... };

@ok1@
identifier r.i;
position p;
@@
v4l2_m2m_init(&i@p)

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct v4l2_m2m_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct v4l2_m2m_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index f17a86b..226f908 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -865,7 +865,7 @@ static void mtk_jpeg_job_abort(void *priv)
 {
 }
 
-static struct v4l2_m2m_ops mtk_jpeg_m2m_ops = {
+static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = {
 	.device_run = mtk_jpeg_device_run,
 	.job_ready  = mtk_jpeg_job_ready,
 	.job_abort  = mtk_jpeg_job_abort,

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 12/12] [media] mtk-mdp: constify v4l2_m2m_ops structures
  2017-08-06  8:25 [PATCH 00/12] constify v4l2_m2m_ops structures Julia Lawall
  2017-08-06  8:25 ` [PATCH 05/12] [media] vcodec: mediatek: " Julia Lawall
@ 2017-08-06  8:25 ` Julia Lawall
  1 sibling, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-08-06  8:25 UTC (permalink / raw)
  To: Minghsiu Tsai
  Cc: bhumirks, kernel-janitors, Houlong Wei, Andrew-CT Chen,
	Mauro Carvalho Chehab, Matthias Brugger, linux-media,
	linux-arm-kernel, linux-mediatek, linux-kernel

The v4l2_m2m_ops structures are only passed as the only
argument to v4l2_m2m_init, which is declared as const.
Thus the v4l2_m2m_ops structures themselves can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct v4l2_m2m_ops i@p = { ... };

@ok1@
identifier r.i;
position p;
@@
v4l2_m2m_init(&i@p)

@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct v4l2_m2m_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct v4l2_m2m_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
index 3038d62..583d477 100644
--- a/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
+++ b/drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c
@@ -1225,7 +1225,7 @@ static int mtk_mdp_m2m_release(struct file *file)
 	.mmap		= v4l2_m2m_fop_mmap,
 };
 
-static struct v4l2_m2m_ops mtk_mdp_m2m_ops = {
+static const struct v4l2_m2m_ops mtk_mdp_m2m_ops = {
 	.device_run	= mtk_mdp_m2m_device_run,
 	.job_abort	= mtk_mdp_m2m_job_abort,
 };


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 05/12] [media] vcodec: mediatek: constify v4l2_m2m_ops structures
  2017-08-06  8:25 ` [PATCH 05/12] [media] vcodec: mediatek: " Julia Lawall
@ 2017-08-07  2:42   ` Rick Chang
  0 siblings, 0 replies; 4+ messages in thread
From: Rick Chang @ 2017-08-07  2:42 UTC (permalink / raw)
  To: Julia Lawall
  Cc: bhumirks, kernel-janitors, Bin Liu, Mauro Carvalho Chehab,
	Matthias Brugger, linux-media, linux-arm-kernel, linux-mediatek,
	linux-kernel

On Sun, 2017-08-06 at 10:25 +0200, Julia Lawall wrote:
> The v4l2_m2m_ops structures are only passed as the only
> argument to v4l2_m2m_init, which is declared as const.
> Thus the v4l2_m2m_ops structures themselves can be const.
> 
> Done with the help of Coccinelle.
> 
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct v4l2_m2m_ops i@p = { ... };
> 
> @ok1@
> identifier r.i;
> position p;
> @@
> v4l2_m2m_init(&i@p)
> 
> @bad@
> position p != {r.p,ok1.p};
> identifier r.i;
> struct v4l2_m2m_ops e;
> @@
> e@i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct v4l2_m2m_ops i = { ... };
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
---
>  drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Rick Chang <rick.chang@mediatek.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-07  2:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-06  8:25 [PATCH 00/12] constify v4l2_m2m_ops structures Julia Lawall
2017-08-06  8:25 ` [PATCH 05/12] [media] vcodec: mediatek: " Julia Lawall
2017-08-07  2:42   ` Rick Chang
2017-08-06  8:25 ` [PATCH 12/12] [media] mtk-mdp: " Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox