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

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

[media] platform: 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>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
Reviewed-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
[hans.verkuil@cisco.com: dropped soc_camera/rcar_vin.c patch because that driver will be removed]
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 1bc17717
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
Loading