[media] pci: constify vb2_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 8 Sep 2016 23:59:18 +0000 (20:59 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:21:42 +0000 (16:21 -0300)
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>
Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
13 files changed:
drivers/media/pci/cx23885/cx23885-417.c
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx25821/cx25821-video.c
drivers/media/pci/cx88/cx88-blackbird.c
drivers/media/pci/cx88/cx88-dvb.c
drivers/media/pci/cx88/cx88-video.c
drivers/media/pci/netup_unidvb/netup_unidvb_core.c
drivers/media/pci/saa7134/saa7134-empress.c
drivers/media/pci/saa7134/saa7134-video.c
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c
drivers/media/pci/tw68/tw68-video.c
drivers/media/pci/tw686x/tw686x-video.c

index efec2d1a7afddf877432a8d15316dcec40060fb6..c95db4de932c60c2a0aa85f39799efd6f2f54637 100644 (file)
@@ -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,
index c5daa23061559ea828fd8a6d3938941fe4448227..6855d621b82a13694ffe126e58e9594e8377e2c7 100644 (file)
@@ -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,
index 6d735222a958f56fecfdade7e0aed34e2abf1491..33d168ef278dca32295dd9339192b4adb352d0b4 100644 (file)
@@ -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,
index adcd09be347da94827ead7d51b7384063e80aba3..7ce352a0f2d3af7dedee47239d792b669a986457 100644 (file)
@@ -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,
index 04fe9af2a80217ed89b0bf596755b3f79c366d59..b532e49e8f33421999e56571e019f540b9ff036a 100644 (file)
@@ -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,
index 5bb63e7a5691df9dd7e3b4daf644ad070518e1cb..ac2392d8887a740346cec0be1a569bad37bba17c 100644 (file)
@@ -156,7 +156,7 @@ static void stop_streaming(struct vb2_queue *q)
        spin_unlock_irqrestore(&dev->slock, flags);
 }
 
-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,
index 5dc1e3f08d50ccea7228bae77555b32296335854..d83eb3b10f5406f49a4066d399e0c00b27523511 100644 (file)
@@ -567,7 +567,7 @@ static void stop_streaming(struct vb2_queue *q)
        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,
        .buf_prepare  = buffer_prepare,
        .buf_finish = buffer_finish,
index ac547cb84de8c293582100f04d5cc8370da1a441..b078ac2a682cf61af156627263574dbf2859de18 100644 (file)
@@ -353,7 +353,7 @@ static void netup_unidvb_stop_streaming(struct vb2_queue *q)
        netup_unidvb_queue_cleanup(dma);
 }
 
-static struct vb2_ops dvb_qops = {
+static const struct vb2_ops dvb_qops = {
        .queue_setup            = netup_unidvb_queue_setup,
        .buf_prepare            = netup_unidvb_buf_prepare,
        .buf_queue              = netup_unidvb_buf_queue,
index ca417a454d6787aecc77a0a338137dce78d7acb0..b56b5f7d87259978de8a8035a395c7543834375e 100644 (file)
@@ -85,7 +85,7 @@ static void stop_streaming(struct vb2_queue *vq)
        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,
        .buf_init       = saa7134_ts_buffer_init,
        .buf_prepare    = saa7134_ts_buffer_prepare,
index 20baa22afc4217c9735b9a0a679e9f828fa73581..cbb173d990853840f7a364494613c0028cb97ede 100644 (file)
@@ -1054,7 +1054,7 @@ void saa7134_vb2_stop_streaming(struct vb2_queue *vq)
                pm_qos_remove_request(&dev->qos_request);
 }
 
-static struct vb2_ops vb2_qops = {
+static const struct vb2_ops vb2_qops = {
        .queue_setup    = queue_setup,
        .buf_init       = buffer_init,
        .buf_prepare    = buffer_prepare,
index 399164314c28a5394d19e66a106cf686f6e22ef6..25a2137ab79952a20fb66fd16ac52f6f81f1c538 100644 (file)
@@ -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,
        .buf_queue      = solo_enc_buf_queue,
        .buf_finish     = solo_enc_buf_finish,
index 5e8212845c871b5886f317ce98628dfc1c00735e..a45e02367321564df4d0d400ddf5ab44188bef50 100644 (file)
@@ -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,
        .buf_queue      = tw68_buf_queue,
        .buf_prepare    = tw68_buf_prepare,
index 9621588be12c77fb6e06ffbed5b65cadf46f9881..c3fafa97b2d0c1dd30037ff77d72f0baeb1dc221 100644 (file)
@@ -577,7 +577,7 @@ static int tw686x_buf_prepare(struct vb2_buffer *vb)
        return 0;
 }
 
-static struct vb2_ops tw686x_video_qops = {
+static const struct vb2_ops tw686x_video_qops = {
        .queue_setup            = tw686x_queue_setup,
        .buf_queue              = tw686x_buf_queue,
        .buf_prepare            = tw686x_buf_prepare,