Re: [PATCH net-next 4/4] net/mlx5: Add sensor name to temperature event message
From: Simon Horman
Date: Sat Feb 15 2025 - 14:30:10 EST
On Thu, Feb 13, 2025 at 11:46:41AM +0200, Tariq Toukan wrote:
> From: Shahar Shitrit <shshitrit@xxxxxxxxxx>
>
> Previously, a temperature event message included a bitmap indicating
> which sensors detect high temperatures.
>
> To enhance clarity, we modify the message format to explicitly list
> the names of the overheating sensors, alongside the sensors bitmap.
> If HWMON is not configured, the event message remains unchanged.
>
> Signed-off-by: Shahar Shitrit <shshitrit@xxxxxxxxxx>
> Reviewed-by: Carolina Jubran <cjubran@xxxxxxxxxx>
> Signed-off-by: Tariq Toukan <tariqt@xxxxxxxxxx>
Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
...
> +#if IS_ENABLED(CONFIG_HWMON)
> +static void print_sensor_names_in_bit_set(struct mlx5_core_dev *dev, struct mlx5_hwmon *hwmon,
> + u64 bit_set, int bit_set_offset)
> +{
> + unsigned long *bit_set_ptr = (unsigned long *)&bit_set;
> + int num_bits = sizeof(bit_set) * BITS_PER_BYTE;
> + int i;
> +
> + for_each_set_bit(i, bit_set_ptr, num_bits) {
> + const char *sensor_name = hwmon_get_sensor_name(hwmon, i + bit_set_offset);
> +
> + mlx5_core_warn(dev, "Sensor name[%d]: %s\n", i + bit_set_offset, sensor_name);
> + }
> +}
nit:
If you have to respin for some other reason, please consider limiting lines
to 80 columns wide or less here and elsewhere in this patch where it
doesn't reduce readability (subjective I know).
e.g.:
static void print_sensor_names_in_bit_set(struct mlx5_core_dev *dev,
struct mlx5_hwmon *hwmon,
u64 bit_set, int bit_set_offset)
{
unsigned long *bit_set_ptr = (unsigned long *)&bit_set;
int num_bits = sizeof(bit_set) * BITS_PER_BYTE;
int i;
for_each_set_bit(i, bit_set_ptr, num_bits) {
const char *sensor_name;
sensor_name = hwmon_get_sensor_name(hwmon, i + bit_set_offset);
mlx5_core_warn(dev, "Sensor name[%d]: %s\n",
i + bit_set_offset, sensor_name);
}
}
...