mfd: constify regmap_irq_chip structures
PATCH 1/1 mfd: constify regmap_irq_chip structures
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
--- drivers/mfd/rk808.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/rk808.c +2 -2
@@ -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),
Signature · 1 line
2.7.4
Quoted 35 lines · Bhumika Goyal
Declare
regmap_irq_chipstructures as const as they are only stored in theregmap_irq_chipfield of a rk808 structure. This field is of type const, soregmap_irq_chipstructures having this property can be made const too.
Done using Coccinelle:@r disable optional_qualifier@
identifier x;
position p;
@@
static structregmap_irq_chipx@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
structregmap_irq_chipx;File size before:
text data bss dec hex filename
5033 584 16 5633 1601drivers/mfd/rk808.o
Quoted 8 lines
File size after:
text data bss dec hex filename
5225 392 16 5633 1601drivers/mfd/rk808.oSigned-off-by Bhumika Goyal <[email protected]>--- drivers/mfd/rk808.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
I have fixed the incorrect subject line and applied the patch.
Quoted 22 lines
drivers/mfd/rk808.c +2
-2@@ -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),
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog