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

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

[media] usb: 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>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 6dca6cf0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -605,7 +605,7 @@ static void airspy_stop_streaming(struct vb2_queue *vq)
	mutex_unlock(&s->v4l2_lock);
}

static struct vb2_ops airspy_vb2_ops = {
static const struct vb2_ops airspy_vb2_ops = {
	.queue_setup            = airspy_queue_setup,
	.buf_queue              = airspy_buf_queue,
	.start_streaming        = airspy_start_streaming,
+1 −1
Original line number Diff line number Diff line
@@ -928,7 +928,7 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq)
	del_timer_sync(&dev->vbi_timeout);
}

static struct vb2_ops au0828_video_qops = {
static const struct vb2_ops au0828_video_qops = {
	.queue_setup     = queue_setup,
	.buf_prepare     = buffer_prepare,
	.buf_queue       = buffer_queue,
+1 −1
Original line number Diff line number Diff line
@@ -1204,7 +1204,7 @@ buffer_queue(struct vb2_buffer *vb)
	spin_unlock_irqrestore(&dev->slock, flags);
}

static struct vb2_ops em28xx_video_qops = {
static const struct vb2_ops em28xx_video_qops = {
	.queue_setup    = queue_setup,
	.buf_prepare    = buffer_prepare,
	.buf_queue      = buffer_queue,
+1 −1
Original line number Diff line number Diff line
@@ -477,7 +477,7 @@ static void go7007_stop_streaming(struct vb2_queue *q)
		go7007_write_addr(go, 0x3c82, 0x000d);
}

static struct vb2_ops go7007_video_qops = {
static const struct vb2_ops go7007_video_qops = {
	.queue_setup    = go7007_queue_setup,
	.buf_queue      = go7007_buf_queue,
	.buf_prepare    = go7007_buf_prepare,
+1 −1
Original line number Diff line number Diff line
@@ -891,7 +891,7 @@ static void hackrf_stop_streaming(struct vb2_queue *vq)
	mutex_unlock(&dev->v4l2_lock);
}

static struct vb2_ops hackrf_vb2_ops = {
static const struct vb2_ops hackrf_vb2_ops = {
	.queue_setup            = hackrf_queue_setup,
	.buf_queue              = hackrf_buf_queue,
	.start_streaming        = hackrf_start_streaming,
Loading