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

hwmon: (jc42) Strengthen detect function

Configuration register bit 5 must read 0 for all JC42.4 compliant chips.
Several capability register bits must be set for all TSE2004 compliant
chips. Use that information to strengthen the detect function.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+5 -1
+5 -1
drivers/hwmon/jc42.c
··· 413 413 if (cap < 0 || config < 0 || manid < 0 || devid < 0) 414 414 return -ENODEV; 415 415 416 - if ((cap & 0xff00) || (config & 0xf800)) 416 + if ((cap & 0xff00) || (config & 0xf820)) 417 + return -ENODEV; 418 + 419 + if ((devid & TSE2004_DEVID_MASK) == TSE2004_DEVID && 420 + (cap & 0x00e7) != 0x00e7) 417 421 return -ENODEV; 418 422 419 423 for (i = 0; i < ARRAY_SIZE(jc42_chips); i++) {