From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942076AbcJ0UHo (ORCPT ); Thu, 27 Oct 2016 16:07:44 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:63092 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934857AbcJ0UHn (ORCPT ); Thu, 27 Oct 2016 16:07:43 -0400 X-IronPort-AV: E=Sophos;i="5.31,553,1473112800"; d="scan'208";a="198423029" Date: Thu, 27 Oct 2016 22:07:40 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Bhumika Goyal cc: ccaulfie@redhat.com, teigland@redhat.com, cluster-devel@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs: dlm: lockspace: constify kset_uevent_ops structures In-Reply-To: <1477592474-18513-1-git-send-email-bhumirks@gmail.com> Message-ID: References: <1477592474-18513-1-git-send-email-bhumirks@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Oct 2016, Bhumika Goyal wrote: > Declare kset_uevent_ops structure as const as it is only passed as > the second argument to the function kset_create_and_add. This > argument is of type const struct kset_uevent_ops *, so kset_uevent_ops > structures having this property can be declared const. > Done using Coccinelle: > > @r1 disable optional_qualifier @ > identifier i; > position p; > @@ > static struct kset_uevent_ops i@p = {...}; > > @ok1@ > identifier r1.i; > position p; > expression e1,e2; > @@ > kset_create_and_add(e1,&i@p,e2) > > @bad@ > position p!={r1.p,ok1.p}; > identifier r1.i; > @@ > i@p > > @depends on !bad disable optional_qualifier@ > identifier r1.i; > @@ > static > +const > struct kset_uevent_ops i={...}; > > @depends on !bad disable optional_qualifier@ > identifier r1.i; > @@ > +const > struct kset_uevent_ops i; > > File size before: > text data bss dec hex filename > 8034 528 484 9046 2356 fs/dlm/lockspace.o > > File size after: > text data bss dec hex filename > 8050 496 484 9030 2346 fs/dlm/lockspace.o > > Signed-off-by: Bhumika Goyal Acked-by: Julia Lawall > --- > fs/dlm/lockspace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c > index f3e7278..2ea1b77 100644 > --- a/fs/dlm/lockspace.c > +++ b/fs/dlm/lockspace.c > @@ -233,7 +233,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj, > return 0; > } > > -static struct kset_uevent_ops dlm_uevent_ops = { > +static const struct kset_uevent_ops dlm_uevent_ops = { > .uevent = dlm_uevent, > }; > > -- > 1.9.1 > >