Skip to contentSkip to conversation

platform/x86: asus-wmi: Fix regression when probing for fan curve control

PATCH In review Hans de Goede 2 participants 3 messages Feb 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/x86: asus-wmi: Fix regression when probing for fan curve control

The fan curve control patches introduced a regression for at least the TUF FX506 and possibly other TUF series laptops that do not have support for fan curve control.

As part of the probing process, asus_wmi_evaluate_method_buf is called to get the factory default fan curve . The WMI management function returns 0 on certain laptops to indicate lack of fan curve control instead of ASUS_WMI_UNSUPPORTED_METHOD. This 0 is transformed to -ENODATA which results in failure when probing.

Fixes 0f0ac158d28f ("platform/x86: asus-wmi: Add support for custom fan curves")
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -1
index a3b83b22a3b1..2104a2621e50 100644
@@ -2223,7 +2223,7 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available,
 
 	err = fan_curve_get_factory_default(asus, fan_dev);
 	if (err) {
-		if (err == -ENODEV)
+		if (err == -ENODEV || err == -ENODATA)
 			return 0;
 		return err;
 	}
Signature · 1 line
2.33.1
#1 lore raw

Hi,

Tested this out and it works as expected. Thanks for the quick resolution!

Thanks
Abhijeet

Quoted 30 lines · Hans de Goede

The fan curve control patches introduced a regression for at least the TUF FX506 and possibly other TUF series laptops that do not have support for fan curve control.

As part of the probing process, asus_wmi_evaluate_method_buf is called to get the factory default fan curve . The WMI management function returns 0 on certain laptops to indicate lack of fan curve control instead of ASUS_WMI_UNSUPPORTED_METHOD. This 0 is transformed to -ENODATA which results in failure when probing.

Fixes 0f0ac158d28f ("platform/x86: asus-wmi: Add support for custom fan curves")
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -1
index a3b83b22a3b1..2104a2621e50 100644
@@ -2223,7 +2223,7 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available,
 
 	err = fan_curve_get_factory_default(asus, fan_dev);
 	if (err) {
-		if (err == -ENODEV)
+		if (err == -ENODEV || err == -ENODATA)
 			return 0;
 		return err;
 	}
#2 lore raw

Hi,

Quoted 3 lines · Abhijeet Viswa

Hi,

Tested this out and it works as expected. Thanks for the quick resolution!

Thank you,

I've added this to my review-hans (soon to be for-next) branch now I'll also include this in my next fixes pull-req for 5.17 (the bug only exists in 5.17).

Regards,

Hans

Quoted 32 lines · Hans de Goede
Quoted 30 lines

The fan curve control patches introduced a regression for at least the TUF FX506 and possibly other TUF series laptops that do not have support for fan curve control.

As part of the probing process, asus_wmi_evaluate_method_buf is called to get the factory default fan curve . The WMI management function returns 0 on certain laptops to indicate lack of fan curve control instead of ASUS_WMI_UNSUPPORTED_METHOD. This 0 is transformed to -ENODATA which results in failure when probing.

Fixes 0f0ac158d28f ("platform/x86: asus-wmi: Add support for custom fan curves")
---
 drivers/platform/x86/asus-wmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/asus-wmi.c +1 -1
index a3b83b22a3b1..2104a2621e50 100644
@@ -2223,7 +2223,7 @@ static int fan_curve_check_present(struct asus_wmi *asus, bool *available,
 
 	err = fan_curve_get_factory_default(asus, fan_dev);
 	if (err) {
-		if (err == -ENODEV)
+		if (err == -ENODEV || err == -ENODATA)
 			return 0;
 		return err;
 	}