All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] constify iio_info structures
@ 2016-09-16 10:55 ` Julia Lawall
  0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, linux-iio, Peter Meerwald-Stadler,
	Lars-Peter Clausen, Hartmut Knaack, Jonathan Cameron

Constify iio_info structures.

---

 drivers/iio/accel/ssp_accel_sensor.c |    2 +-
 drivers/iio/adc/men_z188_adc.c       |    2 +-
 drivers/iio/gyro/ssp_gyro_sensor.c   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/3] constify iio_info structures
@ 2016-09-16 10:55 ` Julia Lawall
  0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: kernel-janitors, linux-iio, Peter Meerwald-Stadler,
	Lars-Peter Clausen, Hartmut Knaack, Jonathan Cameron

Constify iio_info structures.

---

 drivers/iio/accel/ssp_accel_sensor.c |    2 +-
 drivers/iio/adc/men_z188_adc.c       |    2 +-
 drivers/iio/gyro/ssp_gyro_sensor.c   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] iio: common: ssp_sensors: accel: constify iio_info structures
  2016-09-16 10:55 ` Julia Lawall
@ 2016-09-16 10:55   ` Julia Lawall
  -1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1265        344       0    1609         649
   drivers/iio/accel/ssp_accel_sensor.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1425	      192          0       1617     651
   drivers/iio/accel/ssp_accel_sensor.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/iio/accel/ssp_accel_sensor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/ssp_accel_sensor.c b/drivers/iio/accel/ssp_accel_sensor.c
index 4ae05fc..31db009 100644
--- a/drivers/iio/accel/ssp_accel_sensor.c
+++ b/drivers/iio/accel/ssp_accel_sensor.c
@@ -74,7 +74,7 @@ static int ssp_accel_write_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-static struct iio_info ssp_accel_iio_info = {
+static const struct iio_info ssp_accel_iio_info = {
 	.read_raw = &ssp_accel_read_raw,
 	.write_raw = &ssp_accel_write_raw,
 };

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/3] iio: common: ssp_sensors: accel: constify iio_info structures
@ 2016-09-16 10:55   ` Julia Lawall
  0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1265        344       0    1609         649
   drivers/iio/accel/ssp_accel_sensor.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1425	      192          0       1617     651
   drivers/iio/accel/ssp_accel_sensor.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/iio/accel/ssp_accel_sensor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/ssp_accel_sensor.c b/drivers/iio/accel/ssp_accel_sensor.c
index 4ae05fc..31db009 100644
--- a/drivers/iio/accel/ssp_accel_sensor.c
+++ b/drivers/iio/accel/ssp_accel_sensor.c
@@ -74,7 +74,7 @@ static int ssp_accel_write_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-static struct iio_info ssp_accel_iio_info = {
+static const struct iio_info ssp_accel_iio_info = {
 	.read_raw = &ssp_accel_read_raw,
 	.write_raw = &ssp_accel_write_raw,
 };


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
  2016-09-16 10:55 ` Julia Lawall
@ 2016-09-16 10:55   ` Julia Lawall
  -1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1529	       312       0    1841         731
   drivers/iio/adc/men_z188_adc.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1689       168          0       1857     741
   drivers/iio/adc/men_z188_adc.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 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 = &z188_iio_read_raw,
 	.driver_module = THIS_MODULE,
 };

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
@ 2016-09-16 10:55   ` Julia Lawall
  0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1529	       312       0    1841         731
   drivers/iio/adc/men_z188_adc.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1689       168          0       1857     741
   drivers/iio/adc/men_z188_adc.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 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 = &z188_iio_read_raw,
 	.driver_module = THIS_MODULE,
 };


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] iio: common: ssp_sensors: gyro: constify iio_info structures
  2016-09-16 10:55 ` Julia Lawall
@ 2016-09-16 10:55   ` Julia Lawall
  -1 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1245        344       0    1589         635
   drivers/iio/gyro/ssp_gyro_sensor.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1397       192          0       1589     635
   drivers/iio/gyro/ssp_gyro_sensor.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/iio/gyro/ssp_gyro_sensor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c
index 0a8afdd..1f25f40 100644
--- a/drivers/iio/gyro/ssp_gyro_sensor.c
+++ b/drivers/iio/gyro/ssp_gyro_sensor.c
@@ -74,7 +74,7 @@ static int ssp_gyro_write_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-static struct iio_info ssp_gyro_iio_info = {
+static const struct iio_info ssp_gyro_iio_info = {
 	.read_raw = &ssp_gyro_read_raw,
 	.write_raw = &ssp_gyro_write_raw,
 };

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] iio: common: ssp_sensors: gyro: constify iio_info structures
@ 2016-09-16 10:55   ` Julia Lawall
  0 siblings, 0 replies; 14+ messages in thread
From: Julia Lawall @ 2016-09-16 10:55 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)

// <smpl>
@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 = &i@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 = { ... };
// </smpl>

The result of size on this file before the change is:
   text	      data     bss     dec         hex	  filename
   1245        344       0    1589         635
   drivers/iio/gyro/ssp_gyro_sensor.o

and after the change it is:
   text	     data        bss	    dec	    hex	filename
   1397       192          0       1589     635
   drivers/iio/gyro/ssp_gyro_sensor.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/iio/gyro/ssp_gyro_sensor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c
index 0a8afdd..1f25f40 100644
--- a/drivers/iio/gyro/ssp_gyro_sensor.c
+++ b/drivers/iio/gyro/ssp_gyro_sensor.c
@@ -74,7 +74,7 @@ static int ssp_gyro_write_raw(struct iio_dev *indio_dev,
 	return -EINVAL;
 }
 
-static struct iio_info ssp_gyro_iio_info = {
+static const struct iio_info ssp_gyro_iio_info = {
 	.read_raw = &ssp_gyro_read_raw,
 	.write_raw = &ssp_gyro_write_raw,
 };


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] iio: common: ssp_sensors: accel: constify iio_info structures
  2016-09-16 10:55   ` Julia Lawall
@ 2016-09-18 10:56     ` Jonathan Cameron
  -1 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 10:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1265        344       0    1609         649
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1425	      192          0       1617     651
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to the togreg branch of iio.git.  Initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> 
> ---
>  drivers/iio/accel/ssp_accel_sensor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/ssp_accel_sensor.c b/drivers/iio/accel/ssp_accel_sensor.c
> index 4ae05fc..31db009 100644
> --- a/drivers/iio/accel/ssp_accel_sensor.c
> +++ b/drivers/iio/accel/ssp_accel_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_accel_write_raw(struct iio_dev *indio_dev,
>  	return -EINVAL;
>  }
>  
> -static struct iio_info ssp_accel_iio_info = {
> +static const struct iio_info ssp_accel_iio_info = {
>  	.read_raw = &ssp_accel_read_raw,
>  	.write_raw = &ssp_accel_write_raw,
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] iio: common: ssp_sensors: accel: constify iio_info structures
@ 2016-09-18 10:56     ` Jonathan Cameron
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 10:56 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1265        344       0    1609         649
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1425	      192          0       1617     651
>    drivers/iio/accel/ssp_accel_sensor.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to the togreg branch of iio.git.  Initially pushed out
as testing for the autobuilders to play with it.

Thanks,

Jonathan
> 
> ---
>  drivers/iio/accel/ssp_accel_sensor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/accel/ssp_accel_sensor.c b/drivers/iio/accel/ssp_accel_sensor.c
> index 4ae05fc..31db009 100644
> --- a/drivers/iio/accel/ssp_accel_sensor.c
> +++ b/drivers/iio/accel/ssp_accel_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_accel_write_raw(struct iio_dev *indio_dev,
>  	return -EINVAL;
>  }
>  
> -static struct iio_info ssp_accel_iio_info = {
> +static const struct iio_info ssp_accel_iio_info = {
>  	.read_raw = &ssp_accel_read_raw,
>  	.write_raw = &ssp_accel_write_raw,
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
  2016-09-16 10:55   ` Julia Lawall
@ 2016-09-18 10:58     ` Jonathan Cameron
  -1 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 10:58 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1529	       312       0    1841         731
>    drivers/iio/adc/men_z188_adc.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1689       168          0       1857     741
>    drivers/iio/adc/men_z188_adc.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
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 = &z188_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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] iio: adc: men_z188_adc: constify iio_info structures
@ 2016-09-18 10:58     ` Jonathan Cameron
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 10:58 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1529	       312       0    1841         731
>    drivers/iio/adc/men_z188_adc.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1689       168          0       1857     741
>    drivers/iio/adc/men_z188_adc.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
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 = &z188_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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] iio: common: ssp_sensors: gyro: constify iio_info structures
  2016-09-16 10:55   ` Julia Lawall
@ 2016-09-18 11:00     ` Jonathan Cameron
  -1 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 11:00 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1245        344       0    1589         635
>    drivers/iio/gyro/ssp_gyro_sensor.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1397       192          0       1589     635
>    drivers/iio/gyro/ssp_gyro_sensor.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to the togreg branch of iio.git. Initially pushed out
as testing for the autobuilders to play with them.

Thanks,

Jonathan
> 
> ---
>  drivers/iio/gyro/ssp_gyro_sensor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c
> index 0a8afdd..1f25f40 100644
> --- a/drivers/iio/gyro/ssp_gyro_sensor.c
> +++ b/drivers/iio/gyro/ssp_gyro_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_gyro_write_raw(struct iio_dev *indio_dev,
>  	return -EINVAL;
>  }
>  
> -static struct iio_info ssp_gyro_iio_info = {
> +static const struct iio_info ssp_gyro_iio_info = {
>  	.read_raw = &ssp_gyro_read_raw,
>  	.write_raw = &ssp_gyro_write_raw,
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] iio: common: ssp_sensors: gyro: constify iio_info structures
@ 2016-09-18 11:00     ` Jonathan Cameron
  0 siblings, 0 replies; 14+ messages in thread
From: Jonathan Cameron @ 2016-09-18 11:00 UTC (permalink / raw)
  To: Julia Lawall
  Cc: kernel-janitors, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, linux-iio, linux-kernel

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/)
> 
> // <smpl>
> @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 = &i@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 = { ... };
> // </smpl>
> 
> The result of size on this file before the change is:
>    text	      data     bss     dec         hex	  filename
>    1245        344       0    1589         635
>    drivers/iio/gyro/ssp_gyro_sensor.o
> 
> and after the change it is:
>    text	     data        bss	    dec	    hex	filename
>    1397       192          0       1589     635
>    drivers/iio/gyro/ssp_gyro_sensor.o
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied to the togreg branch of iio.git. Initially pushed out
as testing for the autobuilders to play with them.

Thanks,

Jonathan
> 
> ---
>  drivers/iio/gyro/ssp_gyro_sensor.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/gyro/ssp_gyro_sensor.c b/drivers/iio/gyro/ssp_gyro_sensor.c
> index 0a8afdd..1f25f40 100644
> --- a/drivers/iio/gyro/ssp_gyro_sensor.c
> +++ b/drivers/iio/gyro/ssp_gyro_sensor.c
> @@ -74,7 +74,7 @@ static int ssp_gyro_write_raw(struct iio_dev *indio_dev,
>  	return -EINVAL;
>  }
>  
> -static struct iio_info ssp_gyro_iio_info = {
> +static const struct iio_info ssp_gyro_iio_info = {
>  	.read_raw = &ssp_gyro_read_raw,
>  	.write_raw = &ssp_gyro_write_raw,
>  };
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-09-18 11:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-16 10:55 [PATCH 0/3] constify iio_info structures Julia Lawall
2016-09-16 10:55 ` Julia Lawall
2016-09-16 10:55 ` [PATCH 1/3] iio: common: ssp_sensors: accel: " Julia Lawall
2016-09-16 10:55   ` Julia Lawall
2016-09-18 10:56   ` Jonathan Cameron
2016-09-18 10:56     ` Jonathan Cameron
2016-09-16 10:55 ` [PATCH 2/3] iio: adc: men_z188_adc: " Julia Lawall
2016-09-16 10:55   ` Julia Lawall
2016-09-18 10:58   ` Jonathan Cameron
2016-09-18 10:58     ` Jonathan Cameron
2016-09-16 10:55 ` [PATCH 3/3] iio: common: ssp_sensors: gyro: " Julia Lawall
2016-09-16 10:55   ` Julia Lawall
2016-09-18 11:00   ` Jonathan Cameron
2016-09-18 11:00     ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.