Re: [PATCH v2 3/4] hwmon: (asus-ec-sensors) add support for board families

From: Guenter Roeck
Date: Tue Apr 26 2022 - 11:24:35 EST


On Tue, Apr 26, 2022 at 11:23:39AM +0200, Eugene Shalygin wrote:
> DSDT code for AMD 400-series chipset shows that sensor addresses differ
> for this generation from those for the AMD 500-series boards.
>
> Signed-off-by: Eugene Shalygin <eugene.shalygin@xxxxxxxxx>
> ---
> drivers/hwmon/asus-ec-sensors.c | 39 ++++++++++++++++++++++++++++-----
> 1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 7267682de191..b52e3679476a 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
> @@ -135,8 +135,12 @@ enum ec_sensors {
> #define SENSOR_TEMP_WATER_IN BIT(ec_sensor_temp_water_in)
> #define SENSOR_TEMP_WATER_OUT BIT(ec_sensor_temp_water_out)
>
> +enum board_family {
> + family_amd_500_series,

The default enum value is 0. This means that specifying nothing
for .family matches in the structure below always matches the first
enum, which doesn't make much sense and might cause trouble in the
future. I would suggest to explicitly select a value != 0 as first
entry, such as

enum board_family {
family_amd_500_series = 1,
...
};

to avoid that problem.

Guenter