mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] constify vb2_ops structures
@ 2017-08-05 10:47 Julia Lawall
  2017-08-05 10:47 ` [PATCH 1/6] [media] v4l2-pci-skeleton: " Julia Lawall
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: bhumirks, kernel-janitors, linux-rpi-kernel, devel, linux-kernel,
	linux-media, adi-buildroot-devel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

---

 drivers/media/platform/blackfin/bfin_capture.c                |    2 +-
 drivers/media/platform/davinci/vpbe_display.c                 |    2 +-
 drivers/staging/media/davinci_vpfe/vpfe_video.c               |    2 +-
 drivers/staging/media/imx/imx-media-capture.c                 |    4 ++--
 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |    2 +-
 samples/v4l/v4l2-pci-skeleton.c                               |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] [media] v4l2-pci-skeleton: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-05 10:47 ` [PATCH 2/6] [media] media: davinci: vpbe: " Julia Lawall
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: linux-kernel, linux-media; +Cc: bhumirks, kernel-janitors

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
There doesn't seem to be a maintainer for this file.

 samples/v4l/v4l2-pci-skeleton.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/samples/v4l/v4l2-pci-skeleton.c b/samples/v4l/v4l2-pci-skeleton.c
index 93b76c3..483e9bca 100644
--- a/samples/v4l/v4l2-pci-skeleton.c
+++ b/samples/v4l/v4l2-pci-skeleton.c
@@ -282,7 +282,7 @@ static void stop_streaming(struct vb2_queue *vq)
  * vb2_ops_wait_prepare/finish helper functions. If q->lock would be NULL,
  * then this driver would have to provide these ops.
  */
-static struct vb2_ops skel_qops = {
+static const struct vb2_ops skel_qops = {
 	.queue_setup		= queue_setup,
 	.buf_prepare		= buffer_prepare,
 	.buf_queue		= buffer_queue,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/6] [media] media: davinci: vpbe: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
  2017-08-05 10:47 ` [PATCH 1/6] [media] v4l2-pci-skeleton: " Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-05 10:47 ` [PATCH 3/6] [media] staging: media: davinci_vpfe: " Julia Lawall
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab, linux-media,
	linux-kernel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
 drivers/media/platform/davinci/vpbe_display.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c b/drivers/media/platform/davinci/vpbe_display.c
index ca2adfa..13d0270 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -355,7 +355,7 @@ static void vpbe_stop_streaming(struct vb2_queue *vq)
 	spin_unlock_irqrestore(&disp->dma_queue_lock, flags);
 }
 
-static struct vb2_ops video_qops = {
+static const struct vb2_ops video_qops = {
 	.queue_setup = vpbe_buffer_queue_setup,
 	.wait_prepare = vb2_ops_wait_prepare,
 	.wait_finish = vb2_ops_wait_finish,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/6] [media] staging: media: davinci_vpfe: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
  2017-08-05 10:47 ` [PATCH 1/6] [media] v4l2-pci-skeleton: " Julia Lawall
  2017-08-05 10:47 ` [PATCH 2/6] [media] media: davinci: vpbe: " Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-05 10:47 ` [PATCH 4/6] [media] media: blackfin: bfin_capture: " Julia Lawall
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: bhumirks, kernel-janitors, Greg Kroah-Hartman, linux-media,
	devel, linux-kernel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
 drivers/staging/media/davinci_vpfe/vpfe_video.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 8b2117e..155e8c7 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -1304,7 +1304,7 @@ static void vpfe_buf_cleanup(struct vb2_buffer *vb)
 		list_del_init(&buf->list);
 }
 
-static struct vb2_ops video_qops = {
+static const struct vb2_ops video_qops = {
 	.queue_setup		= vpfe_buffer_queue_setup,
 	.buf_init		= vpfe_buffer_init,
 	.buf_prepare		= vpfe_buffer_prepare,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 4/6] [media] media: blackfin: bfin_capture: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
                   ` (2 preceding siblings ...)
  2017-08-05 10:47 ` [PATCH 3/6] [media] staging: media: davinci_vpfe: " Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-05 10:47 ` [PATCH 5/6] staging: bcm2835-camera: " Julia Lawall
  2017-08-05 10:47 ` [PATCH 6/6] [media] media: imx: capture: " Julia Lawall
  5 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: Scott Jiang
  Cc: bhumirks, kernel-janitors, Mauro Carvalho Chehab,
	adi-buildroot-devel, linux-media, linux-kernel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
 drivers/media/platform/blackfin/bfin_capture.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/blackfin/bfin_capture.c b/drivers/media/platform/blackfin/bfin_capture.c
index 294d696..41f1791 100644
--- a/drivers/media/platform/blackfin/bfin_capture.c
+++ b/drivers/media/platform/blackfin/bfin_capture.c
@@ -375,7 +375,7 @@ static void bcap_stop_streaming(struct vb2_queue *vq)
 	}
 }
 
-static struct vb2_ops bcap_video_qops = {
+static const struct vb2_ops bcap_video_qops = {
 	.queue_setup            = bcap_queue_setup,
 	.buf_prepare            = bcap_buffer_prepare,
 	.buf_cleanup            = bcap_buffer_cleanup,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 5/6] staging: bcm2835-camera: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
                   ` (3 preceding siblings ...)
  2017-08-05 10:47 ` [PATCH 4/6] [media] media: blackfin: bfin_capture: " Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-05 10:47 ` [PATCH 6/6] [media] media: imx: capture: " Julia Lawall
  5 siblings, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: Eric Anholt
  Cc: bhumirks, kernel-janitors, Stefan Wahren, Greg Kroah-Hartman,
	Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	devel, linux-kernel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
 drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index a11e047..5af758a 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -642,7 +642,7 @@ static void bm2835_mmal_unlock(struct vb2_queue *vq)
 	mutex_unlock(&dev->mutex);
 }
 
-static struct vb2_ops bm2835_mmal_video_qops = {
+static const struct vb2_ops bm2835_mmal_video_qops = {
 	.queue_setup = queue_setup,
 	.buf_prepare = buffer_prepare,
 	.buf_queue = buffer_queue,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 6/6] [media] media: imx: capture: constify vb2_ops structures
  2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
                   ` (4 preceding siblings ...)
  2017-08-05 10:47 ` [PATCH 5/6] staging: bcm2835-camera: " Julia Lawall
@ 2017-08-05 10:47 ` Julia Lawall
  2017-08-14 23:14   ` Steve Longerbeam
  5 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2017-08-05 10:47 UTC (permalink / raw)
  To: Steve Longerbeam
  Cc: bhumirks, kernel-janitors, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, linux-media, devel, linux-kernel

These vb2_ops structures are only stored in the ops field of a
vb2_queue structure, which is declared as const.  Thus the vb2_ops
structures themselves can be const.

Done with the help of Coccinelle.

// <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>

---
 drivers/staging/media/imx/imx-media-capture.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index ddab4c2..ea145ba 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -62,7 +62,7 @@ struct capture_priv {
 /* In bytes, per queue */
 #define VID_MEM_LIMIT	SZ_64M
 
-static struct vb2_ops capture_qops;
+static const struct vb2_ops capture_qops;
 
 /*
  * Video ioctls follow
@@ -503,7 +503,7 @@ static void capture_stop_streaming(struct vb2_queue *vq)
 	spin_unlock_irqrestore(&priv->q_lock, flags);
 }
 
-static struct vb2_ops capture_qops = {
+static const struct vb2_ops capture_qops = {
 	.queue_setup	 = capture_queue_setup,
 	.buf_init        = capture_buf_init,
 	.buf_prepare	 = capture_buf_prepare,

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 6/6] [media] media: imx: capture: constify vb2_ops structures
  2017-08-05 10:47 ` [PATCH 6/6] [media] media: imx: capture: " Julia Lawall
@ 2017-08-14 23:14   ` Steve Longerbeam
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Longerbeam @ 2017-08-14 23:14 UTC (permalink / raw)
  To: Julia Lawall
  Cc: bhumirks, kernel-janitors, Philipp Zabel, Mauro Carvalho Chehab,
	Greg Kroah-Hartman, linux-media, devel, linux-kernel

Thanks,

Reviewed-by: Steve Longerbeam <steve_longerbeam@mentor.com>

Steve

On 08/05/2017 03:47 AM, Julia Lawall wrote:
> These vb2_ops structures are only stored in the ops field of a
> vb2_queue structure, which is declared as const.  Thus the vb2_ops
> structures themselves can be const.
>
> Done with the help of Coccinelle.
>
> // <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>
>
> ---
>   drivers/staging/media/imx/imx-media-capture.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
> index ddab4c2..ea145ba 100644
> --- a/drivers/staging/media/imx/imx-media-capture.c
> +++ b/drivers/staging/media/imx/imx-media-capture.c
> @@ -62,7 +62,7 @@ struct capture_priv {
>   /* In bytes, per queue */
>   #define VID_MEM_LIMIT	SZ_64M
>   
> -static struct vb2_ops capture_qops;
> +static const struct vb2_ops capture_qops;
>   
>   /*
>    * Video ioctls follow
> @@ -503,7 +503,7 @@ static void capture_stop_streaming(struct vb2_queue *vq)
>   	spin_unlock_irqrestore(&priv->q_lock, flags);
>   }
>   
> -static struct vb2_ops capture_qops = {
> +static const struct vb2_ops capture_qops = {
>   	.queue_setup	 = capture_queue_setup,
>   	.buf_init        = capture_buf_init,
>   	.buf_prepare	 = capture_buf_prepare,
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-14 23:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-05 10:47 [PATCH 0/6] constify vb2_ops structures Julia Lawall
2017-08-05 10:47 ` [PATCH 1/6] [media] v4l2-pci-skeleton: " Julia Lawall
2017-08-05 10:47 ` [PATCH 2/6] [media] media: davinci: vpbe: " Julia Lawall
2017-08-05 10:47 ` [PATCH 3/6] [media] staging: media: davinci_vpfe: " Julia Lawall
2017-08-05 10:47 ` [PATCH 4/6] [media] media: blackfin: bfin_capture: " Julia Lawall
2017-08-05 10:47 ` [PATCH 5/6] staging: bcm2835-camera: " Julia Lawall
2017-08-05 10:47 ` [PATCH 6/6] [media] media: imx: capture: " Julia Lawall
2017-08-14 23:14   ` Steve Longerbeam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®