From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751229AbdAPJJa (ORCPT ); Mon, 16 Jan 2017 04:09:30 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45978 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdAPJIg (ORCPT ); Mon, 16 Jan 2017 04:08:36 -0500 Subject: Re: [PATCH] s390: virtio: constify virtio_config_ops structures To: Bhumika Goyal , julia.lawall@lip6.fr, heiko.carstens@de.ibm.com, cornelia.huck@de.ibm.com, schwidefsky@de.ibm.com, linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <1484333336-13443-1-git-send-email-bhumirks@gmail.com> From: Christian Borntraeger Date: Mon, 16 Jan 2017 10:08:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <1484333336-13443-1-git-send-email-bhumirks@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17011609-0004-0000-0000-0000114BE9DC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006442; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000199; SDB=6.00808286; UDB=6.00393633; IPR=6.00585645; BA=6.00005058; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013930; XFM=3.00000011; UTC=2017-01-16 09:08:33 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17011609-0005-0000-0000-00007C32EA07 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-16_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701160138 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/13/2017 07:48 PM, Bhumika Goyal wrote: > 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 thanks applied. > --- > 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 639ed4e..6508bf4 100644 > --- a/drivers/s390/virtio/virtio_ccw.c > +++ b/drivers/s390/virtio/virtio_ccw.c > @@ -920,7 +920,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, >