Skip to content
  • Julia Lawall's avatar
    iio: adc: men_z188_adc: constify iio_info structures · 52ceb773
    Julia Lawall authored
    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: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    52ceb773