linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: platform: s3c-camif: constify v4l2_subdev_ops structures
@ 2016-12-14 11:11 ` Bhumika Goyal
  2016-12-15 10:34   ` Sylwester Nawrocki
  0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2016-12-14 11:11 UTC (permalink / raw)
  To: julia.lawall, sylvester.nawrocki, mchehab, linux-media,
	linux-samsung-soc, linux-kernel
  Cc: Bhumika Goyal

Check for v4l2_subdev_ops structures that are only passed as an
argument to the function v4l2_subdev_init. This argument is of type
const, so v4l2_subdev_ops structures having this property can also  be
declared const.
Done using Coccinelle:

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
v4l2_subdev_init(...,&i@p)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_ops i;

File size before:
   text	   data	    bss	    dec	    hex	filename
  17171	   1912	     20	  19103	   4a9f
platform/s3c-camif/camif-capture.o

File size after:
   text	   data	    bss	    dec	    hex	filename
  17235	   1848	     20	  19103	   4a9f
platform/s3c-camif/camif-capture.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c b/drivers/media/platform/s3c-camif/camif-capture.c
index 0413a86..6125e72 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -1488,7 +1488,7 @@ static int s3c_camif_subdev_set_selection(struct v4l2_subdev *sd,
 	.set_fmt = s3c_camif_subdev_set_fmt,
 };
 
-static struct v4l2_subdev_ops s3c_camif_subdev_ops = {
+static const struct v4l2_subdev_ops s3c_camif_subdev_ops = {
 	.pad = &s3c_camif_subdev_pad_ops,
 };
 
-- 
1.9.1


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

* Re: [PATCH] media: platform: s3c-camif: constify v4l2_subdev_ops structures
  2016-12-14 11:11 ` [PATCH] media: platform: s3c-camif: constify v4l2_subdev_ops structures Bhumika Goyal
@ 2016-12-15 10:34   ` Sylwester Nawrocki
  0 siblings, 0 replies; 2+ messages in thread
From: Sylwester Nawrocki @ 2016-12-15 10:34 UTC (permalink / raw)
  To: Bhumika Goyal, linux-media
  Cc: julia.lawall, mchehab, linux-samsung-soc, linux-kernel

On 12/14/2016 12:11 PM, Bhumika Goyal wrote:
> Check for v4l2_subdev_ops structures that are only passed as an
> argument to the function v4l2_subdev_init. This argument is of type
> const, so v4l2_subdev_ops structures having this property can also  be
> declared const.

> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>

Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

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

end of thread, other threads:[~2016-12-15 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20161214111230epcas2p3c17ddece4633cdd49ee7759b8215da23@epcas2p3.samsung.com>
2016-12-14 11:11 ` [PATCH] media: platform: s3c-camif: constify v4l2_subdev_ops structures Bhumika Goyal
2016-12-15 10:34   ` Sylwester Nawrocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).