summaryrefslogtreecommitdiff
path: root/drivers/acpi/platform_profile.c
diff options
context:
space:
mode:
authorMario Limonciello <mario.limonciello@amd.com>2024-12-05 21:19:03 -0600
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-12-10 19:17:56 +0200
commitab431a20756a0e755c91a5df78c8c70e0fbecd80 (patch)
tree50e01760882418d30315a90fb6e8d771b08037c2 /drivers/acpi/platform_profile.c
parent585484003dedaa35ffc8d1ead3f3334af021dee7 (diff)
ACPI: platform_profile: Move matching string for new profile out of mutex
Holding the mutex is not necessary while scanning the string passed into platform_profile_store(). Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20241206031918.1537-8-mario.limonciello@amd.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/acpi/platform_profile.c')
-rw-r--r--drivers/acpi/platform_profile.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index 4f5623fc27c0..45ffd85a71dd 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -83,6 +83,11 @@ static ssize_t platform_profile_store(struct device *dev,
{
int err, i;
+ /* Scan for a matching profile */
+ i = sysfs_match_string(profile_names, buf);
+ if (i < 0)
+ return -EINVAL;
+
err = mutex_lock_interruptible(&profile_lock);
if (err)
return err;
@@ -92,13 +97,6 @@ static ssize_t platform_profile_store(struct device *dev,
return -ENODEV;
}
- /* Scan for a matching profile */
- i = sysfs_match_string(profile_names, buf);
- if (i < 0) {
- mutex_unlock(&profile_lock);
- return -EINVAL;
- }
-
/* Check that platform supports this profile choice */
if (!test_bit(i, cur_profile->choices)) {
mutex_unlock(&profile_lock);