Skip to content

Commit

Permalink
platform/x86: thinkpad_acpi: clean up dytc profile convert
Browse files Browse the repository at this point in the history
Minor update cleaning up the code around convert_profile_to_dytc as
identified in the previous commit.

Signed-off-by: Mark Pearson <markpearson@lenovo.com>
Link: https://lore.kernel.org/r/20220307183041.4467-1-markpearson@lenovo.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Mark Pearson authored and Hans de Goede committed Mar 9, 2022
1 parent 1e8aa2a commit d4b938a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -10298,13 +10298,18 @@ static int dytc_cql_command(int command, int *output)
static int dytc_profile_set(struct platform_profile_handler *pprof,
enum platform_profile_option profile)
{
int perfmode;
int output;
int err;

err = mutex_lock_interruptible(&dytc_mutex);
if (err)
return err;

err = convert_profile_to_dytc(profile, &perfmode);
if (err)
goto unlock;

if (dytc_profile_available == DYTC_FUNCMODE_MMC) {
if (profile == PLATFORM_PROFILE_BALANCED) {
/*
Expand All @@ -10317,12 +10322,6 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
if (err)
goto unlock;
} else {
int perfmode;

err = convert_profile_to_dytc(profile, &perfmode);
if (err)
goto unlock;

/* Determine if we are in CQL mode. This alters the commands we do */
err = dytc_cql_command(DYTC_SET_COMMAND(DYTC_FUNCTION_MMC, perfmode, 1),
&output);
Expand All @@ -10331,12 +10330,6 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
}
}
if (dytc_profile_available == DYTC_FUNCMODE_PSC) {
int perfmode;

err = convert_profile_to_dytc(profile, &perfmode);
if (err)
goto unlock;

err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output);
if (err)
goto unlock;
Expand Down

0 comments on commit d4b938a

Please sign in to comment.