Commit d8cc9415 authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Guenter Roeck

hwmon: constify pointers to hwmon_channel_info

HWmon core receives an array of pointers to hwmon_channel_info and it
does not modify it, thus it can be array of const pointers for safety.
This allows drivers to make them also const.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 7e364e56
...@@ -133,7 +133,7 @@ The hwmon_chip_info structure looks as follows:: ...@@ -133,7 +133,7 @@ The hwmon_chip_info structure looks as follows::
struct hwmon_chip_info { struct hwmon_chip_info {
const struct hwmon_ops *ops; const struct hwmon_ops *ops;
const struct hwmon_channel_info **info; const struct hwmon_channel_info * const *info;
}; };
It contains the following fields: It contains the following fields:
...@@ -229,7 +229,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register ...@@ -229,7 +229,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register
.config = lm75_temp_config, .config = lm75_temp_config,
}; };
static const struct hwmon_channel_info *lm75_info[] = { static const struct hwmon_channel_info * const lm75_info[] = {
&lm75_chip, &lm75_chip,
&lm75_temp, &lm75_temp,
NULL NULL
...@@ -238,7 +238,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register ...@@ -238,7 +238,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register
The HWMON_CHANNEL_INFO() macro can and should be used when possible. The HWMON_CHANNEL_INFO() macro can and should be used when possible.
With this macro, the above example can be simplified to With this macro, the above example can be simplified to
static const struct hwmon_channel_info *lm75_info[] = { static const struct hwmon_channel_info * const lm75_info[] = {
HWMON_CHANNEL_INFO(chip, HWMON_CHANNEL_INFO(chip,
HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL), HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL),
HWMON_CHANNEL_INFO(temp, HWMON_CHANNEL_INFO(temp,
......
...@@ -914,7 +914,7 @@ void hl_hwmon_fini(struct hl_device *hdev) ...@@ -914,7 +914,7 @@ void hl_hwmon_fini(struct hl_device *hdev)
void hl_hwmon_release_resources(struct hl_device *hdev) void hl_hwmon_release_resources(struct hl_device *hdev)
{ {
const struct hwmon_channel_info **channel_info_arr; const struct hwmon_channel_info * const *channel_info_arr;
int i = 0; int i = 0;
if (!hdev->hl_chip_info->info) if (!hdev->hl_chip_info->info)
......
...@@ -174,7 +174,7 @@ static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int ...@@ -174,7 +174,7 @@ static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int
struct hwmon_thermal_data *tdata = tz->devdata; struct hwmon_thermal_data *tdata = tz->devdata;
struct hwmon_device *hwdev = to_hwmon_device(tdata->dev); struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
const struct hwmon_chip_info *chip = hwdev->chip; const struct hwmon_chip_info *chip = hwdev->chip;
const struct hwmon_channel_info **info = chip->info; const struct hwmon_channel_info * const *info = chip->info;
unsigned int i; unsigned int i;
int err; int err;
...@@ -253,7 +253,7 @@ static int hwmon_thermal_register_sensors(struct device *dev) ...@@ -253,7 +253,7 @@ static int hwmon_thermal_register_sensors(struct device *dev)
{ {
struct hwmon_device *hwdev = to_hwmon_device(dev); struct hwmon_device *hwdev = to_hwmon_device(dev);
const struct hwmon_chip_info *chip = hwdev->chip; const struct hwmon_chip_info *chip = hwdev->chip;
const struct hwmon_channel_info **info = chip->info; const struct hwmon_channel_info * const *info = chip->info;
void *drvdata = dev_get_drvdata(dev); void *drvdata = dev_get_drvdata(dev);
int i; int i;
......
...@@ -430,7 +430,7 @@ struct hwmon_channel_info { ...@@ -430,7 +430,7 @@ struct hwmon_channel_info {
*/ */
struct hwmon_chip_info { struct hwmon_chip_info {
const struct hwmon_ops *ops; const struct hwmon_ops *ops;
const struct hwmon_channel_info **info; const struct hwmon_channel_info * const *info;
}; };
/* hwmon_device_register() is deprecated */ /* hwmon_device_register() is deprecated */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment