rcar_fdp1: constify vb2_ops structure
Subsystems (2)
PATCH 1/1 rcar_fdp1: constify vb2_ops structure
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.
This issue was detected using Coccinelle and the following semantic patch:
@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 = { ... };
--- drivers/media/platform/rcar_fdp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rcar_fdp1.c +1 -1
@@ -2032,7 +2032,7 @@ static void fdp1_stop_streaming(struct vb2_queue *q) } } -static struct vb2_ops fdp1_qops = { +static const struct vb2_ops fdp1_qops = { .queue_setup = fdp1_queue_setup, .buf_prepare = fdp1_buf_prepare, .buf_queue = fdp1_buf_queue,
Signature · 1 line
2.5.0
Hi Gustavo,
Thank you for the patch.
Quoted 26 lines · Gustavo A. R. Silva
Check for
vb2_opsstructures that are only stored in the ops field of avb2_queuestructure. That field is declared const, sovb2_opsstructures that have this property can be declared as const also.This issue was detected using Coccinelle and the following semantic patch:
@r disable optional_qualifier@
identifier i;
position p;
@@
static structvb2_opsi@p = { ... };@ok@
identifier r.i;
structvb2_queuee;
position p;
@@
e.ops = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
structvb2_opse;
@@
e@i@p
Quoted 8 lines
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
structvb2_opsi = { ... };Signed-off-by Gustavo A. R. Silva <[email protected]>
Quoted 18 lines
--- drivers/media/platform/rcar_fdp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/rcar_fdp1.c +1
-1@@ -2032,7 +2032,7 @@ static void fdp1_stop_streaming(struct vb2_queue *q) } } -static struct vb2_ops fdp1_qops = { +static const struct vb2_ops fdp1_qops = { .queue_setup = fdp1_queue_setup, .buf_prepare = fdp1_buf_prepare, .buf_queue = fdp1_buf_queue,
Hi Kieran,
Quoting Kieran Bingham <[email protected]>:
Quoted 4 lines
Hi Gustavo,
Thank you for the patch.
Absolutely, glad to help. :)
Quoted 50 lines · Gustavo A. R. Silva
Quoted 26 lines
Check for
vb2_opsstructures that are only stored in the ops field of avb2_queuestructure. That field is declared const, sovb2_opsstructures that have this property can be declared as const also.This issue was detected using Coccinelle and the following semantic patch:
@r disable optional_qualifier@
identifier i;
position p;
@@
static structvb2_opsi@p = { ... };@ok@
identifier r.i;
structvb2_queuee;
position p;
@@
e.ops = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
structvb2_opse;
@@
e@i@pQuoted 8 lines
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
structvb2_opsi = { ... };Signed-off-by Gustavo A. R. Silva <[email protected]>Reviewed-by Kieran Bingham <[email protected]>Quoted 12 lines
--- drivers/media/platform/rcar_fdp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/rcar_fdp1.c +0
-0@@ -2032,7 +2032,7 @@ static void fdp1_stop_streaming(struct vb2_queue *q) } }
Quoted 6 lines
drivers/media/platform/rcar_fdp1.c static void fdp1_stop_streaming(struct vb2_queue *q) · line 2038
Quoted 6 lines
drivers/media/platform/rcar_fdp1.c +1
-1-static struct vb2_ops fdp1_qops = { +static const struct vb2_ops fdp1_qops = { .queue_setup = fdp1_queue_setup, .buf_prepare = fdp1_buf_prepare, .buf_queue = fdp1_buf_queue,
--
Gustavo A. R. Silva