Mario Limonciello 427c70dec7 platform/x86: thinkpad_acpi: Only update profile if successfully converted
Randomly a Lenovo Z13 will trigger a kernel warning traceback from this
condition:

```
if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names))))
```

This happens because thinkpad-acpi always assumes that
convert_dytc_to_profile() successfully updated the profile. On the
contrary a condition can occur that when dytc_profile_refresh() is called
the profile doesn't get updated as there is a -EOPNOTSUPP branch.

Catch this situation and avoid updating the profile. Also log this into
dynamic debugging in case any other modes should be added in the future.

Fixes: c3bfcd4c6762 ("platform/x86: thinkpad_acpi: Add platform profile support")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20240217022311.113879-1-mario.limonciello@amd.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2024-02-20 14:35:36 +01:00
..
2023-04-25 18:32:43 -07:00
2023-12-11 11:22:02 +01:00
2024-01-02 13:13:01 +01:00
2023-12-11 11:22:02 +01:00
2022-12-12 13:38:17 -08:00
2023-10-31 17:53:00 -10:00
2022-12-12 13:38:17 -08:00
2024-01-22 11:37:27 +01:00