Re: [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
On 16/09/16 11:55, Julia Lawall wrote: > Check for iio_info structures that are only stored in the info field of a > iio_dev structure. This field is declared const, so iio_info 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/) > > // > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct iio_info i@p = { ... }; > > @ok@ > identifier r.i; > struct iio_dev e; > position p; > @@ > e.info = @p; > > @bad@ > position p != {r.p,ok.p}; > identifier r.i; > struct iio_info e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct iio_info i = { ... }; > // > > The result of size on this file before the change is: >text data bss dec hexfilename >1529 312 01841 731 >drivers/iio/adc/men_z188_adc.o > > and after the change it is: >textdatabssdec hex filename >1689 168 0 1857 741 >drivers/iio/adc/men_z188_adc.o > > Signed-off-by: Julia LawallApplied to the togreg branch of iio.git. Initially pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > > --- > drivers/iio/adc/men_z188_adc.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c > index d095efe..8f3606d 100644 > --- a/drivers/iio/adc/men_z188_adc.c > +++ b/drivers/iio/adc/men_z188_adc.c > @@ -78,7 +78,7 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, > return ret; > } > > -static struct iio_info z188_adc_info = { > +static const struct iio_info z188_adc_info = { > .read_raw = _iio_read_raw, > .driver_module = THIS_MODULE, > }; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >
Re: [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
On 16/09/16 11:55, Julia Lawall wrote: > Check for iio_info structures that are only stored in the info field of a > iio_dev structure. This field is declared const, so iio_info 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/) > > // > @r disable optional_qualifier@ > identifier i; > position p; > @@ > static struct iio_info i@p = { ... }; > > @ok@ > identifier r.i; > struct iio_dev e; > position p; > @@ > e.info = @p; > > @bad@ > position p != {r.p,ok.p}; > identifier r.i; > struct iio_info e; > @@ > e@i@p > > @depends on !bad disable optional_qualifier@ > identifier r.i; > @@ > static > +const > struct iio_info i = { ... }; > // > > The result of size on this file before the change is: >text data bss dec hexfilename >1529 312 01841 731 >drivers/iio/adc/men_z188_adc.o > > and after the change it is: >textdatabssdec hex filename >1689 168 0 1857 741 >drivers/iio/adc/men_z188_adc.o > > Signed-off-by: Julia Lawall Applied to the togreg branch of iio.git. Initially pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > > --- > drivers/iio/adc/men_z188_adc.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c > index d095efe..8f3606d 100644 > --- a/drivers/iio/adc/men_z188_adc.c > +++ b/drivers/iio/adc/men_z188_adc.c > @@ -78,7 +78,7 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, > return ret; > } > > -static struct iio_info z188_adc_info = { > +static const struct iio_info z188_adc_info = { > .read_raw = _iio_read_raw, > .driver_module = THIS_MODULE, > }; > > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >
[PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
Check for iio_info structures that are only stored in the info field of a iio_dev structure. This field is declared const, so iio_info 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/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct iio_info i@p = { ... }; @ok@ identifier r.i; struct iio_dev e; position p; @@ e.info = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct iio_info e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct iio_info i = { ... }; // The result of size on this file before the change is: text data bss dec hexfilename 1529312 01841 731 drivers/iio/adc/men_z188_adc.o and after the change it is: text databssdec hex filename 1689 168 0 1857 741 drivers/iio/adc/men_z188_adc.o Signed-off-by: Julia Lawall--- drivers/iio/adc/men_z188_adc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index d095efe..8f3606d 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c @@ -78,7 +78,7 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, return ret; } -static struct iio_info z188_adc_info = { +static const struct iio_info z188_adc_info = { .read_raw = _iio_read_raw, .driver_module = THIS_MODULE, };
[PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
Check for iio_info structures that are only stored in the info field of a iio_dev structure. This field is declared const, so iio_info 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/) // @r disable optional_qualifier@ identifier i; position p; @@ static struct iio_info i@p = { ... }; @ok@ identifier r.i; struct iio_dev e; position p; @@ e.info = @p; @bad@ position p != {r.p,ok.p}; identifier r.i; struct iio_info e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct iio_info i = { ... }; // The result of size on this file before the change is: text data bss dec hexfilename 1529312 01841 731 drivers/iio/adc/men_z188_adc.o and after the change it is: text databssdec hex filename 1689 168 0 1857 741 drivers/iio/adc/men_z188_adc.o Signed-off-by: Julia Lawall --- drivers/iio/adc/men_z188_adc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c index d095efe..8f3606d 100644 --- a/drivers/iio/adc/men_z188_adc.c +++ b/drivers/iio/adc/men_z188_adc.c @@ -78,7 +78,7 @@ static int z188_iio_read_raw(struct iio_dev *iio_dev, return ret; } -static struct iio_info z188_adc_info = { +static const struct iio_info z188_adc_info = { .read_raw = _iio_read_raw, .driver_module = THIS_MODULE, };