* [PATCH] platform/x86: asus-wmi: Fix driver not binding when fan curve control probe fails
@ 2022-04-27 11:49 Hans de Goede
2022-04-27 14:15 ` Hans de Goede
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2022-04-27 11:49 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: Hans de Goede, acpi4asus-user, platform-driver-x86,
Luke D . Jones
Before this commit fan_curve_check_present() was trying to not cause
the probe to fail on devices without fan curve control by testing for
known error codes returned by asus_wmi_evaluate_method_buf().
Checking for ENODATA or ENODEV, with the latter being returned by this
function when an ACPI integer with a value of ASUS_WMI_UNSUPPORTED_METHOD
is returned. But for other ACPI integer returns this function just returns
them as is, including the ASUS_WMI_DSTS_UNKNOWN_BIT value of 2.
On the Asus U36SD ASUS_WMI_DSTS_UNKNOWN_BIT gets returned, leading to:
asus-nb-wmi: probe of asus-nb-wmi failed with error 2
Instead of playing whack a mole with error codes here, simply treat all
errors as there not being any fan curves, fixing the driver no longer
loading on the Asus U36SD laptop.
Fixes: e3d13da7f77d ("platform/x86: asus-wmi: Fix regression when probing for fan curve control")
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2079125
Cc: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/asus-wmi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 2104a2621e50..20efcf82ce8d 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -2223,9 +2223,10 @@ 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 || err == -ENODATA)
- return 0;
- return err;
+ pr_debug("fan_curve_get_factory_default(0x%08x) failed: %d\n",
+ fan_dev, err);
+ /* Don't cause probe to fail on devices without fan-curves */
+ return 0;
}
*available = true;
--
2.36.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/x86: asus-wmi: Fix driver not binding when fan curve control probe fails
2022-04-27 11:49 [PATCH] platform/x86: asus-wmi: Fix driver not binding when fan curve control probe fails Hans de Goede
@ 2022-04-27 14:15 ` Hans de Goede
0 siblings, 0 replies; 2+ messages in thread
From: Hans de Goede @ 2022-04-27 14:15 UTC (permalink / raw)
To: Mark Gross, Andy Shevchenko
Cc: acpi4asus-user, platform-driver-x86, Luke D . Jones
Hi,
On 4/27/22 13:49, Hans de Goede wrote:
> Before this commit fan_curve_check_present() was trying to not cause
> the probe to fail on devices without fan curve control by testing for
> known error codes returned by asus_wmi_evaluate_method_buf().
>
> Checking for ENODATA or ENODEV, with the latter being returned by this
> function when an ACPI integer with a value of ASUS_WMI_UNSUPPORTED_METHOD
> is returned. But for other ACPI integer returns this function just returns
> them as is, including the ASUS_WMI_DSTS_UNKNOWN_BIT value of 2.
>
> On the Asus U36SD ASUS_WMI_DSTS_UNKNOWN_BIT gets returned, leading to:
>
> asus-nb-wmi: probe of asus-nb-wmi failed with error 2
>
> Instead of playing whack a mole with error codes here, simply treat all
> errors as there not being any fan curves, fixing the driver no longer
> loading on the Asus U36SD laptop.
>
> Fixes: e3d13da7f77d ("platform/x86: asus-wmi: Fix regression when probing for fan curve control")
> BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=2079125
> Cc: Luke D. Jones <luke@ljones.dev>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
I've added this to my review-hans (soon to be for-next) branch now.
Regards,
Hans
> ---
> drivers/platform/x86/asus-wmi.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
> index 2104a2621e50..20efcf82ce8d 100644
> --- a/drivers/platform/x86/asus-wmi.c
> +++ b/drivers/platform/x86/asus-wmi.c
> @@ -2223,9 +2223,10 @@ 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 || err == -ENODATA)
> - return 0;
> - return err;
> + pr_debug("fan_curve_get_factory_default(0x%08x) failed: %d\n",
> + fan_dev, err);
> + /* Don't cause probe to fail on devices without fan-curves */
> + return 0;
> }
>
> *available = true;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-27 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-27 11:49 [PATCH] platform/x86: asus-wmi: Fix driver not binding when fan curve control probe fails Hans de Goede
2022-04-27 14:15 ` Hans de Goede
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox