Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > > Signed-off-by: Bhumika GoyalApplied to for-next with a shortened commit message, thanks! signature.asc Description: PGP signature
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > > Signed-off-by: Bhumika Goyal Applied to for-next with a shortened commit message, thanks! signature.asc Description: PGP signature
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > Done using Coccinelle: > > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct i2c_algorithm i@p={...}; > > @ok@ > identifier r.i,x; > position p; > struct i2c_adapter adapter; > struct xlr_i2c_private priv; > @@ > ( > adapter.algo=@p; > | > priv.adap.algo=@p; > ) > > @bad@ > position p!={r.p,ok.p}; > identifier r.i; > @@ > i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > +const > struct i2c_algorithm i; > > File size details before and after patching. > First line of every .o file shows the file size before patching > and second line shows the size after patching. > >text data bss dec hex filename > >9138 1328 8 1047428ea drivers/i2c/busses/i2c-at91.o >9178 1280 8 1046628e2 drivers/i2c/busses/i2c-at91.o > >7555 657 88220201c i2c/busses/i2c-designware-core.o >7619 617 882442034 i2c/busses/i2c-designware-core.o > >7240 2240 12096002580 drivers/i2c/busses/i2c-eg20t.o >7304 2176 12096002580 drivers/i2c/busses/i2c-eg20t.o > >2399 248 82655 a5f drivers/i2c/busses/i2c-emev2.o >2455 192 82655 a5f drivers/i2c/busses/i2c-emev2.o > >3766 688 84462116e i2c/busses/i2c-imx-lpi2c.o >3814 632 844541166 i2c/busses/i2c-imx-lpi2c.o > > 11793 4280 16 160893ed9 drivers/i2c/busses/i2c-imx.o > 11857 4216 16 160893ed9 drivers/i2c/busses/i2c-imx.o > >4046 656 847101266 drivers/i2c/busses/i2c-nforce2.o >4110 592 847101266 drivers/i2c/busses/i2c-nforce2.o > >1397 464 01861 745 i2c/busses/i2c-robotfuzz-osif.o >1437 408 01845 735 i2c/busses/i2c-robotfuzz-osif.o > >9622 1216 16 108542a66 i2c/busses/i2c-sh_mobile.o >9662 1160 16 108382a56 i2c/busses/i2c-sh_mobile.o > >4936 576 855201590 drivers/i2c/busses/i2c-st.o >5000 512 855201590 drivers/i2c/busses/i2c-st.o > >3404 248 83660 e4c i2c/busses/i2c-xgene-slimpro.o >3460 192 83660 e4c i2c/busses/i2c-xgene-slimpro.o > >2741 600 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o >2797 544 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o > >2643 248 82899 b53 drivers/i2c/busses/i2c-xlr.o >2707 192 82907 b5b drivers/i2c/busses/i2c-xlr.o > > Signed-off-by: Bhumika Goyal> --- > drivers/i2c/busses/i2c-at91.c| 2 +- Acked-by: Ludovic Desroches Regards Ludovic
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > Done using Coccinelle: > > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct i2c_algorithm i@p={...}; > > @ok@ > identifier r.i,x; > position p; > struct i2c_adapter adapter; > struct xlr_i2c_private priv; > @@ > ( > adapter.algo=@p; > | > priv.adap.algo=@p; > ) > > @bad@ > position p!={r.p,ok.p}; > identifier r.i; > @@ > i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > +const > struct i2c_algorithm i; > > File size details before and after patching. > First line of every .o file shows the file size before patching > and second line shows the size after patching. > >text data bss dec hex filename > >9138 1328 8 1047428ea drivers/i2c/busses/i2c-at91.o >9178 1280 8 1046628e2 drivers/i2c/busses/i2c-at91.o > >7555 657 88220201c i2c/busses/i2c-designware-core.o >7619 617 882442034 i2c/busses/i2c-designware-core.o > >7240 2240 12096002580 drivers/i2c/busses/i2c-eg20t.o >7304 2176 12096002580 drivers/i2c/busses/i2c-eg20t.o > >2399 248 82655 a5f drivers/i2c/busses/i2c-emev2.o >2455 192 82655 a5f drivers/i2c/busses/i2c-emev2.o > >3766 688 84462116e i2c/busses/i2c-imx-lpi2c.o >3814 632 844541166 i2c/busses/i2c-imx-lpi2c.o > > 11793 4280 16 160893ed9 drivers/i2c/busses/i2c-imx.o > 11857 4216 16 160893ed9 drivers/i2c/busses/i2c-imx.o > >4046 656 847101266 drivers/i2c/busses/i2c-nforce2.o >4110 592 847101266 drivers/i2c/busses/i2c-nforce2.o > >1397 464 01861 745 i2c/busses/i2c-robotfuzz-osif.o >1437 408 01845 735 i2c/busses/i2c-robotfuzz-osif.o > >9622 1216 16 108542a66 i2c/busses/i2c-sh_mobile.o >9662 1160 16 108382a56 i2c/busses/i2c-sh_mobile.o > >4936 576 855201590 drivers/i2c/busses/i2c-st.o >5000 512 855201590 drivers/i2c/busses/i2c-st.o > >3404 248 83660 e4c i2c/busses/i2c-xgene-slimpro.o >3460 192 83660 e4c i2c/busses/i2c-xgene-slimpro.o > >2741 600 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o >2797 544 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o > >2643 248 82899 b53 drivers/i2c/busses/i2c-xlr.o >2707 192 82907 b5b drivers/i2c/busses/i2c-xlr.o > > Signed-off-by: Bhumika Goyal > --- > drivers/i2c/busses/i2c-at91.c| 2 +- Acked-by: Ludovic Desroches Regards Ludovic
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, 27 Jan 2017 23:36:17 +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > (...) I have vague memories that I tried to do the same long ago and it didn't work back then. But I can't no longer remember the details, and today it seems just fine to do it. Reviewed-by: Jean Delvare-- Jean Delvare SUSE L3 Support
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On Fri, 27 Jan 2017 23:36:17 +0530, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > (...) I have vague memories that I tried to do the same long ago and it didn't work back then. But I can't no longer remember the details, and today it seems just fine to do it. Reviewed-by: Jean Delvare -- Jean Delvare SUSE L3 Support
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On 01/27/2017 08:06 PM, Bhumika Goyal wrote: Declare i2c_algorithm structures as const as they are only stored in the algo field of an i2c_adapter structure. This field is of type const, so i2c_algorithm structures having this property can be made const too. Done using Coccinelle: ... diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 6d81c56..a62c14c 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c @@ -822,7 +822,7 @@ static u32 i2c_dw_func(struct i2c_adapter *adap) return dev->functionality; } -static struct i2c_algorithm i2c_dw_algo = { +static const struct i2c_algorithm i2c_dw_algo = { .master_xfer= i2c_dw_xfer, .functionality = i2c_dw_func, }; Acked-by: Jarkko Nikula
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On 01/27/2017 08:06 PM, Bhumika Goyal wrote: Declare i2c_algorithm structures as const as they are only stored in the algo field of an i2c_adapter structure. This field is of type const, so i2c_algorithm structures having this property can be made const too. Done using Coccinelle: ... diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 6d81c56..a62c14c 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c @@ -822,7 +822,7 @@ static u32 i2c_dw_func(struct i2c_adapter *adap) return dev->functionality; } -static struct i2c_algorithm i2c_dw_algo = { +static const struct i2c_algorithm i2c_dw_algo = { .master_xfer= i2c_dw_xfer, .functionality = i2c_dw_func, }; Acked-by: Jarkko Nikula
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On 01/27/2017 07:06 PM, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > Done using Coccinelle: > > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct i2c_algorithm i@p={...}; > > @ok@ > identifier r.i,x; > position p; > struct i2c_adapter adapter; > struct xlr_i2c_private priv; > @@ > ( > adapter.algo=@p; > | > priv.adap.algo=@p; > ) > > @bad@ > position p!={r.p,ok.p}; > identifier r.i; > @@ > i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > +const > struct i2c_algorithm i; > > File size details before and after patching. > First line of every .o file shows the file size before patching > and second line shows the size after patching. > >text data bss dec hex filename > >9138 1328 8 1047428ea drivers/i2c/busses/i2c-at91.o >9178 1280 8 1046628e2 drivers/i2c/busses/i2c-at91.o > >7555 657 88220201c i2c/busses/i2c-designware-core.o >7619 617 882442034 i2c/busses/i2c-designware-core.o > >7240 2240 12096002580 drivers/i2c/busses/i2c-eg20t.o >7304 2176 12096002580 drivers/i2c/busses/i2c-eg20t.o > >2399 248 82655 a5f drivers/i2c/busses/i2c-emev2.o >2455 192 82655 a5f drivers/i2c/busses/i2c-emev2.o > >3766 688 84462116e i2c/busses/i2c-imx-lpi2c.o >3814 632 844541166 i2c/busses/i2c-imx-lpi2c.o > > 11793 4280 16 160893ed9 drivers/i2c/busses/i2c-imx.o > 11857 4216 16 160893ed9 drivers/i2c/busses/i2c-imx.o > >4046 656 847101266 drivers/i2c/busses/i2c-nforce2.o >4110 592 847101266 drivers/i2c/busses/i2c-nforce2.o > >1397 464 01861 745 i2c/busses/i2c-robotfuzz-osif.o >1437 408 01845 735 i2c/busses/i2c-robotfuzz-osif.o > >9622 1216 16 108542a66 i2c/busses/i2c-sh_mobile.o >9662 1160 16 108382a56 i2c/busses/i2c-sh_mobile.o > >4936 576 855201590 drivers/i2c/busses/i2c-st.o >5000 512 855201590 drivers/i2c/busses/i2c-st.o > >3404 248 83660 e4c i2c/busses/i2c-xgene-slimpro.o >3460 192 83660 e4c i2c/busses/i2c-xgene-slimpro.o > >2741 600 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o >2797 544 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o > >2643 248 82899 b53 drivers/i2c/busses/i2c-xlr.o >2707 192 82907 b5b drivers/i2c/busses/i2c-xlr.o > > Signed-off-by: Bhumika Goyal> --- > drivers/i2c/busses/i2c-at91.c| 2 +- > drivers/i2c/busses/i2c-bfin-twi.c| 2 +- > drivers/i2c/busses/i2c-designware-core.c | 2 +- > drivers/i2c/busses/i2c-eg20t.c | 2 +- > drivers/i2c/busses/i2c-emev2.c | 2 +- > drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- > drivers/i2c/busses/i2c-imx.c | 2 +- > drivers/i2c/busses/i2c-nforce2.c | 2 +- > drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 +- > drivers/i2c/busses/i2c-sh_mobile.c | 2 +- > drivers/i2c/busses/i2c-st.c | 2 +- > drivers/i2c/busses/i2c-xgene-slimpro.c | 2 +- > drivers/i2c/busses/i2c-xlp9xx.c | 2 +- > drivers/i2c/busses/i2c-xlr.c | 2 +- > 14 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c > index 0b86c61..e4fcb0c 100644 > --- a/drivers/i2c/busses/i2c-at91.c > +++ b/drivers/i2c/busses/i2c-at91.c > @@ -820,7 +820,7 @@ static u32 at91_twi_func(struct i2c_adapter *adapter) > | I2C_FUNC_SMBUS_READ_BLOCK_DATA; > } > > -static struct i2c_algorithm at91_twi_algorithm = { > +static const struct i2c_algorithm at91_twi_algorithm = { > .master_xfer= at91_twi_xfer, > .functionality = at91_twi_func, > }; > diff --git a/drivers/i2c/busses/i2c-bfin-twi.c > b/drivers/i2c/busses/i2c-bfin-twi.c > index 29d00c4..9fe942b 100644 > --- a/drivers/i2c/busses/i2c-bfin-twi.c > +++ b/drivers/i2c/busses/i2c-bfin-twi.c > @@ -563,7 +563,7 @@ static u32 bfin_twi_functionality(struct i2c_adapter > *adap) > I2C_FUNC_I2C | I2C_FUNC_SMBUS_I2C_BLOCK; > } > > -static struct i2c_algorithm bfin_twi_algorithm = { > +static const struct i2c_algorithm bfin_twi_algorithm = { > .master_xfer = bfin_twi_master_xfer, > .smbus_xfer= bfin_twi_smbus_xfer, > .functionality = bfin_twi_functionality, > diff --git
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
On 01/27/2017 07:06 PM, Bhumika Goyal wrote: > Declare i2c_algorithm structures as const as they are only stored in the > algo field of an i2c_adapter structure. This field is of type const, so > i2c_algorithm structures having this property can be made const too. > Done using Coccinelle: > > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct i2c_algorithm i@p={...}; > > @ok@ > identifier r.i,x; > position p; > struct i2c_adapter adapter; > struct xlr_i2c_private priv; > @@ > ( > adapter.algo=@p; > | > priv.adap.algo=@p; > ) > > @bad@ > position p!={r.p,ok.p}; > identifier r.i; > @@ > i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > +const > struct i2c_algorithm i; > > File size details before and after patching. > First line of every .o file shows the file size before patching > and second line shows the size after patching. > >text data bss dec hex filename > >9138 1328 8 1047428ea drivers/i2c/busses/i2c-at91.o >9178 1280 8 1046628e2 drivers/i2c/busses/i2c-at91.o > >7555 657 88220201c i2c/busses/i2c-designware-core.o >7619 617 882442034 i2c/busses/i2c-designware-core.o > >7240 2240 12096002580 drivers/i2c/busses/i2c-eg20t.o >7304 2176 12096002580 drivers/i2c/busses/i2c-eg20t.o > >2399 248 82655 a5f drivers/i2c/busses/i2c-emev2.o >2455 192 82655 a5f drivers/i2c/busses/i2c-emev2.o > >3766 688 84462116e i2c/busses/i2c-imx-lpi2c.o >3814 632 844541166 i2c/busses/i2c-imx-lpi2c.o > > 11793 4280 16 160893ed9 drivers/i2c/busses/i2c-imx.o > 11857 4216 16 160893ed9 drivers/i2c/busses/i2c-imx.o > >4046 656 847101266 drivers/i2c/busses/i2c-nforce2.o >4110 592 847101266 drivers/i2c/busses/i2c-nforce2.o > >1397 464 01861 745 i2c/busses/i2c-robotfuzz-osif.o >1437 408 01845 735 i2c/busses/i2c-robotfuzz-osif.o > >9622 1216 16 108542a66 i2c/busses/i2c-sh_mobile.o >9662 1160 16 108382a56 i2c/busses/i2c-sh_mobile.o > >4936 576 855201590 drivers/i2c/busses/i2c-st.o >5000 512 855201590 drivers/i2c/busses/i2c-st.o > >3404 248 83660 e4c i2c/busses/i2c-xgene-slimpro.o >3460 192 83660 e4c i2c/busses/i2c-xgene-slimpro.o > >2741 600 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o >2797 544 83349 d15 drivers/i2c/busses/i2c-xlp9xx.o > >2643 248 82899 b53 drivers/i2c/busses/i2c-xlr.o >2707 192 82907 b5b drivers/i2c/busses/i2c-xlr.o > > Signed-off-by: Bhumika Goyal > --- > drivers/i2c/busses/i2c-at91.c| 2 +- > drivers/i2c/busses/i2c-bfin-twi.c| 2 +- > drivers/i2c/busses/i2c-designware-core.c | 2 +- > drivers/i2c/busses/i2c-eg20t.c | 2 +- > drivers/i2c/busses/i2c-emev2.c | 2 +- > drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- > drivers/i2c/busses/i2c-imx.c | 2 +- > drivers/i2c/busses/i2c-nforce2.c | 2 +- > drivers/i2c/busses/i2c-robotfuzz-osif.c | 2 +- > drivers/i2c/busses/i2c-sh_mobile.c | 2 +- > drivers/i2c/busses/i2c-st.c | 2 +- > drivers/i2c/busses/i2c-xgene-slimpro.c | 2 +- > drivers/i2c/busses/i2c-xlp9xx.c | 2 +- > drivers/i2c/busses/i2c-xlr.c | 2 +- > 14 files changed, 14 insertions(+), 14 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c > index 0b86c61..e4fcb0c 100644 > --- a/drivers/i2c/busses/i2c-at91.c > +++ b/drivers/i2c/busses/i2c-at91.c > @@ -820,7 +820,7 @@ static u32 at91_twi_func(struct i2c_adapter *adapter) > | I2C_FUNC_SMBUS_READ_BLOCK_DATA; > } > > -static struct i2c_algorithm at91_twi_algorithm = { > +static const struct i2c_algorithm at91_twi_algorithm = { > .master_xfer= at91_twi_xfer, > .functionality = at91_twi_func, > }; > diff --git a/drivers/i2c/busses/i2c-bfin-twi.c > b/drivers/i2c/busses/i2c-bfin-twi.c > index 29d00c4..9fe942b 100644 > --- a/drivers/i2c/busses/i2c-bfin-twi.c > +++ b/drivers/i2c/busses/i2c-bfin-twi.c > @@ -563,7 +563,7 @@ static u32 bfin_twi_functionality(struct i2c_adapter > *adap) > I2C_FUNC_I2C | I2C_FUNC_SMBUS_I2C_BLOCK; > } > > -static struct i2c_algorithm bfin_twi_algorithm = { > +static const struct i2c_algorithm bfin_twi_algorithm = { > .master_xfer = bfin_twi_master_xfer, > .smbus_xfer= bfin_twi_smbus_xfer, > .functionality = bfin_twi_functionality, > diff --git
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
Hello, On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > drivers/i2c/busses/i2c-imx.c | 2 +- Acked-by: Uwe Kleine-Königfor i2c-imx.c Thanks Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | http://www.pengutronix.de/ |
Re: [PATCH] i2c: busses: constify i2c_algorithm structures
Hello, On Fri, Jan 27, 2017 at 11:36:17PM +0530, Bhumika Goyal wrote: > drivers/i2c/busses/i2c-imx.c | 2 +- Acked-by: Uwe Kleine-König for i2c-imx.c Thanks Uwe -- Pengutronix e.K. | Uwe Kleine-König| Industrial Linux Solutions | http://www.pengutronix.de/ |