diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2017-08-02 17:01:45 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-09-01 02:42:54 -0400 |
commit | de854e54d79bc0ad5c45c5be50821b1c0639cb75 (patch) | |
tree | 7abb9e9efc11372c0dc4eaef38b36115792efb19 | |
parent | 8a7aef2cb3dafd2e8560750f4e5ad2cc2d9b1d17 (diff) |
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>
-rw-r--r-- | drivers/macintosh/windfarm_lm75_sensor.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/windfarm_lm87_sensor.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/windfarm_max6690_sensor.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/windfarm_smu_sat.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/windfarm_smu_sensors.c | 10 |
5 files changed, 9 insertions, 9 deletions
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index 590214ba736c..6cdfe714901d 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c | |||
@@ -82,7 +82,7 @@ static void wf_lm75_release(struct wf_sensor *sr) | |||
82 | kfree(lm); | 82 | kfree(lm); |
83 | } | 83 | } |
84 | 84 | ||
85 | static struct wf_sensor_ops wf_lm75_ops = { | 85 | static const struct wf_sensor_ops wf_lm75_ops = { |
86 | .get_value = wf_lm75_get, | 86 | .get_value = wf_lm75_get, |
87 | .release = wf_lm75_release, | 87 | .release = wf_lm75_release, |
88 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
diff --git a/drivers/macintosh/windfarm_lm87_sensor.c b/drivers/macintosh/windfarm_lm87_sensor.c index 913c4bfeef94..35aa571d498a 100644 --- a/drivers/macintosh/windfarm_lm87_sensor.c +++ b/drivers/macintosh/windfarm_lm87_sensor.c | |||
@@ -91,7 +91,7 @@ static void wf_lm87_release(struct wf_sensor *sr) | |||
91 | kfree(lm); | 91 | kfree(lm); |
92 | } | 92 | } |
93 | 93 | ||
94 | static struct wf_sensor_ops wf_lm87_ops = { | 94 | static const struct wf_sensor_ops wf_lm87_ops = { |
95 | .get_value = wf_lm87_get, | 95 | .get_value = wf_lm87_get, |
96 | .release = wf_lm87_release, | 96 | .release = wf_lm87_release, |
97 | .owner = THIS_MODULE, | 97 | .owner = THIS_MODULE, |
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c index 87e439b10318..6ad035e13c08 100644 --- a/drivers/macintosh/windfarm_max6690_sensor.c +++ b/drivers/macintosh/windfarm_max6690_sensor.c | |||
@@ -55,7 +55,7 @@ static void wf_max6690_release(struct wf_sensor *sr) | |||
55 | kfree(max); | 55 | kfree(max); |
56 | } | 56 | } |
57 | 57 | ||
58 | static struct wf_sensor_ops wf_max6690_ops = { | 58 | static const struct wf_sensor_ops wf_max6690_ops = { |
59 | .get_value = wf_max6690_get, | 59 | .get_value = wf_max6690_get, |
60 | .release = wf_max6690_release, | 60 | .release = wf_max6690_release, |
61 | .owner = THIS_MODULE, | 61 | .owner = THIS_MODULE, |
diff --git a/drivers/macintosh/windfarm_smu_sat.c b/drivers/macintosh/windfarm_smu_sat.c index e9c828bf171b..da7f4fc1a51d 100644 --- a/drivers/macintosh/windfarm_smu_sat.c +++ b/drivers/macintosh/windfarm_smu_sat.c | |||
@@ -195,7 +195,7 @@ static void wf_sat_sensor_release(struct wf_sensor *sr) | |||
195 | kref_put(&sat->ref, wf_sat_release); | 195 | kref_put(&sat->ref, wf_sat_release); |
196 | } | 196 | } |
197 | 197 | ||
198 | static struct wf_sensor_ops wf_sat_ops = { | 198 | static const struct wf_sensor_ops wf_sat_ops = { |
199 | .get_value = wf_sat_sensor_get, | 199 | .get_value = wf_sat_sensor_get, |
200 | .release = wf_sat_sensor_release, | 200 | .release = wf_sat_sensor_release, |
201 | .owner = THIS_MODULE, | 201 | .owner = THIS_MODULE, |
diff --git a/drivers/macintosh/windfarm_smu_sensors.c b/drivers/macintosh/windfarm_smu_sensors.c index 1cc4e4953d89..172fd267dcf6 100644 --- a/drivers/macintosh/windfarm_smu_sensors.c +++ b/drivers/macintosh/windfarm_smu_sensors.c | |||
@@ -172,22 +172,22 @@ static int smu_slotspow_get(struct wf_sensor *sr, s32 *value) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | static struct wf_sensor_ops smu_cputemp_ops = { | 175 | static const struct wf_sensor_ops smu_cputemp_ops = { |
176 | .get_value = smu_cputemp_get, | 176 | .get_value = smu_cputemp_get, |
177 | .release = smu_ads_release, | 177 | .release = smu_ads_release, |
178 | .owner = THIS_MODULE, | 178 | .owner = THIS_MODULE, |
179 | }; | 179 | }; |
180 | static struct wf_sensor_ops smu_cpuamp_ops = { | 180 | static const struct wf_sensor_ops smu_cpuamp_ops = { |
181 | .get_value = smu_cpuamp_get, | 181 | .get_value = smu_cpuamp_get, |
182 | .release = smu_ads_release, | 182 | .release = smu_ads_release, |
183 | .owner = THIS_MODULE, | 183 | .owner = THIS_MODULE, |
184 | }; | 184 | }; |
185 | static struct wf_sensor_ops smu_cpuvolt_ops = { | 185 | static const struct wf_sensor_ops smu_cpuvolt_ops = { |
186 | .get_value = smu_cpuvolt_get, | 186 | .get_value = smu_cpuvolt_get, |
187 | .release = smu_ads_release, | 187 | .release = smu_ads_release, |
188 | .owner = THIS_MODULE, | 188 | .owner = THIS_MODULE, |
189 | }; | 189 | }; |
190 | static struct wf_sensor_ops smu_slotspow_ops = { | 190 | static const struct wf_sensor_ops smu_slotspow_ops = { |
191 | .get_value = smu_slotspow_get, | 191 | .get_value = smu_slotspow_get, |
192 | .release = smu_ads_release, | 192 | .release = smu_ads_release, |
193 | .owner = THIS_MODULE, | 193 | .owner = THIS_MODULE, |
@@ -327,7 +327,7 @@ static int smu_cpu_power_get(struct wf_sensor *sr, s32 *value) | |||
327 | return 0; | 327 | return 0; |
328 | } | 328 | } |
329 | 329 | ||
330 | static struct wf_sensor_ops smu_cpu_power_ops = { | 330 | static const struct wf_sensor_ops smu_cpu_power_ops = { |
331 | .get_value = smu_cpu_power_get, | 331 | .get_value = smu_cpu_power_get, |
332 | .release = smu_cpu_power_release, | 332 | .release = smu_cpu_power_release, |
333 | .owner = THIS_MODULE, | 333 | .owner = THIS_MODULE, |