]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (nct6775) Let enum kinds start with index 0
authorGuenter Roeck <linux@roeck-us.net>
Thu, 6 Jun 2024 16:23:44 +0000 (09:23 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 11 Jun 2024 14:25:13 +0000 (07:25 -0700)
commit22558934447999f38bb521a57279aa7ecf3f2d74
tree3ed41cb053261f4e46feadccaed2a76f3f6cdead
parente229c6e80f9d3e92880de66962f7448d7d00e7df
hwmon: (nct6775) Let enum kinds start with index 0

Commit 10a0575ea09d ("hwmon: (nct6775-i2c) Use i2c_get_match_data()")
introduced calling i2c_get_match_data() to the nct6775 driver. As part
of that commit, enum kinds was changed to start with 1, based on

    Adjust the 'kinds' enum to not use 0, so that no match data can be
    distinguished from a valid enum value.

The patch had to be fixed later with commit 2792fc8f8c83 ("hwmon:
(nct6775-core) Explicitly initialize nct6775_device_names indexes") and
commit efe86092ab31 ("hwmon: (nct6775-platform) Explicitly initialize
nct6775_sio_names indexes").

Various patches submitted later show that the change from 0 to 1 is
not really necessary. As it turns out, it is perfectly fine as long as
there is an i2c_device_id array with the same data as in the of_device_id
array. This data is used as fallback if the data pointer in struct
of_device_id is NULL (0).

Let enum chips start with 0 to avoid confusion against other drivers
where the enum starts with 0 and i2c_get_match_data() is used as well.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/nct6775.h