[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1484331506-21251-1-git-send-email-bhumirks@gmail.com>
Date: Fri, 13 Jan 2017 23:48:26 +0530
From: Bhumika Goyal <bhumirks@...il.com>
To: julia.lawall@...6.fr, sudeep.dutt@...el.com,
ashutosh.dixit@...el.com, linux-kernel@...r.kernel.org
Cc: Bhumika Goyal <bhumirks@...il.com>
Subject: [PATCH] misc: mic: constify virtio_config_ops structures
Declare virtio_config_ops structure as const as it is only stored in the
config field of a virtio_device structure. This field is of type const, so
virtio_config_ops structures having this property can be declared const.
Done using Coccinelle:
@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct virtio_config_ops i@......};
@ok1@
identifier r1.i;
position p;
struct _vop_vdev x;
@@
x.vdev.config=&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 virtio_config_ops i;
File size before: drivers/misc/mic/vop/vop_main.o
text data bss dec hex filename
4588 256 0 4844 12ec drivers/misc/mic/vop/vop_main.o
File size after: drivers/misc/mic/vop/vop_main.o
text data bss dec hex filename
4704 160 0 4864 1300 drivers/misc/mic/vop/vop_main.o
Signed-off-by: Bhumika Goyal <bhumirks@...il.com>
---
drivers/misc/mic/vop/vop_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/mic/vop/vop_main.c b/drivers/misc/mic/vop/vop_main.c
index 1a2b67f3..3b7c8ea 100644
--- a/drivers/misc/mic/vop/vop_main.c
+++ b/drivers/misc/mic/vop/vop_main.c
@@ -422,7 +422,7 @@ static int vop_find_vqs(struct virtio_device *dev, unsigned nvqs,
/*
* The config ops structure as defined by virtio config
*/
-static struct virtio_config_ops vop_vq_config_ops = {
+static const struct virtio_config_ops vop_vq_config_ops = {
.get_features = vop_get_features,
.finalize_features = vop_finalize_features,
.get = vop_get,
--
1.9.1
Powered by blists - more mailing lists