[PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp patch

Enrico Mioso mrkiko.rs at gmail.com
Fri Feb 17 15:56:52 PST 2023


This is needed to avoid failures in the thermal subsystem while using this
driver via hwmon subsystem.

CC: Andre Valentin <avalentin at marcant.net>
CC: Karol Przybylski <karol.przybylski at esm-technology.pl>
Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
---
 ...-clamp-temperature-value-in-aqr_hwmo.patch | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch

diff --git a/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
new file mode 100644
index 0000000000..36f0b37130
--- /dev/null
+++ b/target/linux/generic/hack-5.15/726-net-phy-aquantia-clamp-temperature-value-in-aqr_hwmo.patch
@@ -0,0 +1,30 @@
+From 7bfceb1036d2ccda7b8e1e177e834c1cea9f0858 Mon Sep 17 00:00:00 2001
+From: Enrico Mioso <mrkiko.rs at gmail.com>
+Date: Sat, 18 Feb 2023 00:27:55 +0100
+Subject: [PATCH] net: phy: aquantia: clamp temperature value in aqr_hwmon_set
+
+This patch is still under evaluation and is not guaranteed to be correct,
+therefore it is submitted here in hack form. :)
+
+Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
+---
+ drivers/net/phy/aquantia_hwmon.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/net/phy/aquantia_hwmon.c b/drivers/net/phy/aquantia_hwmon.c
+index 19c4c280a6cd..6444055e720c 100644
+--- a/drivers/net/phy/aquantia_hwmon.c
++++ b/drivers/net/phy/aquantia_hwmon.c
+@@ -70,8 +70,7 @@ static int aqr_hwmon_set(struct phy_device *phydev, int reg, long value)
+ {
+ 	int temp;
+ 
+-	if (value >= 128000 || value < -128000)
+-		return -ERANGE;
++	clamp_val(value, -128000, 128000);
+ 
+ 	temp = value * 256 / 1000;
+ 
+-- 
+2.39.2
+
-- 
2.39.2




More information about the openwrt-devel mailing list