* [PATCH] mfd: constify regmap_irq_chip structures
@ 2017-01-24 19:25 Bhumika Goyal
2017-02-07 15:29 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Bhumika Goyal @ 2017-01-24 19:25 UTC (permalink / raw)
To: julia.lawall, lee.jones, linux-kernel; +Cc: Bhumika Goyal
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(-)
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),
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] mfd: constify regmap_irq_chip structures
2017-01-24 19:25 [PATCH] mfd: constify regmap_irq_chip structures Bhumika Goyal
@ 2017-02-07 15:29 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2017-02-07 15:29 UTC (permalink / raw)
To: Bhumika Goyal; +Cc: julia.lawall, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-02-07 15:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 19:25 [PATCH] mfd: constify regmap_irq_chip structures Bhumika Goyal
2017-02-07 15:29 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®