[media] platform: constify vb2_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Thu, 8 Sep 2016 23:59:10 +0000 (20:59 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 19 Sep 2016 19:21:06 +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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Fabien Dessenne <fabien.dessenne@st.com>
Reviewed-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Reviewed-by: Benoit Parrot <bparrot@ti.com>
[hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed]
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
18 files changed:
drivers/media/platform/exynos-gsc/gsc-m2m.c
drivers/media/platform/exynos4-is/fimc-capture.c
drivers/media/platform/exynos4-is/fimc-m2m.c
drivers/media/platform/m2m-deinterlace.c
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
drivers/media/platform/mx2_emmaprp.c
drivers/media/platform/rcar-vin/rcar-dma.c
drivers/media/platform/rcar_jpu.c
drivers/media/platform/s5p-g2d/g2d.c
drivers/media/platform/s5p-jpeg/jpeg-core.c
drivers/media/platform/sh_vou.c
drivers/media/platform/soc_camera/atmel-isi.c
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
drivers/media/platform/sti/bdisp/bdisp-v4l2.c
drivers/media/platform/ti-vpe/cal.c
drivers/media/platform/ti-vpe/vpe.c
drivers/media/platform/vim2m.c
drivers/media/platform/xilinx/xilinx-dma.c

index c019db81b8c26cb5c52f4856b8a9a8264282ded4..9f03b791b711cdaef78beb4bacf268a009a607bb 100644 (file)
@@ -261,7 +261,7 @@ static void gsc_m2m_buf_queue(struct vb2_buffer *vb)
                v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
-static struct vb2_ops gsc_m2m_qops = {
+static const struct vb2_ops gsc_m2m_qops = {
        .queue_setup     = gsc_m2m_queue_setup,
        .buf_prepare     = gsc_m2m_buf_prepare,
        .buf_queue       = gsc_m2m_buf_queue,
index fdec499fbbda496284b6500bf9035cec6bb8b807..344028ea7d5528b45231011fb08afe9951956b35 100644 (file)
@@ -452,7 +452,7 @@ static void buffer_queue(struct vb2_buffer *vb)
        spin_unlock_irqrestore(&fimc->slock, flags);
 }
 
-static struct vb2_ops fimc_capture_qops = {
+static const struct vb2_ops fimc_capture_qops = {
        .queue_setup            = queue_setup,
        .buf_prepare            = buffer_prepare,
        .buf_queue              = buffer_queue,
index b1309e114edbe223929be87cdc0b66a5e5d7f2ad..6028e4fbaed35f3a7cf49e151ad9145fcaba9def 100644 (file)
@@ -219,7 +219,7 @@ static void fimc_buf_queue(struct vb2_buffer *vb)
        v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 }
 
-static struct vb2_ops fimc_qops = {
+static const struct vb2_ops fimc_qops = {
        .queue_setup     = fimc_queue_setup,
        .buf_prepare     = fimc_buf_prepare,
        .buf_queue       = fimc_buf_queue,
index 5a5dec348f4d11aa036e642edcd58ba2d38bcdf3..bedc7cc4c7d61e1fc649de755a473c3ebb866684 100644 (file)
@@ -852,7 +852,7 @@ static void deinterlace_buf_queue(struct vb2_buffer *vb)
        v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
-static struct vb2_ops deinterlace_qops = {
+static const struct vb2_ops deinterlace_qops = {
        .queue_setup     = deinterlace_queue_setup,
        .buf_prepare     = deinterlace_buf_prepare,
        .buf_queue       = deinterlace_buf_queue,
index 7ad7bebf330c3997bd8d1fa26b7113e882178a34..2ed53e44ec89b8b06353f502cacb911f96be7a18 100644 (file)
@@ -933,7 +933,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q)
        ctx->state = MTK_STATE_FREE;
 }
 
-static struct vb2_ops mtk_venc_vb2_ops = {
+static const struct vb2_ops mtk_venc_vb2_ops = {
        .queue_setup            = vb2ops_venc_queue_setup,
        .buf_prepare            = vb2ops_venc_buf_prepare,
        .buf_queue              = vb2ops_venc_buf_queue,
index c639406fe72ef4659ccb36e8bac72b6b0a1456b7..e68d271b10afa1ec47b28a62073f3e97a78e235c 100644 (file)
@@ -743,7 +743,7 @@ static void emmaprp_buf_queue(struct vb2_buffer *vb)
        v4l2_m2m_buf_queue(ctx->m2m_ctx, vbuf);
 }
 
-static struct vb2_ops emmaprp_qops = {
+static const struct vb2_ops emmaprp_qops = {
        .queue_setup     = emmaprp_queue_setup,
        .buf_prepare     = emmaprp_buf_prepare,
        .buf_queue       = emmaprp_buf_queue,
index 46abdb0ea66311602dff44ee6e20049f318df864..9d9f02b1a4d91953fbdb0dfdd0bf3939aa0fb3d2 100644 (file)
@@ -1114,7 +1114,7 @@ static void rvin_stop_streaming(struct vb2_queue *vq)
        rvin_disable_interrupts(vin);
 }
 
-static struct vb2_ops rvin_qops = {
+static const struct vb2_ops rvin_qops = {
        .queue_setup            = rvin_queue_setup,
        .buf_prepare            = rvin_buffer_prepare,
        .buf_queue              = rvin_buffer_queue,
index 16782ceb29c3d6eb0d35ce10e43e35959db49811..d1746ecc645de87d50cde9745fb2f9e154900550 100644 (file)
@@ -1183,7 +1183,7 @@ static void jpu_stop_streaming(struct vb2_queue *vq)
        }
 }
 
-static struct vb2_ops jpu_qops = {
+static const struct vb2_ops jpu_qops = {
        .queue_setup            = jpu_queue_setup,
        .buf_prepare            = jpu_buf_prepare,
        .buf_queue              = jpu_buf_queue,
index 391dd7a7b362c8cb498884468ab84f136cc67516..62c0dec30b59fe3ea8ec49d466fb0aa1eb29cca6 100644 (file)
@@ -138,7 +138,7 @@ static void g2d_buf_queue(struct vb2_buffer *vb)
        v4l2_m2m_buf_queue(ctx->fh.m2m_ctx, vbuf);
 }
 
-static struct vb2_ops g2d_qops = {
+static const struct vb2_ops g2d_qops = {
        .queue_setup    = g2d_queue_setup,
        .buf_prepare    = g2d_buf_prepare,
        .buf_queue      = g2d_buf_queue,
index dde9d3598c48a26a6a38e4ad0180cbc39d7a43a6..d5e7762b7059d54203730a4d0ca57996fe8b3b78 100644 (file)
@@ -2545,7 +2545,7 @@ static void s5p_jpeg_stop_streaming(struct vb2_queue *q)
        pm_runtime_put(ctx->jpeg->dev);
 }
 
-static struct vb2_ops s5p_jpeg_qops = {
+static const struct vb2_ops s5p_jpeg_qops = {
        .queue_setup            = s5p_jpeg_queue_setup,
        .buf_prepare            = s5p_jpeg_buf_prepare,
        .buf_queue              = s5p_jpeg_buf_queue,
index 4ee7b1570f62defa839b1ce5afdbd349506ca64c..ef2a519bcd4cd4cf3fb138c868415d78be762ce1 100644 (file)
@@ -362,7 +362,7 @@ static void sh_vou_stop_streaming(struct vb2_queue *vq)
        spin_unlock_irqrestore(&vou_dev->lock, flags);
 }
 
-static struct vb2_ops sh_vou_qops = {
+static const struct vb2_ops sh_vou_qops = {
        .queue_setup            = sh_vou_queue_setup,
        .buf_prepare            = sh_vou_buf_prepare,
        .buf_queue              = sh_vou_buf_queue,
index 30211f6b4483138819ec6182f90ad7c7f17170ff..46de657c3e6d00b0f241276beef4cf146996c136 100644 (file)
@@ -536,7 +536,7 @@ static void stop_streaming(struct vb2_queue *vq)
        pm_runtime_put(ici->v4l2_dev.dev);
 }
 
-static struct vb2_ops isi_video_qops = {
+static const struct vb2_ops isi_video_qops = {
        .queue_setup            = queue_setup,
        .buf_init               = buffer_init,
        .buf_prepare            = buffer_prepare,
index e5571c8a368ea812e51df51255237081fbea242c..a15bfb5aea47dd7afc54ef85d7bb147d43e92b62 100644 (file)
@@ -464,7 +464,7 @@ static void sh_mobile_ceu_stop_streaming(struct vb2_queue *q)
        sh_mobile_ceu_soft_reset(pcdev);
 }
 
-static struct vb2_ops sh_mobile_ceu_videobuf_ops = {
+static const struct vb2_ops sh_mobile_ceu_videobuf_ops = {
        .queue_setup    = sh_mobile_ceu_videobuf_setup,
        .buf_prepare    = sh_mobile_ceu_videobuf_prepare,
        .buf_queue      = sh_mobile_ceu_videobuf_queue,
index 3b1ac687d0dfbbec1a230d7a7bc4a8f28c1cab65..45f82b5ddd770757d79b0a2c93f9c31bdc453528 100644 (file)
@@ -527,7 +527,7 @@ static void bdisp_stop_streaming(struct vb2_queue *q)
        pm_runtime_put(ctx->bdisp_dev->dev);
 }
 
-static struct vb2_ops bdisp_qops = {
+static const struct vb2_ops bdisp_qops = {
        .queue_setup     = bdisp_queue_setup,
        .buf_prepare     = bdisp_buf_prepare,
        .buf_queue       = bdisp_buf_queue,
index e967fcfdc1d83658828b10a0679fda5d3a6f06bf..44323cb5d287578e8353f7ae89c21ae2ff7eb829 100644 (file)
@@ -1379,7 +1379,7 @@ static void cal_stop_streaming(struct vb2_queue *vq)
        cal_runtime_put(ctx->dev);
 }
 
-static struct vb2_ops cal_video_qops = {
+static const struct vb2_ops cal_video_qops = {
        .queue_setup            = cal_queue_setup,
        .buf_prepare            = cal_buffer_prepare,
        .buf_queue              = cal_buffer_queue,
index 55a1458ac7830ffc47558be3317462b5e213f6d2..0189f7f7cb03fbeba9d3222f77d090d0cd6e1bb3 100644 (file)
@@ -1878,7 +1878,7 @@ static void vpe_stop_streaming(struct vb2_queue *q)
        vpdma_dump_regs(ctx->dev->vpdma);
 }
 
-static struct vb2_ops vpe_qops = {
+static const struct vb2_ops vpe_qops = {
        .queue_setup     = vpe_queue_setup,
        .buf_prepare     = vpe_buf_prepare,
        .buf_queue       = vpe_buf_queue,
index cd0ff4a66fdc57c215aca7c2cb1be2a34b50b03e..a98f679bd88d0ba57ec1c8b99afc4174c6e1d88d 100644 (file)
@@ -815,7 +815,7 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
        }
 }
 
-static struct vb2_ops vim2m_qops = {
+static const struct vb2_ops vim2m_qops = {
        .queue_setup     = vim2m_queue_setup,
        .buf_prepare     = vim2m_buf_prepare,
        .buf_queue       = vim2m_buf_queue,
index 7ae1a134b1ffc2c7e1c69f61890c3cac1253b7ce..1d5836c3fb7a8ff0fd0109627836fb3fdae03fb9 100644 (file)
@@ -474,7 +474,7 @@ static void xvip_dma_stop_streaming(struct vb2_queue *vq)
        spin_unlock_irq(&dma->queued_lock);
 }
 
-static struct vb2_ops xvip_dma_queue_qops = {
+static const struct vb2_ops xvip_dma_queue_qops = {
        .queue_setup = xvip_dma_queue_setup,
        .buf_prepare = xvip_dma_buffer_prepare,
        .buf_queue = xvip_dma_buffer_queue,