Subject: Re: [PATCH net-next 4/4] net/mlx5: Add sensor name to temperature event message

From: Simon Horman <[email-masked]>
Date: Sat, 15 Feb 2025 19:29:35 +0000

On Thu, Feb 13, 2025 at 11:46:41AM +0200, Tariq Toukan wrote:
> From: Shahar Shitrit <[email-masked]>
> 
> 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 <[email-masked]>
> Reviewed-by: Carolina Jubran <[email-masked]>
> Signed-off-by: Tariq Toukan <[email-masked]>

Reviewed-by: Simon Horman <[email-masked]>

...

> +#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);
        }
}

...