]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/macintosh: constify wf_sensor_ops structures
authorJulia Lawall <Julia.Lawall@lip6.fr>
Wed, 2 Aug 2017 21:01:45 +0000 (23:01 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 1 Sep 2017 06:42:54 +0000 (16:42 +1000)
commit0d207d26d610416949582656a23d38e0506b1685
tree7abb9e9efc11372c0dc4eaef38b36115792efb19
parentaf197666fecc5043a74f10a6af71845037c02ff7
powerpc/macintosh: constify wf_sensor_ops structures

The wf_sensor_ops structures are only stored in the ops field of a
wf_sensor structure, which is declared as const.  Thus the
wf_sensor_ops structures themselves can be const.

Done with the help of Coccinelle.

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct wf_sensor_ops i@p = { ... };

@ok1@
identifier r.i;
struct wf_sensor s;
position p;
@@
s.ops = &i@p

@ok2@
identifier r.i;
struct wf_sat_sensor s;
position p;
@@
s.sens.ops = &i@p

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct wf_sensor_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct wf_sensor_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
drivers/macintosh/windfarm_lm75_sensor.c
drivers/macintosh/windfarm_lm87_sensor.c
drivers/macintosh/windfarm_max6690_sensor.c
drivers/macintosh/windfarm_smu_sat.c
drivers/macintosh/windfarm_smu_sensors.c