mirror of https://github.com/torvalds/linux.git
This structure is only used to copy into another structure, so declare
it as const.
This issue was detected using Coccinelle and the following semantic patch:
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct gpio_chip i@p = { ... };
@ok@
identifier r.i;
expression e;
position p;
@@
e = i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct gpio_chip e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct gpio_chip i = { ... };
In the following log you can see a significant difference in the code size
and data segment, hence in the dec segment. This log is the output
of the size command, before and after the code change:
before:
text data bss dec hex filename
12775 3696 64 16535 4097 drivers/pinctrl/pinctrl-coh901.o
after:
bss dec hex filename
12440 3640 64 16144 3f10 drivers/pinctrl/pinctrl-coh901.o
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
|
||
|---|---|---|
| .. | ||
| aspeed | ||
| bcm | ||
| berlin | ||
| freescale | ||
| intel | ||
| mediatek | ||
| meson | ||
| mvebu | ||
| nomadik | ||
| pxa | ||
| qcom | ||
| samsung | ||
| sh-pfc | ||
| sirf | ||
| spear | ||
| stm32 | ||
| sunxi | ||
| tegra | ||
| ti | ||
| uniphier | ||
| vt8500 | ||
| zte | ||
| Kconfig | ||
| Makefile | ||
| core.c | ||
| core.h | ||
| devicetree.c | ||
| devicetree.h | ||
| pinconf-generic.c | ||
| pinconf.c | ||
| pinconf.h | ||
| pinctrl-adi2-bf54x.c | ||
| pinctrl-adi2-bf60x.c | ||
| pinctrl-adi2.c | ||
| pinctrl-adi2.h | ||
| pinctrl-amd.c | ||
| pinctrl-amd.h | ||
| pinctrl-artpec6.c | ||
| pinctrl-as3722.c | ||
| pinctrl-at91-pio4.c | ||
| pinctrl-at91.c | ||
| pinctrl-at91.h | ||
| pinctrl-coh901.c | ||
| pinctrl-coh901.h | ||
| pinctrl-da850-pupd.c | ||
| pinctrl-digicolor.c | ||
| pinctrl-falcon.c | ||
| pinctrl-ingenic.c | ||
| pinctrl-lantiq.c | ||
| pinctrl-lantiq.h | ||
| pinctrl-lpc18xx.c | ||
| pinctrl-max77620.c | ||
| pinctrl-mcp23s08.c | ||
| pinctrl-oxnas.c | ||
| pinctrl-palmas.c | ||
| pinctrl-pic32.c | ||
| pinctrl-pic32.h | ||
| pinctrl-pistachio.c | ||
| pinctrl-rockchip.c | ||
| pinctrl-rza1.c | ||
| pinctrl-single.c | ||
| pinctrl-st.c | ||
| pinctrl-sx150x.c | ||
| pinctrl-tb10x.c | ||
| pinctrl-tz1090-pdc.c | ||
| pinctrl-tz1090.c | ||
| pinctrl-u300.c | ||
| pinctrl-utils.c | ||
| pinctrl-utils.h | ||
| pinctrl-xway.c | ||
| pinctrl-zynq.c | ||
| pinmux.c | ||
| pinmux.h | ||