OSDN Git Service

platform/x86: thinkpad_acpi: Cleanup dytc_profile_available
authorHans de Goede <hdegoede@redhat.com>
Sun, 21 Nov 2021 19:11:26 +0000 (20:11 +0100)
committerHans de Goede <hdegoede@redhat.com>
Thu, 25 Nov 2021 15:18:48 +0000 (16:18 +0100)
commit0b0d2fba4f3302b601c429c9286e66b3af2d29cb
tree8e12b10a573d85f1ba7cf2b7f6b653507b28ae92
parent5a47ac0041678d3d610b3ac724bca8c4bda2ddff
platform/x86: thinkpad_acpi: Cleanup dytc_profile_available

Remove the dytc_profile_available check from dytc_profile_set(),
that function only gets called if the platform_profile_handler was
registered, so the check is not necessary.

Make tpacpi_dytc_profile_init() return -ENODEV when it does not register
the platform_profile() handler this will cause
dytc_profile_driver_data.flags.init to not get set, which in turn will
cause the dytc_profile_exit() call to get skipped.

Together this avoids the need to have the dytc_profile_available
variable at all, since the information is now duplicated in the
dytc_profile_driver_data.flags.init flag.

Note this leaves a weirdly indented code-block behind, this is
deliberately done to make what actually changes in this commit clear.
This will be fixed-up in the next commit.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Mark Pearson <mpearson@lenovo.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211121191129.256713-5-hdegoede@redhat.com
drivers/platform/x86/thinkpad_acpi.c