Skip to content

Commit aa7d01f

Browse files
JuliaLawallmchehab
authored andcommitted
media: v4l2-pci-skeleton: constify vb2_ops structures
These vb2_ops structures are only stored in the ops field of a vb2_queue structure, which is declared as const. Thus the vb2_ops structures themselves can be const. Done with the help of Coccinelle. // <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 <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 4d7be60 commit aa7d01f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

samples/v4l/v4l2-pci-skeleton.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static void stop_streaming(struct vb2_queue *vq)
282282
* vb2_ops_wait_prepare/finish helper functions. If q->lock would be NULL,
283283
* then this driver would have to provide these ops.
284284
*/
285-
static struct vb2_ops skel_qops = {
285+
static const struct vb2_ops skel_qops = {
286286
.queue_setup = queue_setup,
287287
.buf_prepare = buffer_prepare,
288288
.buf_queue = buffer_queue,

0 commit comments

Comments
 (0)