Skip to content

Commit d4b938a

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: thinkpad_acpi: clean up dytc profile convert
Minor update cleaning up the code around convert_profile_to_dytc as identified in the previous commit. Signed-off-by: Mark Pearson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent 1e8aa2a commit d4b938a

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

drivers/platform/x86/thinkpad_acpi.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10298,13 +10298,18 @@ static int dytc_cql_command(int command, int *output)
1029810298
static int dytc_profile_set(struct platform_profile_handler *pprof,
1029910299
enum platform_profile_option profile)
1030010300
{
10301+
int perfmode;
1030110302
int output;
1030210303
int err;
1030310304

1030410305
err = mutex_lock_interruptible(&dytc_mutex);
1030510306
if (err)
1030610307
return err;
1030710308

10309+
err = convert_profile_to_dytc(profile, &perfmode);
10310+
if (err)
10311+
goto unlock;
10312+
1030810313
if (dytc_profile_available == DYTC_FUNCMODE_MMC) {
1030910314
if (profile == PLATFORM_PROFILE_BALANCED) {
1031010315
/*
@@ -10317,12 +10322,6 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
1031710322
if (err)
1031810323
goto unlock;
1031910324
} else {
10320-
int perfmode;
10321-
10322-
err = convert_profile_to_dytc(profile, &perfmode);
10323-
if (err)
10324-
goto unlock;
10325-
1032610325
/* Determine if we are in CQL mode. This alters the commands we do */
1032710326
err = dytc_cql_command(DYTC_SET_COMMAND(DYTC_FUNCTION_MMC, perfmode, 1),
1032810327
&output);
@@ -10331,12 +10330,6 @@ static int dytc_profile_set(struct platform_profile_handler *pprof,
1033110330
}
1033210331
}
1033310332
if (dytc_profile_available == DYTC_FUNCMODE_PSC) {
10334-
int perfmode;
10335-
10336-
err = convert_profile_to_dytc(profile, &perfmode);
10337-
if (err)
10338-
goto unlock;
10339-
1034010333
err = dytc_command(DYTC_SET_COMMAND(DYTC_FUNCTION_PSC, perfmode, 1), &output);
1034110334
if (err)
1034210335
goto unlock;

0 commit comments

Comments
 (0)