Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575802

Re: [PATCH] mfd: constify regmap_irq_chip structures

Path csiph.com!news.freedyn.net!open-news-network.org!aioe.org!bofh.it!news.nic.it!robomod
From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mfd: constify regmap_irq_chip structures
Date Tue, 07 Feb 2017 16:30:01 +0100
Message-ID <t8fSp-4CE-3@gated-at.bofh.it> (permalink)
References <t3eWZ-8j5-7@gated-at.bofh.it>
X-Original-To Bhumika Goyal <bhumirks@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=RAoALUY7BEizc1lYTvp/ELvg7+eTMo7WmZgzh/Iaj5I=; b=ijClU9iVM5RAxW74Xg9GzAAXwKn5gwc9zLUEhhttrnPfaquLKo9AT1egqlxiwubd24 YSopPMhMyXBChbGYDHbuBuyu0EA5IGZON+v/Yp/x90WRdJ1XNlu0qRxHU1t98fR8mXXM +Xw/UOBQd2xgzRqsbuJGLldzJUm4lJf4iNLx4=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=RAoALUY7BEizc1lYTvp/ELvg7+eTMo7WmZgzh/Iaj5I=; b=n/wZTRVq3RKU+5oPLu5Zv8r5yqZhyLtrxqp0npc31umMpEgVkmUUUwwqB2grMXVaOL 84o2NWcQ9d46bkycm9dEGsC42/fmYf2jRZ5trw9D8kUIItxs2hc+ijfhEw415WoqLBiC T5grKjYYi5XR1wCCkNCIdMEuqyrC1TI3bGaPi2aCH5oHoTvnr4jDBQFb9wRC5K5YpgWn 4fOyrHzZibgerTMAhJsfYLb6uNKdVawVeAukb58+U0IboeAQ3ZGC2lWI7ijfUi7uD/CQ Qk0ZPn2z4fZoPW9Pqb5+zNI5lMJTVA9U+2+loNfnjL/dR1QxUwQZmPmLQ/y8g00qOKwL 8hhg==
X-Gm-Message-State AMke39k9K4iBgcfbI66POQ5vf2bL/PxEDncLqa8nFArki4K+kbNDGtbfaRX7JCjTFSKGqzXG
X-Received by 10.223.166.137 with SMTP id t9mr6182090wrc.15.1486481353827; Tue, 07 Feb 2017 07:29:13 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Disposition inline
Content-Transfer-Encoding 8bit
User-Agent Mutt/1.6.2-neo (2016-08-21)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 76
Organization linux.* mail to news gateway
X-Original-Cc julia.lawall@lip6.fr, linux-kernel@vger.kernel.org
X-Original-Date Tue, 7 Feb 2017 15:29:10 +0000
X-Original-Message-ID <20170207152910.w2ufoxswns4jnvoc@dell>
X-Original-References <1485285924-7059-1-git-send-email-bhumirks@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1575802

Show key headers only | View raw


On Wed, 25 Jan 2017, Bhumika Goyal wrote:

> Declare regmap_irq_chip structures as const as they are only stored
> in the regmap_irq_chip field of a rk808 structure. This field is of
> type const, so regmap_irq_chip structures having this property can be
> made const too.
> Done using Coccinelle:
> 
> @r disable optional_qualifier@
> identifier x;
> position p;
> @@
> static struct regmap_irq_chip x@p={...};
> 
> @ok@
> struct rk808 a;
> identifier r.x;
> position p;
> @@
> a.regmap_irq_chip=&x@p;
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.x;
> @@
> x@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.x;
> @@
> +const
> struct regmap_irq_chip x;
> 
> File size before:
>    text	   data	    bss	    dec	    hex	filename
>    5033	    584	     16	   5633	   1601	drivers/mfd/rk808.o
> 
> File size after:
>    text	   data	    bss	    dec	    hex	filename
>    5225	    392	     16	   5633	   1601	drivers/mfd/rk808.o
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/mfd/rk808.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I have fixed the incorrect subject line and applied the patch.

> diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c
> index 2c9acdb..fd087cb 100644
> --- a/drivers/mfd/rk808.c
> +++ b/drivers/mfd/rk808.c
> @@ -247,7 +247,7 @@ static const struct regmap_irq rk818_irqs[] = {
>  	},
>  };
>  
> -static struct regmap_irq_chip rk808_irq_chip = {
> +static const struct regmap_irq_chip rk808_irq_chip = {
>  	.name = "rk808",
>  	.irqs = rk808_irqs,
>  	.num_irqs = ARRAY_SIZE(rk808_irqs),
> @@ -259,7 +259,7 @@ static struct regmap_irq_chip rk808_irq_chip = {
>  	.init_ack_masked = true,
>  };
>  
> -static struct regmap_irq_chip rk818_irq_chip = {
> +static const struct regmap_irq_chip rk818_irq_chip = {
>  	.name = "rk818",
>  	.irqs = rk818_irqs,
>  	.num_irqs = ARRAY_SIZE(rk818_irqs),

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] mfd: constify regmap_irq_chip structures Lee Jones <lee.jones@linaro.org> - 2017-02-07 16:30 +0100

csiph-web