Re: [PATCH v2 2/2] platform/x86: bitland-mifs-wmi: Don't fail suspend or resume on profile errors

From: Mingyou Chen

Date: Mon Oct 26 2026 - 05:37:22 EST


On 10/26/26 03:54, Chris Taraszka wrote:
bitland_mifs_wmi_suspend() returns the laptop_profile_get() error to
the PM core, which aborts the whole system suspend. This happens on any
machine whose firmware reports a SystemPerMode value that is missing
from its profile table, and on such a laptop with the lid closed logind
keeps retrying the suspend, so the machine stays awake and drains its
battery.

bitland_mifs_wmi_resume() likewise returns any error other than
-EOPNOTSUPP from restoring the profile, so the resume is reported as
failed although the machine is fully usable.

Saving and restoring the platform profile is best effort. Warn and
continue instead of failing the system transition, and skip the restore
when nothing was saved, so resume does not write a stale or default
profile.

Fixes: dc1ec4fa86b2 ("platform/x86: bitland-mifs-wmi: Add new Bitland MIFS WMI driver")
Signed-off-by: Chris Taraszka <chris@xxxxxxxxx>
---

Notes:
Tested on the same machine with v13 and this patch, without patch 1,
and the firmware in 0x04. v13 alone aborts a pm_test=devices suspend:
bitland_mifs_wmi_suspend [bitland_mifs_wmi] returns -22
PM: failed to suspend: error -22
With this patch the suspend completes, "Failed to save platform
profile: -22" is logged and the firmware is still in 0x04 after resume.
This supersedes "platform/x86: bitland-mifs-wmi: Don't abort suspend
when platform profile access fails" [1], reworked on top of v13 6/7.
[1] https://lore.kernel.org/all/20260911182131.461415-1-chris@xxxxxxxxx/

drivers/platform/x86/bitland-mifs-wmi.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/bitland-mifs-wmi.c b/drivers/platform/x86/bitland-mifs-wmi.c
index 73be63146fd5..df9a931fa939 100644
--- a/drivers/platform/x86/bitland-mifs-wmi.c
+++ b/drivers/platform/x86/bitland-mifs-wmi.c
@@ -237,6 +237,7 @@ struct bitland_mifs_wmi_data {
struct device *pp_dev;
const struct bitland_mifs_quirks *quirks;
enum platform_profile_option saved_profile;
+ bool profile_saved;
};
static int bitland_mifs_wmi_call(struct bitland_mifs_wmi_data *data,
@@ -408,10 +409,15 @@ static int bitland_mifs_wmi_suspend(struct device *dev)
return 0;
ret = laptop_profile_get(data->pp_dev, &profile);
- if (ret == 0)
- data->saved_profile = profile;
+ data->profile_saved = !ret;
+ if (ret) {
+ dev_warn(dev, "Failed to save platform profile: %d\n", ret);
+ return 0;
+ }
- return ret;

What value does the firmware respond?

This patch fixes the suspend problem, but it hides the real driver problem (unsupported profile entry).

I saw 0x04 in your patch "platform/x86: bitland-mifs-wmi: Add Xiaomi Book Pro 14 quirk".

If result.data[0] in laptop_profile_get actually equals 0x04, the function should be succeed, but it doesn't.

Is there another no_set (for read only) profile entry for the performance profile?

+ data->saved_profile = profile;
+
+ return 0;
}
static int bitland_mifs_wmi_resume(struct device *dev)
@@ -419,8 +425,8 @@ static int bitland_mifs_wmi_resume(struct device *dev)
struct bitland_mifs_wmi_data *data = dev_get_drvdata(dev);
int ret;
- /* Skip event device */
- if (!data->pp_dev)
+ /* Skip event device, or nothing was saved on suspend */
+ if (!data->pp_dev || !data->profile_saved)
return 0;
ret = laptop_profile_set(dev, data->saved_profile);
@@ -436,8 +442,10 @@ static int bitland_mifs_wmi_resume(struct device *dev)
}
}
- dev_dbg(dev, "Resuming, restoring profile %d\n", data->saved_profile);
- return ret;
+ if (ret)
+ dev_warn(dev, "Failed to restore platform profile: %d\n", ret);
+
+ return 0;
}
static DEFINE_SIMPLE_DEV_PM_OPS(bitland_mifs_wmi_pm_ops,