On Fri, Feb 02, 2024 at 05:21:35PM +0800, Zhang Rui wrote: > Before commit 7108b80a542b ("hwmon/coretemp: Handle large core ID > value"), there is a fixed mapping between > 1. cpu_core_id > 2. the index in pdata->core_data[] array > 3. the sysfs attr name, aka "tempX_" > The later two always equal cpu_core_id + 2. > > After the commit, pdata->core_data[] index is got from ida so that it > can handle sparse core ids and support more cores within a package. > > However, the commit erroneously maps the sysfs attr name to > pdata->core_data[] index instead of cpu_core_id + 2. > > As a result, the code is not aligned with the comments, and brings user > visible changes in hwmon sysfs on systems with sparse core id. > > For example, before commit 7108b80a542b ("hwmon/coretemp: Handle large > core ID value"), > /sys/class/hwmon/hwmon2/temp2_label:Core 0 > /sys/class/hwmon/hwmon2/temp3_label:Core 1 > /sys/class/hwmon/hwmon2/temp4_label:Core 2 > /sys/class/hwmon/hwmon2/temp5_label:Core 3 > /sys/class/hwmon/hwmon2/temp6_label:Core 4 > /sys/class/hwmon/hwmon3/temp10_label:Core 8 > /sys/class/hwmon/hwmon3/temp11_label:Core 9 > after commit, > /sys/class/hwmon/hwmon2/temp2_label:Core 0 > /sys/class/hwmon/hwmon2/temp3_label:Core 1 > /sys/class/hwmon/hwmon2/temp4_label:Core 2 > /sys/class/hwmon/hwmon2/temp5_label:Core 3 > /sys/class/hwmon/hwmon2/temp6_label:Core 4 > /sys/class/hwmon/hwmon2/temp7_label:Core 8 > /sys/class/hwmon/hwmon2/temp8_label:Core 9 > > Restore the previous behavior and rework the code, comments and variable > names to avoid future confusions. > > Fixes: 7108b80a542b ("hwmon/coretemp: Handle large core ID value") > Signed-off-by: Zhang Rui <rui.zhang@xxxxxxxxx> Applied. Thanks, Guenter