Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10accd2e authored by Julia Lawall's avatar Julia Lawall Committed by Mauro Carvalho Chehab
Browse files

[media] pci: 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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Acked-by: default avatarAndrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent b7b361f0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1223,7 +1223,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
	cx23885_cancel_buffers(&dev->ts1);
}

static struct vb2_ops cx23885_qops = {
static const struct vb2_ops cx23885_qops = {
	.queue_setup    = queue_setup,
	.buf_prepare  = buffer_prepare,
	.buf_finish = buffer_finish,
+1 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
	cx23885_cancel_buffers(port);
}

static struct vb2_ops dvb_qops = {
static const struct vb2_ops dvb_qops = {
	.queue_setup    = queue_setup,
	.buf_prepare  = buffer_prepare,
	.buf_finish = buffer_finish,
+1 −1
Original line number Diff line number Diff line
@@ -517,7 +517,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
	spin_unlock_irqrestore(&dev->slock, flags);
}

static struct vb2_ops cx23885_video_qops = {
static const struct vb2_ops cx23885_video_qops = {
	.queue_setup    = queue_setup,
	.buf_prepare  = buffer_prepare,
	.buf_finish = buffer_finish,
+1 −1
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
	spin_unlock_irqrestore(&dev->slock, flags);
}

static struct vb2_ops cx25821_video_qops = {
static const struct vb2_ops cx25821_video_qops = {
	.queue_setup    = cx25821_queue_setup,
	.buf_prepare  = cx25821_buffer_prepare,
	.buf_finish = cx25821_buffer_finish,
+1 −1
Original line number Diff line number Diff line
@@ -756,7 +756,7 @@ static void stop_streaming(struct vb2_queue *q)
	spin_unlock_irqrestore(&dev->slock, flags);
}

static struct vb2_ops blackbird_qops = {
static const struct vb2_ops blackbird_qops = {
	.queue_setup    = queue_setup,
	.buf_prepare  = buffer_prepare,
	.buf_finish = buffer_finish,
Loading