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

[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
...@@ -1223,7 +1223,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) ...@@ -1223,7 +1223,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
cx23885_cancel_buffers(&dev->ts1); cx23885_cancel_buffers(&dev->ts1);
} }
static struct vb2_ops cx23885_qops = { static const struct vb2_ops cx23885_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -173,7 +173,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) ...@@ -173,7 +173,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
cx23885_cancel_buffers(port); cx23885_cancel_buffers(port);
} }
static struct vb2_ops dvb_qops = { static const struct vb2_ops dvb_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -517,7 +517,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q) ...@@ -517,7 +517,7 @@ static void cx23885_stop_streaming(struct vb2_queue *q)
spin_unlock_irqrestore(&dev->slock, flags); 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, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -307,7 +307,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q) ...@@ -307,7 +307,7 @@ static void cx25821_stop_streaming(struct vb2_queue *q)
spin_unlock_irqrestore(&dev->slock, flags); 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, .queue_setup = cx25821_queue_setup,
.buf_prepare = cx25821_buffer_prepare, .buf_prepare = cx25821_buffer_prepare,
.buf_finish = cx25821_buffer_finish, .buf_finish = cx25821_buffer_finish,
......
...@@ -756,7 +756,7 @@ static void stop_streaming(struct vb2_queue *q) ...@@ -756,7 +756,7 @@ static void stop_streaming(struct vb2_queue *q)
spin_unlock_irqrestore(&dev->slock, flags); spin_unlock_irqrestore(&dev->slock, flags);
} }
static struct vb2_ops blackbird_qops = { static const struct vb2_ops blackbird_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -156,7 +156,7 @@ static void stop_streaming(struct vb2_queue *q) ...@@ -156,7 +156,7 @@ static void stop_streaming(struct vb2_queue *q)
spin_unlock_irqrestore(&dev->slock, flags); spin_unlock_irqrestore(&dev->slock, flags);
} }
static struct vb2_ops dvb_qops = { static const struct vb2_ops dvb_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -567,7 +567,7 @@ static void stop_streaming(struct vb2_queue *q) ...@@ -567,7 +567,7 @@ static void stop_streaming(struct vb2_queue *q)
spin_unlock_irqrestore(&dev->slock, flags); spin_unlock_irqrestore(&dev->slock, flags);
} }
static struct vb2_ops cx8800_video_qops = { static const struct vb2_ops cx8800_video_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
.buf_finish = buffer_finish, .buf_finish = buffer_finish,
......
...@@ -353,7 +353,7 @@ static void netup_unidvb_stop_streaming(struct vb2_queue *q) ...@@ -353,7 +353,7 @@ static void netup_unidvb_stop_streaming(struct vb2_queue *q)
netup_unidvb_queue_cleanup(dma); netup_unidvb_queue_cleanup(dma);
} }
static struct vb2_ops dvb_qops = { static const struct vb2_ops dvb_qops = {
.queue_setup = netup_unidvb_queue_setup, .queue_setup = netup_unidvb_queue_setup,
.buf_prepare = netup_unidvb_buf_prepare, .buf_prepare = netup_unidvb_buf_prepare,
.buf_queue = netup_unidvb_buf_queue, .buf_queue = netup_unidvb_buf_queue,
......
...@@ -85,7 +85,7 @@ static void stop_streaming(struct vb2_queue *vq) ...@@ -85,7 +85,7 @@ static void stop_streaming(struct vb2_queue *vq)
dev->empress_started = 0; dev->empress_started = 0;
} }
static struct vb2_ops saa7134_empress_qops = { static const struct vb2_ops saa7134_empress_qops = {
.queue_setup = saa7134_ts_queue_setup, .queue_setup = saa7134_ts_queue_setup,
.buf_init = saa7134_ts_buffer_init, .buf_init = saa7134_ts_buffer_init,
.buf_prepare = saa7134_ts_buffer_prepare, .buf_prepare = saa7134_ts_buffer_prepare,
......
...@@ -1054,7 +1054,7 @@ void saa7134_vb2_stop_streaming(struct vb2_queue *vq) ...@@ -1054,7 +1054,7 @@ void saa7134_vb2_stop_streaming(struct vb2_queue *vq)
pm_qos_remove_request(&dev->qos_request); pm_qos_remove_request(&dev->qos_request);
} }
static struct vb2_ops vb2_qops = { static const struct vb2_ops vb2_qops = {
.queue_setup = queue_setup, .queue_setup = queue_setup,
.buf_init = buffer_init, .buf_init = buffer_init,
.buf_prepare = buffer_prepare, .buf_prepare = buffer_prepare,
......
...@@ -759,7 +759,7 @@ static void solo_enc_buf_finish(struct vb2_buffer *vb) ...@@ -759,7 +759,7 @@ static void solo_enc_buf_finish(struct vb2_buffer *vb)
} }
} }
static struct vb2_ops solo_enc_video_qops = { static const struct vb2_ops solo_enc_video_qops = {
.queue_setup = solo_enc_queue_setup, .queue_setup = solo_enc_queue_setup,
.buf_queue = solo_enc_buf_queue, .buf_queue = solo_enc_buf_queue,
.buf_finish = solo_enc_buf_finish, .buf_finish = solo_enc_buf_finish,
......
...@@ -535,7 +535,7 @@ static void tw68_stop_streaming(struct vb2_queue *q) ...@@ -535,7 +535,7 @@ static void tw68_stop_streaming(struct vb2_queue *q)
} }
} }
static struct vb2_ops tw68_video_qops = { static const struct vb2_ops tw68_video_qops = {
.queue_setup = tw68_queue_setup, .queue_setup = tw68_queue_setup,
.buf_queue = tw68_buf_queue, .buf_queue = tw68_buf_queue,
.buf_prepare = tw68_buf_prepare, .buf_prepare = tw68_buf_prepare,
......
...@@ -577,7 +577,7 @@ static int tw686x_buf_prepare(struct vb2_buffer *vb) ...@@ -577,7 +577,7 @@ static int tw686x_buf_prepare(struct vb2_buffer *vb)
return 0; return 0;
} }
static struct vb2_ops tw686x_video_qops = { static const struct vb2_ops tw686x_video_qops = {
.queue_setup = tw686x_queue_setup, .queue_setup = tw686x_queue_setup,
.buf_queue = tw686x_buf_queue, .buf_queue = tw686x_buf_queue,
.buf_prepare = tw686x_buf_prepare, .buf_prepare = tw686x_buf_prepare,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment