From: Guenter Roeck Date: Fri, 7 Jun 2024 13:32:04 +0000 (-0700) Subject: hwmon: (pmbus/max31827) Explain why enum chips must not start with 0 X-Git-Tag: v6.11-rc1~212^2~49 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=138d45d96758db803b50761297f3331c9170bc87;p=thirdparty%2Fkernel%2Flinux.git hwmon: (pmbus/max31827) Explain why enum chips must not start with 0 If a driver calls device_get_match_data(), the .data pointer in its id data structures must not be NULL/0 because device_get_match_data() returns NULL if an entry is not found. Explain that in a comment to avoid confusion why this is required in this driver but not in other drivers. Cc: Daniel Matyas Acked-by: Nuno Sa Signed-off-by: Guenter Roeck --- diff --git a/drivers/hwmon/max31827.c b/drivers/hwmon/max31827.c index 4d89b6a7060ba..48e8f8ba4d05b 100644 --- a/drivers/hwmon/max31827.c +++ b/drivers/hwmon/max31827.c @@ -47,6 +47,11 @@ #define MAX31827_M_DGR_TO_16_BIT(x) (((x) << 4) / 1000) #define MAX31827_DEVICE_ENABLE(x) ((x) ? 0xA : 0x0) +/* + * The enum passed in the .data pointer of struct of_device_id must + * start with a value != 0 since that is a requirement for using + * device_get_match_data(). + */ enum chips { max31827 = 1, max31828, max31829 }; enum max31827_cnv {