mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
mlxsw: core_thermal: Constify struct thermal_zone_device_ops
'struct thermal_zone_device_ops' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. While at it, also constify a struct thermal_zone_params. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 24899 8036 0 32935 80a7 drivers/net/ethernet/mellanox/mlxsw/core_thermal.o After: ===== text data bss dec hex filename 25379 7556 0 32935 80a7 drivers/net/ethernet/mellanox/mlxsw/core_thermal.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/4516676973f5adc1cdb76db1691c0f98b6fa6614.1748164348.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a540ee7594
commit
82fb5a369b
|
|
@ -205,11 +205,11 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct thermal_zone_params mlxsw_thermal_params = {
|
||||
static const struct thermal_zone_params mlxsw_thermal_params = {
|
||||
.no_hwmon = true,
|
||||
};
|
||||
|
||||
static struct thermal_zone_device_ops mlxsw_thermal_ops = {
|
||||
static const struct thermal_zone_device_ops mlxsw_thermal_ops = {
|
||||
.should_bind = mlxsw_thermal_should_bind,
|
||||
.get_temp = mlxsw_thermal_get_temp,
|
||||
};
|
||||
|
|
@ -252,7 +252,7 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
|
||||
static const struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
|
||||
.should_bind = mlxsw_thermal_module_should_bind,
|
||||
.get_temp = mlxsw_thermal_module_temp_get,
|
||||
};
|
||||
|
|
@ -280,7 +280,7 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
|
||||
static const struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
|
||||
.should_bind = mlxsw_thermal_module_should_bind,
|
||||
.get_temp = mlxsw_thermal_gearbox_temp_get,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user