Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <daniel.matyas@analog.com>
Acked-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+5
+5
drivers/hwmon/max31827.c
··· 47 47 #define MAX31827_M_DGR_TO_16_BIT(x) (((x) << 4) / 1000) 48 48 #define MAX31827_DEVICE_ENABLE(x) ((x) ? 0xA : 0x0) 49 49 50 + /* 51 + * The enum passed in the .data pointer of struct of_device_id must 52 + * start with a value != 0 since that is a requirement for using 53 + * device_get_match_data(). 54 + */ 50 55 enum chips { max31827 = 1, max31828, max31829 }; 51 56 52 57 enum max31827_cnv {