[media] usb: constify vb2_ops structures

Check for vb2_ops structures that are only stored in the ops field of a
vb2_queue structure.  That field is declared const, so vb2_ops structures
that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

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

@ok@
identifier r.i;
struct vb2_queue e;
position p;
@@
e.ops = &i@p;

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

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

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Julia Lawall
2016-09-08 20:59:01 -03:00
committed by Mauro Carvalho Chehab
parent 6dca6cf072
commit 1bc177174b
11 changed files with 11 additions and 11 deletions

View File

@@ -707,7 +707,7 @@ static void stop_streaming(struct vb2_queue *vq)
mutex_unlock(&pdev->v4l2_lock);
}
static struct vb2_ops pwc_vb_queue_ops = {
static const struct vb2_ops pwc_vb_queue_ops = {
.queue_setup = queue_setup,
.buf_init = buffer_init,
.buf_prepare = buffer_prepare,