hwmon: (k10temp) Define a helper function to read CCD temperature
authorYazen Ghannam <yazen.ghannam@amd.com>
Thu, 6 Jun 2024 16:12:58 +0000 (11:12 -0500)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 12 Jun 2024 09:39:29 +0000 (11:39 +0200)
commitcc66126fd317a70d8612a8356ad512a1539abd75
tree9c0da58d75985928ec038b34a0a18676e8f900fb
parentdc5243921be1b6a0b4259dbcec3dc95016ad8427
hwmon: (k10temp) Define a helper function to read CCD temperature

The CCD temperature register is read in two places. These reads are done
using an AMD SMN access, and a number of parameters are needed for the
operation.

Move the SMN access and parameter gathering into a helper function in order to
simplify the code flow. This also has a benefit of centralizing the hardware
register access in a single place in case fixes or special decoding is required.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240606-fix-smn-bad-read-v4-5-ffde21931c3f@amd.com
drivers/hwmon/k10temp.c