From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751208AbdAMS3C (ORCPT ); Fri, 13 Jan 2017 13:29:02 -0500 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35268 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbdAMS3A (ORCPT ); Fri, 13 Jan 2017 13:29:00 -0500 From: Bhumika Goyal To: julia.lawall@lip6.fr, sudeep.dutt@intel.com, ashutosh.dixit@intel.com, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] misc: mic: constify virtio_config_ops structures Date: Fri, 13 Jan 2017 23:48:26 +0530 Message-Id: <1484331506-21251-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@p={...}; @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 --- 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