hwmon/coretemp: Handle large core ID value
authorZhang Rui <rui.zhang@intel.com>
Fri, 14 Oct 2022 09:01:45 +0000 (17:01 +0800)
committerDave Hansen <dave.hansen@linux.intel.com>
Mon, 17 Oct 2022 18:58:52 +0000 (11:58 -0700)
commit7108b80a542b9d65e44b36d64a700a83658c0b73
tree48e0da1d04740ba5112ef21f7091d5bd857da2a1
parent33806e7cb8d50379f55c3e8f335e91e1b359dc7b
hwmon/coretemp: Handle large core ID value

The coretemp driver supports up to a hard-coded limit of 128 cores.

Today, the driver can not support a core with an ID above that limit.
Yet, the encoding of core ID's is arbitrary (BIOS APIC-ID) and so they
may be sparse and they may be large.

Update the driver to map arbitrary core ID numbers into appropriate
array indexes so that 128 cores can be supported, no matter the encoding
of core ID's.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Len Brown <len.brown@intel.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20221014090147.1836-3-rui.zhang@intel.com
drivers/hwmon/coretemp.c