From: Julia Lawall Date: Sun, 6 Aug 2017 08:25:10 +0000 (-0400) Subject: media: st-delta: constify v4l2_m2m_ops structures X-Git-Tag: android-x86-8.1-r1~2074^2~693 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8751ac288ee46c9e17d05245f4b8fe10a72bbe61;p=android-x86%2Fkernel.git media: st-delta: constify v4l2_m2m_ops structures 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. // @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 = { ... }; // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/sti/delta/delta-v4l2.c b/drivers/media/platform/sti/delta/delta-v4l2.c index ff9850ea3ed7..b2dc3d223a9c 100644 --- a/drivers/media/platform/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/sti/delta/delta-v4l2.c @@ -1095,7 +1095,7 @@ static int delta_job_ready(void *priv) } /* mem-to-mem ops */ -static struct v4l2_m2m_ops delta_m2m_ops = { +static const struct v4l2_m2m_ops delta_m2m_ops = { .device_run = delta_device_run, .job_ready = delta_job_ready, .job_abort = delta_job_abort,