public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: mst@redhat.com
Cc: borntraeger@de.ibm.com, jasowang@redhat.com,
	virtualization@lists.linux-foundation.org,
	linux-s390@vger.kernel.org, kvm@vger.kernel.org,
	Bhumika Goyal <bhumirks@gmail.com>,
	Cornelia Huck <cornelia.huck@de.ibm.com>
Subject: [PULL 5/5] virtio/s390: virtio: constify virtio_config_ops structures
Date: Mon, 16 Jan 2017 15:04:33 +0100	[thread overview]
Message-ID: <20170116140433.21301-6-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <20170116140433.21301-1-cornelia.huck@de.ibm.com>

From: Bhumika Goyal <bhumirks@gmail.com>

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 virtio_ccw_device 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 and after applying the patch remains the same.
text	data	bss	dec	hex   filename
9235	296	32928	42459	a5db  drivers/s390/virtio/virtio_ccw.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Message-Id: <1484333336-13443-1-git-send-email-bhumirks@gmail.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 drivers/s390/virtio/virtio_ccw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 0672c6234ae8..070c4da95f48 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -944,7 +944,7 @@ static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
 	kfree(ccw);
 }
 
-static struct virtio_config_ops virtio_ccw_config_ops = {
+static const struct virtio_config_ops virtio_ccw_config_ops = {
 	.get_features = virtio_ccw_get_features,
 	.finalize_features = virtio_ccw_finalize_features,
 	.get = virtio_ccw_get_config,
-- 
2.11.0


  parent reply	other threads:[~2017-01-16 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 14:04 [PULL 0/5] virtio/s390 patches for -next Cornelia Huck
2017-01-16 14:04 ` [PULL 1/5] tools/virtio/ringtest: fix run-on-all.sh for offline cpus Cornelia Huck
2017-01-16 14:04 ` [PULL 2/5] tools/virtio/ringtest: tweaks for s390 Cornelia Huck
2017-01-16 14:04 ` [PULL 3/5] virtio/s390: support READ_STATUS command for virtio-ccw Cornelia Huck
2017-01-16 14:04 ` [PULL 4/5] virtio/s390: add missing \n to end of dev_err message Cornelia Huck
2017-01-16 14:04 ` Cornelia Huck [this message]
2017-01-16 14:29   ` [PULL 5/5] virtio/s390: virtio: constify virtio_config_ops structures Michael S. Tsirkin
2017-01-16 14:46     ` Christian Borntraeger
2017-01-16 15:28     ` Bhumika Goyal
2017-01-16 16:01       ` Michael S. Tsirkin
2017-01-16 16:04         ` Bhumika Goyal
2017-01-16 14:15 ` [PULL 0/5] virtio/s390 patches for -next Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170116140433.21301-6-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=bhumirks@gmail.com \
    --cc=borntraeger@de.ibm.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox