diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2016-09-08 19:59:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-09-19 15:20:35 -0400 |
commit | 1bc177174b97e4df8d27b6c3cdd79ffea9e2d18e (patch) | |
tree | ce1d9023e93c93e02ff418bc0c32d51540e52cbf | |
parent | 6dca6cf072038ecd591789cfd94accc6fc053300 (diff) |
[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: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/usb/airspy/airspy.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/au0828/au0828-video.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-video.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/go7007/go7007-v4l2.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/hackrf/hackrf.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/msi2500/msi2500.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/pwc/pwc-if.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/s2255/s2255drv.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/stk1160/stk1160-v4l.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/usbtv/usbtv-video.c | 2 | ||||
-rw-r--r-- | drivers/media/usb/uvc/uvc_queue.c | 2 |
11 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 3c556ee306cd..8251942bcd12 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c | |||
@@ -605,7 +605,7 @@ static void airspy_stop_streaming(struct vb2_queue *vq) | |||
605 | mutex_unlock(&s->v4l2_lock); | 605 | mutex_unlock(&s->v4l2_lock); |
606 | } | 606 | } |
607 | 607 | ||
608 | static struct vb2_ops airspy_vb2_ops = { | 608 | static const struct vb2_ops airspy_vb2_ops = { |
609 | .queue_setup = airspy_queue_setup, | 609 | .queue_setup = airspy_queue_setup, |
610 | .buf_queue = airspy_buf_queue, | 610 | .buf_queue = airspy_buf_queue, |
611 | .start_streaming = airspy_start_streaming, | 611 | .start_streaming = airspy_start_streaming, |
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index 13b8387082f2..85dd9a8e83ff 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c | |||
@@ -928,7 +928,7 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) | |||
928 | del_timer_sync(&dev->vbi_timeout); | 928 | del_timer_sync(&dev->vbi_timeout); |
929 | } | 929 | } |
930 | 930 | ||
931 | static struct vb2_ops au0828_video_qops = { | 931 | static const struct vb2_ops au0828_video_qops = { |
932 | .queue_setup = queue_setup, | 932 | .queue_setup = queue_setup, |
933 | .buf_prepare = buffer_prepare, | 933 | .buf_prepare = buffer_prepare, |
934 | .buf_queue = buffer_queue, | 934 | .buf_queue = buffer_queue, |
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 7968695217f3..1f7fa059eb34 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -1204,7 +1204,7 @@ buffer_queue(struct vb2_buffer *vb) | |||
1204 | spin_unlock_irqrestore(&dev->slock, flags); | 1204 | spin_unlock_irqrestore(&dev->slock, flags); |
1205 | } | 1205 | } |
1206 | 1206 | ||
1207 | static struct vb2_ops em28xx_video_qops = { | 1207 | static const struct vb2_ops em28xx_video_qops = { |
1208 | .queue_setup = queue_setup, | 1208 | .queue_setup = queue_setup, |
1209 | .buf_prepare = buffer_prepare, | 1209 | .buf_prepare = buffer_prepare, |
1210 | .buf_queue = buffer_queue, | 1210 | .buf_queue = buffer_queue, |
diff --git a/drivers/media/usb/go7007/go7007-v4l2.c b/drivers/media/usb/go7007/go7007-v4l2.c index af8458996d91..4eaba0c24629 100644 --- a/drivers/media/usb/go7007/go7007-v4l2.c +++ b/drivers/media/usb/go7007/go7007-v4l2.c | |||
@@ -477,7 +477,7 @@ static void go7007_stop_streaming(struct vb2_queue *q) | |||
477 | go7007_write_addr(go, 0x3c82, 0x000d); | 477 | go7007_write_addr(go, 0x3c82, 0x000d); |
478 | } | 478 | } |
479 | 479 | ||
480 | static struct vb2_ops go7007_video_qops = { | 480 | static const struct vb2_ops go7007_video_qops = { |
481 | .queue_setup = go7007_queue_setup, | 481 | .queue_setup = go7007_queue_setup, |
482 | .buf_queue = go7007_buf_queue, | 482 | .buf_queue = go7007_buf_queue, |
483 | .buf_prepare = go7007_buf_prepare, | 483 | .buf_prepare = go7007_buf_prepare, |
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 662d5090a12e..d9a525260511 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
@@ -891,7 +891,7 @@ static void hackrf_stop_streaming(struct vb2_queue *vq) | |||
891 | mutex_unlock(&dev->v4l2_lock); | 891 | mutex_unlock(&dev->v4l2_lock); |
892 | } | 892 | } |
893 | 893 | ||
894 | static struct vb2_ops hackrf_vb2_ops = { | 894 | static const struct vb2_ops hackrf_vb2_ops = { |
895 | .queue_setup = hackrf_queue_setup, | 895 | .queue_setup = hackrf_queue_setup, |
896 | .buf_queue = hackrf_buf_queue, | 896 | .buf_queue = hackrf_buf_queue, |
897 | .start_streaming = hackrf_start_streaming, | 897 | .start_streaming = hackrf_start_streaming, |
diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c index 367eb7e2a31d..bb3d31e2a0b5 100644 --- a/drivers/media/usb/msi2500/msi2500.c +++ b/drivers/media/usb/msi2500/msi2500.c | |||
@@ -897,7 +897,7 @@ static void msi2500_stop_streaming(struct vb2_queue *vq) | |||
897 | mutex_unlock(&dev->v4l2_lock); | 897 | mutex_unlock(&dev->v4l2_lock); |
898 | } | 898 | } |
899 | 899 | ||
900 | static struct vb2_ops msi2500_vb2_ops = { | 900 | static const struct vb2_ops msi2500_vb2_ops = { |
901 | .queue_setup = msi2500_queue_setup, | 901 | .queue_setup = msi2500_queue_setup, |
902 | .buf_queue = msi2500_buf_queue, | 902 | .buf_queue = msi2500_buf_queue, |
903 | .start_streaming = msi2500_start_streaming, | 903 | .start_streaming = msi2500_start_streaming, |
diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index c4454c928776..ff657644b6b3 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c | |||
@@ -707,7 +707,7 @@ static void stop_streaming(struct vb2_queue *vq) | |||
707 | mutex_unlock(&pdev->v4l2_lock); | 707 | mutex_unlock(&pdev->v4l2_lock); |
708 | } | 708 | } |
709 | 709 | ||
710 | static struct vb2_ops pwc_vb_queue_ops = { | 710 | static const struct vb2_ops pwc_vb_queue_ops = { |
711 | .queue_setup = queue_setup, | 711 | .queue_setup = queue_setup, |
712 | .buf_init = buffer_init, | 712 | .buf_init = buffer_init, |
713 | .buf_prepare = buffer_prepare, | 713 | .buf_prepare = buffer_prepare, |
diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 9458eb0ef66f..c3a0e87066eb 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c | |||
@@ -717,7 +717,7 @@ static void buffer_queue(struct vb2_buffer *vb) | |||
717 | static int start_streaming(struct vb2_queue *vq, unsigned int count); | 717 | static int start_streaming(struct vb2_queue *vq, unsigned int count); |
718 | static void stop_streaming(struct vb2_queue *vq); | 718 | static void stop_streaming(struct vb2_queue *vq); |
719 | 719 | ||
720 | static struct vb2_ops s2255_video_qops = { | 720 | static const struct vb2_ops s2255_video_qops = { |
721 | .queue_setup = queue_setup, | 721 | .queue_setup = queue_setup, |
722 | .buf_prepare = buffer_prepare, | 722 | .buf_prepare = buffer_prepare, |
723 | .buf_queue = buffer_queue, | 723 | .buf_queue = buffer_queue, |
diff --git a/drivers/media/usb/stk1160/stk1160-v4l.c b/drivers/media/usb/stk1160/stk1160-v4l.c index 5fab3bee8c74..a005d262392a 100644 --- a/drivers/media/usb/stk1160/stk1160-v4l.c +++ b/drivers/media/usb/stk1160/stk1160-v4l.c | |||
@@ -742,7 +742,7 @@ static void stop_streaming(struct vb2_queue *vq) | |||
742 | stk1160_stop_streaming(dev); | 742 | stk1160_stop_streaming(dev); |
743 | } | 743 | } |
744 | 744 | ||
745 | static struct vb2_ops stk1160_video_qops = { | 745 | static const struct vb2_ops stk1160_video_qops = { |
746 | .queue_setup = queue_setup, | 746 | .queue_setup = queue_setup, |
747 | .buf_queue = buffer_queue, | 747 | .buf_queue = buffer_queue, |
748 | .start_streaming = start_streaming, | 748 | .start_streaming = start_streaming, |
diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 2a089756c988..6cbe4a245c9f 100644 --- a/drivers/media/usb/usbtv/usbtv-video.c +++ b/drivers/media/usb/usbtv/usbtv-video.c | |||
@@ -689,7 +689,7 @@ static void usbtv_stop_streaming(struct vb2_queue *vq) | |||
689 | usbtv_stop(usbtv); | 689 | usbtv_stop(usbtv); |
690 | } | 690 | } |
691 | 691 | ||
692 | static struct vb2_ops usbtv_vb2_ops = { | 692 | static const struct vb2_ops usbtv_vb2_ops = { |
693 | .queue_setup = usbtv_queue_setup, | 693 | .queue_setup = usbtv_queue_setup, |
694 | .buf_queue = usbtv_buf_queue, | 694 | .buf_queue = usbtv_buf_queue, |
695 | .start_streaming = usbtv_start_streaming, | 695 | .start_streaming = usbtv_start_streaming, |
diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 773fefb52d7a..77edd206d345 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c | |||
@@ -177,7 +177,7 @@ static void uvc_stop_streaming(struct vb2_queue *vq) | |||
177 | spin_unlock_irqrestore(&queue->irqlock, flags); | 177 | spin_unlock_irqrestore(&queue->irqlock, flags); |
178 | } | 178 | } |
179 | 179 | ||
180 | static struct vb2_ops uvc_queue_qops = { | 180 | static const struct vb2_ops uvc_queue_qops = { |
181 | .queue_setup = uvc_queue_setup, | 181 | .queue_setup = uvc_queue_setup, |
182 | .buf_prepare = uvc_buffer_prepare, | 182 | .buf_prepare = uvc_buffer_prepare, |
183 | .buf_queue = uvc_buffer_queue, | 183 | .buf_queue = uvc_buffer_queue, |