Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (ibmaem) constify aem_rw_sensor_template and aem_ro_sensor_template structures

The aem_rw_sensor_template and aem_ro_sensor_template structures are never
modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Julia Lawall and committed by
Guenter Roeck
449278d9 c60fdf85

+6 -6
+6 -6
drivers/hwmon/ibmaem.c
··· 920 920 921 921 /* Discover sensors on an AEM device */ 922 922 static int aem_register_sensors(struct aem_data *data, 923 - struct aem_ro_sensor_template *ro, 924 - struct aem_rw_sensor_template *rw) 923 + const struct aem_ro_sensor_template *ro, 924 + const struct aem_rw_sensor_template *rw) 925 925 { 926 926 struct device *dev = &data->pdev->dev; 927 927 struct sensor_device_attribute *sensors = data->sensors; ··· 1020 1020 /* Sensor probe functions */ 1021 1021 1022 1022 /* Description of AEM1 sensors */ 1023 - static struct aem_ro_sensor_template aem1_ro_sensors[] = { 1023 + static const struct aem_ro_sensor_template aem1_ro_sensors[] = { 1024 1024 {"energy1_input", aem_show_energy, 0}, 1025 1025 {"power1_average", aem_show_power, 0}, 1026 1026 {NULL, NULL, 0}, 1027 1027 }; 1028 1028 1029 - static struct aem_rw_sensor_template aem1_rw_sensors[] = { 1029 + static const struct aem_rw_sensor_template aem1_rw_sensors[] = { 1030 1030 {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, 1031 1031 {NULL, NULL, NULL, 0}, 1032 1032 }; 1033 1033 1034 1034 /* Description of AEM2 sensors */ 1035 - static struct aem_ro_sensor_template aem2_ro_sensors[] = { 1035 + static const struct aem_ro_sensor_template aem2_ro_sensors[] = { 1036 1036 {"energy1_input", aem_show_energy, 0}, 1037 1037 {"energy2_input", aem_show_energy, 1}, 1038 1038 {"power1_average", aem_show_power, 0}, ··· 1050 1050 {NULL, NULL, 0}, 1051 1051 }; 1052 1052 1053 - static struct aem_rw_sensor_template aem2_rw_sensors[] = { 1053 + static const struct aem_rw_sensor_template aem2_rw_sensors[] = { 1054 1054 {"power1_average_interval", aem_show_power_period, aem_set_power_period, 0}, 1055 1055 {"power2_average_interval", aem_show_power_period, aem_set_power_period, 1}, 1056 1056 {NULL, NULL, NULL, 0},