* [PATCH 0/5] constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: devel
Cc: bhumirks, kernel-janitors, linux-kernel, linux-media,
Mauro Carvalho Chehab, linux-usb
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
---
drivers/media/pci/cx18/cx18-streams.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-417.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
drivers/media/usb/tm6000/tm6000-video.c | 2 +-
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 0/5] constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: devel
Cc: bhumirks, kernel-janitors, linux-kernel, linux-media,
Mauro Carvalho Chehab, linux-usb
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
---
drivers/media/pci/cx18/cx18-streams.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-417.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
drivers/media/usb/tm6000/tm6000-video.c | 2 +-
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 4 ++--
6 files changed, 7 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/5] [media] cx18: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-04 12:09 ` Julia Lawall
-1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Andy Walls
Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab, linux-media,
linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/pci/cx18/cx18-streams.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c
index 3c45e007..81d06c1 100644
--- a/drivers/media/pci/cx18/cx18-streams.c
+++ b/drivers/media/pci/cx18/cx18-streams.c
@@ -240,7 +240,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
list_add_tail(&buf->vb.queue, &s->vb_capture);
}
-static struct videobuf_queue_ops cx18_videobuf_qops = {
+static const struct videobuf_queue_ops cx18_videobuf_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 1/5] [media] cx18: constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Andy Walls
Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab, linux-media,
linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/pci/cx18/cx18-streams.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c
index 3c45e007..81d06c1 100644
--- a/drivers/media/pci/cx18/cx18-streams.c
+++ b/drivers/media/pci/cx18/cx18-streams.c
@@ -240,7 +240,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
list_add_tail(&buf->vb.queue, &s->vb_capture);
}
-static struct videobuf_queue_ops cx18_videobuf_qops = {
+static const struct videobuf_queue_ops cx18_videobuf_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/5] [media] atomisp: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-04 12:09 ` Julia Lawall
-1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, Greg Kroah-Hartman, linux-media,
devel, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
index c151c84..d8cfed3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
@@ -643,14 +643,14 @@ static void atomisp_buf_release_output(struct videobuf_queue *vq,
vb->state = VIDEOBUF_NEEDS_INIT;
}
-static struct videobuf_queue_ops videobuf_qops = {
+static const struct videobuf_queue_ops videobuf_qops = {
.buf_setup = atomisp_buf_setup,
.buf_prepare = atomisp_buf_prepare,
.buf_queue = atomisp_buf_queue,
.buf_release = atomisp_buf_release,
};
-static struct videobuf_queue_ops videobuf_qops_output = {
+static const struct videobuf_queue_ops videobuf_qops_output = {
.buf_setup = atomisp_buf_setup_output,
.buf_prepare = atomisp_buf_prepare_output,
.buf_queue = atomisp_buf_queue_output,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/5] [media] atomisp: constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, Greg Kroah-Hartman, linux-media,
devel, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
index c151c84..d8cfed3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
@@ -643,14 +643,14 @@ static void atomisp_buf_release_output(struct videobuf_queue *vq,
vb->state = VIDEOBUF_NEEDS_INIT;
}
-static struct videobuf_queue_ops videobuf_qops = {
+static const struct videobuf_queue_ops videobuf_qops = {
.buf_setup = atomisp_buf_setup,
.buf_prepare = atomisp_buf_prepare,
.buf_queue = atomisp_buf_queue,
.buf_release = atomisp_buf_release,
};
-static struct videobuf_queue_ops videobuf_qops_output = {
+static const struct videobuf_queue_ops videobuf_qops_output = {
.buf_setup = atomisp_buf_setup_output,
.buf_prepare = atomisp_buf_prepare_output,
.buf_queue = atomisp_buf_queue_output,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/5] [media] cx231xx: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-04 12:09 ` Julia Lawall
-1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
In the first case, there is a second commented call to
videobuf_queue_sg_init with the structure as the second argument. If that
code will be uncommented, the const will remain correct, because the second
parameter of that function is also const.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/cx231xx/cx231xx-417.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index 8d5eb99..d538fa4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1490,7 +1490,7 @@ static void bb_buf_release(struct videobuf_queue *q,
free_buffer(q, buf);
}
-static struct videobuf_queue_ops cx231xx_qops = {
+static const struct videobuf_queue_ops cx231xx_qops = {
.buf_setup = bb_buf_setup,
.buf_prepare = bb_buf_prepare,
.buf_queue = bb_buf_queue,
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index f67f868..179b848 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -859,7 +859,7 @@ static void buffer_release(struct videobuf_queue *vq,
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops cx231xx_video_qops = {
+static const struct videobuf_queue_ops cx231xx_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/5] [media] cx231xx: constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
In the first case, there is a second commented call to
videobuf_queue_sg_init with the structure as the second argument. If that
code will be uncommented, the const will remain correct, because the second
parameter of that function is also const.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/cx231xx/cx231xx-417.c | 2 +-
drivers/media/usb/cx231xx/cx231xx-video.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index 8d5eb99..d538fa4 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1490,7 +1490,7 @@ static void bb_buf_release(struct videobuf_queue *q,
free_buffer(q, buf);
}
-static struct videobuf_queue_ops cx231xx_qops = {
+static const struct videobuf_queue_ops cx231xx_qops = {
.buf_setup = bb_buf_setup,
.buf_prepare = bb_buf_prepare,
.buf_queue = bb_buf_queue,
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c
index f67f868..179b848 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -859,7 +859,7 @@ static void buffer_release(struct videobuf_queue *vq,
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops cx231xx_video_qops = {
+static const struct videobuf_queue_ops cx231xx_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] [media] tm6000: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-04 12:09 ` Julia Lawall
-1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/tm6000/tm6000-video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index cec1321..ec8c4d2 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -801,7 +801,7 @@ static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops tm6000_video_qops = {
+static const struct videobuf_queue_ops tm6000_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/5] [media] tm6000: constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: bhumirks, kernel-janitors, linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/tm6000/tm6000-video.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/tm6000/tm6000-video.c b/drivers/media/usb/tm6000/tm6000-video.c
index cec1321..ec8c4d2 100644
--- a/drivers/media/usb/tm6000/tm6000-video.c
+++ b/drivers/media/usb/tm6000/tm6000-video.c
@@ -801,7 +801,7 @@ static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops tm6000_video_qops = {
+static const struct videobuf_queue_ops tm6000_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/5] [media] zr364xx: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-04 12:09 ` Julia Lawall
-1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Antoine Jacquet
Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab, linux-usb,
linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index efdcd5b..24d5860 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -439,7 +439,7 @@ static void buffer_release(struct videobuf_queue *vq,
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops zr364xx_video_qops = {
+static const struct videobuf_queue_ops zr364xx_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 5/5] [media] zr364xx: constify videobuf_queue_ops structures
@ 2017-08-04 12:09 ` Julia Lawall
0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2017-08-04 12:09 UTC (permalink / raw)
To: Antoine Jacquet
Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab, linux-usb,
linux-media, linux-kernel
These videobuf_queue_ops structures are only passed as the second
argument to videobuf_queue_vmalloc_init, which is declared as const.
Thus the videobuf_queue_ops structures themselves can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct videobuf_queue_ops i@p = { ... };
@ok1@
identifier r.i;
expression e1;
position p;
@@
videobuf_queue_vmalloc_init(e1,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct videobuf_queue_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct videobuf_queue_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/media/usb/zr364xx/zr364xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/usb/zr364xx/zr364xx.c b/drivers/media/usb/zr364xx/zr364xx.c
index efdcd5b..24d5860 100644
--- a/drivers/media/usb/zr364xx/zr364xx.c
+++ b/drivers/media/usb/zr364xx/zr364xx.c
@@ -439,7 +439,7 @@ static void buffer_release(struct videobuf_queue *vq,
free_buffer(vq, buf);
}
-static struct videobuf_queue_ops zr364xx_video_qops = {
+static const struct videobuf_queue_ops zr364xx_video_qops = {
.buf_setup = buffer_setup,
.buf_prepare = buffer_prepare,
.buf_queue = buffer_queue,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/5] [media] atomisp: constify videobuf_queue_ops structures
2017-08-04 12:09 ` Julia Lawall
@ 2017-08-08 10:53 ` Sakari Ailus
-1 siblings, 0 replies; 14+ messages in thread
From: Sakari Ailus @ 2017-08-08 10:53 UTC (permalink / raw)
To: Julia Lawall
Cc: Mauro Carvalho Chehab, bhumirks, kernel-janitors,
Greg Kroah-Hartman, linux-media, devel, linux-kernel
On Fri, Aug 04, 2017 at 02:09:45PM +0200, Julia Lawall wrote:
> These videobuf_queue_ops structures are only passed as the second
> argument to videobuf_queue_vmalloc_init, which is declared as const.
> Thus the videobuf_queue_ops structures themselves can be const.
>
> Done with the help of Coccinelle.
Thanks. I'm picking this one up (for atomisp).
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/5] [media] atomisp: constify videobuf_queue_ops structures
@ 2017-08-08 10:53 ` Sakari Ailus
0 siblings, 0 replies; 14+ messages in thread
From: Sakari Ailus @ 2017-08-08 10:53 UTC (permalink / raw)
To: Julia Lawall
Cc: Mauro Carvalho Chehab, bhumirks, kernel-janitors,
Greg Kroah-Hartman, linux-media, devel, linux-kernel
On Fri, Aug 04, 2017 at 02:09:45PM +0200, Julia Lawall wrote:
> These videobuf_queue_ops structures are only passed as the second
> argument to videobuf_queue_vmalloc_init, which is declared as const.
> Thus the videobuf_queue_ops structures themselves can be const.
>
> Done with the help of Coccinelle.
Thanks. I'm picking this one up (for atomisp).
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-08-08 10:53 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-04 12:09 [PATCH 0/5] constify videobuf_queue_ops structures Julia Lawall
2017-08-04 12:09 ` Julia Lawall
2017-08-04 12:09 ` [PATCH 1/5] [media] cx18: " Julia Lawall
2017-08-04 12:09 ` Julia Lawall
2017-08-04 12:09 ` [PATCH 2/5] [media] atomisp: " Julia Lawall
2017-08-04 12:09 ` Julia Lawall
2017-08-08 10:53 ` Sakari Ailus
2017-08-08 10:53 ` Sakari Ailus
2017-08-04 12:09 ` [PATCH 3/5] [media] cx231xx: " Julia Lawall
2017-08-04 12:09 ` Julia Lawall
2017-08-04 12:09 ` [PATCH 4/5] [media] tm6000: " Julia Lawall
2017-08-04 12:09 ` Julia Lawall
2017-08-04 12:09 ` [PATCH 5/5] [media] zr364xx: " Julia Lawall
2017-08-04 12:09 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.