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


Groups > linux.kernel > #1524944

Re: [2/2] i2c: constify i2c_adapter_quirks structures

From Wolfram Sang <wsa-dev@sang-engineering.com>
Newsgroups linux.kernel
Subject Re: [2/2] i2c: constify i2c_adapter_quirks structures
Date 2016-11-18 02:10 +0100
Message-ID <sEFQJ-8tn-1@gated-at.bofh.it> (permalink)
References <ssBpw-2oM-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Sat, Oct 15, 2016 at 07:32:02PM +0200, Julia Lawall wrote:
> Check for i2c_adapter_quirks structures that are only stored in the
> quirks field of an i2c_adapter structure.  This field is declared
> const, so i2c_adapter_quirks structures that have this property can be
> declared as const also.
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @r disable optional_qualifier@
> identifier i;
> position p;
> @@
> static struct i2c_adapter_quirks i@p = { ... };
> 
> @ok@
> identifier r.i;
> struct i2c_adapter e;
> position p;
> @@
> e.quirks = &i@p;
> 
> @bad@
> position p != {r.p,ok.p};
> identifier r.i;
> struct i2c_adapter_quirks e;
> @@
> e@i@p
> 
> @depends on !bad disable optional_qualifier@
> identifier r.i;
> @@
> static
> +const
>  struct i2c_adapter_quirks i = { ... };
> // </smpl>
> 
> The effect on the layout of the .o files is shown by the following
> output of the size command, first before then after the
> transformation:
> 
>    text    data     bss     dec     hex filename
>    3651     472       8    4131    1023 drivers/i2c/busses/i2c-axxia.o
>    3683     440       8    4131    1023 drivers/i2c/busses/i2c-axxia.o
> 
>    text    data     bss     dec     hex filename
>    1069     216       0    1285     505 drivers/i2c/busses/i2c-dln2.o
>    1101     192       0    1293     50d drivers/i2c/busses/i2c-dln2.o
> 
>    text    data     bss     dec     hex filename
>    3211     484       1    3696     e70 drivers/i2c/busses/i2c-viperboard.o
>    3243     460       1    3704     e78 drivers/i2c/busses/i2c-viperboard.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Squashed with the other similar patch and applied to for-next, thanks!

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


Thread

Re: [2/2] i2c: constify i2c_adapter_quirks structures Wolfram Sang <wsa-dev@sang-engineering.com> - 2016-11-18 02:10 +0100

csiph-web