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

Enrico Mioso mrkiko.rs at gmail.com
Sat Feb 18 12:47:45 PST 2023




On Sat, 18 Feb 2023, Robert Marko wrote:

> Date: Sat, 18 Feb 2023 12:45:34
> From: Robert Marko <robimarko at gmail.com>
> To: Enrico Mioso <mrkiko.rs at gmail.com>
> Cc: openwrt-devel at lists.openwrt.org, Andre Valentin <avalentin at marcant.net>,
>     Karol Przybylski <karol.przybylski at esm-technology.pl>
> Subject: Re: [PATCH 2/2] hack-5.15: add Aquantia PHY hwmon temperature clamp
>     patch
> 
> On Sat, 18 Feb 2023 at 00:58, Enrico Mioso <mrkiko.rs at gmail.com> wrote:
>>
>> This is needed to avoid failures in the thermal subsystem while using this
>> driver via hwmon subsystem.
>
> This should be submitted upstream, we have enough hacks already and
> you will get proper feedback from Guenter rather fast whether this is a bug
> in hwmon or the driver needs fixups.

Thanks for your review and feedback!

I am in the process of discussing this change upstream; the problem seems not to be related to hwmon core, but my approach of clamping the value is not going to be accepted either.
I'm being asked to simply change the -ERANGE returned value to -EINVAL, so I will do it independently of this openwrt patch.

But I am supposed to set max a min limits directly to reasonable values.
I have no clear idea yet on where to set them in DTS, any help or hint would be very apreciated.

Enrico
>
> Regards,
> Robert
>>
>> 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
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>



More information about the openwrt-devel mailing list