From patchwork Mon Dec 2 05:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 847005 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2070.outbound.protection.outlook.com [40.107.95.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB48A1F943A; Mon, 2 Dec 2024 05:51:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.70 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733118704; cv=fail; b=FVWno2bo6Ry7sSQDhbEltzrea35bqq2LtzIKMrSq3olVzEH/dmsFOwaNkCe6ySgLVGtiHmjpgw6Uwd9MDggsRYqpafEFAriZx2NTz+I15O8ddy8he6d2x0yg+FBrYSxq5mdYhvyP7td9L4MVGJjPWZw5mTdubAs6P7PiOShf9KE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733118704; c=relaxed/simple; bh=+xN18sNC5Ocgap1+ttPhDXae8uq0m/TFsmTPn/lgO0w=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q5La+X2qRBKtg1UPYBhqlBB0+74enrmQ2obofmt+47ADtixmexz98NMz4XGMKftoHSb3zvkTabJk6Lm40DPKU4z+nLqbWHQphftW9T4fLB1EncOx1S1wK58d6lbdCGQBG55fAh5kbxLl5TwBETwtYOGN3h5puUGmJYsfr7gNPhQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=pX/LnXVb; arc=fail smtp.client-ip=40.107.95.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="pX/LnXVb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NkmRMpUYDjdpTpUT0Rm0kTENKTrskdYRQ+whALPaKvqeQSqTgXDWSVWQD1WEh2url/kOKM0OugqaQIIVH3ZWnqTdSLQZYcjeQI2ixmjT+gQvzlEP8gVm0XjlGv9eH19uyIS48FBzo4Ckw+rEh4wrFwv4RKWH3yDMzJuosFY/tL7t4K2DlNOyVuiaTMzGeG9AZtGHUuPV3E6j9wryP4C3wXuE6NYcUYuGL/MKa80/AU3ZHQbNbkKni8W7e+5SbgD+QYKxKuIs2lQLny2WQbXwqf7xhvfpylDaYqsbx1laCULxFnrWEWrm2XZH8qE2e2q8cA8CUBjNyR2N0uFCzWad4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N+XaE8yyWjGIn19TzASAZzj0sYETWpxRAyipXeNBClA=; b=OM+lKST2hXsDoGhqsSsfXyyP+jmTFgUZjGUvfQg3f0Mdq6CWwMtiCwAxvaKl+gg0bBTfsiFCmhdv06GvAw61+eQpHJc0OjBPiD0jW4gXQ4CnrvonmHnpT2lDlHzmd/JDmXJHLymoP5pw9F2IRGrstrJHy5WSNJwlnvCbkurxeGoib2vzw9oTVOdV9VF9Ig3gYHzuhuOuzcURAwh8F1CA3+yuFDXIA1BBiHjQvVtKxGBAmC68eQwsRLTNmteHIixo9n7Dgzw9gEMkrbmW018Gj1PikfcGgq8ViKIApVL3Ap4O6FmpJSIv4/UTSxaaydpHDWsgk46Eg0ZMa1jrjC6Clw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N+XaE8yyWjGIn19TzASAZzj0sYETWpxRAyipXeNBClA=; b=pX/LnXVbEN9MQkjuTzFun+HgQkJk+3osYrtioiZpDPLVFsSTZtne1Wnqh29xI8aqiLWtl8z+JfAGQe8/8YeFJvjRrUfJB2DV8VU8YEqnRfgEEl4mWjGEk4Glw4UHMNHQ3uWnK/2y/pv2qdbNeRijUkMMf1MO8kZhCkgJxOXEhmY= Received: from CH5PR05CA0019.namprd05.prod.outlook.com (2603:10b6:610:1f0::27) by DS7PR12MB5768.namprd12.prod.outlook.com (2603:10b6:8:77::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.17; Mon, 2 Dec 2024 05:51:39 +0000 Received: from CH1PEPF0000AD75.namprd04.prod.outlook.com (2603:10b6:610:1f0:cafe::a) by CH5PR05CA0019.outlook.office365.com (2603:10b6:610:1f0::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Mon, 2 Dec 2024 05:51:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CH1PEPF0000AD75.mail.protection.outlook.com (10.167.244.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Mon, 2 Dec 2024 05:51:39 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 1 Dec 2024 23:51:36 -0600 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello , Armin Wolf Subject: [PATCH v9 07/22] ACPI: platform_profile: Move matching string for new profile out of mutex Date: Sun, 1 Dec 2024 23:50:16 -0600 Message-ID: <20241202055031.8038-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241202055031.8038-1-mario.limonciello@amd.com> References: <20241202055031.8038-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD75:EE_|DS7PR12MB5768:EE_ X-MS-Office365-Filtering-Correlation-Id: b7a27436-31ed-486f-96af-08dd129563ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Vq8rzQdosqePLPHfjnBwnrTOXPY7tIX?= =?utf-8?q?xazjdOsDaGJDHVg1d60QcCoGWzJNFr4K0TsHY4p2cguDMEHjZyF2duQcWEaMC3ciC?= =?utf-8?q?eVRY8oXDrhE1RJ+/Y8Z8KwY8RfE3aKo2IBPyjWXy5h4jnTm75QI/Ydsz6IYudBYe9?= =?utf-8?q?Y94OGW1fAN+1YAktf4jYhT67GcWXhasZy/+upPNyBWgUa0nCbWkBDmQyj+2wg83iV?= =?utf-8?q?YfJByskYMQFn0cdooamaIpXNl+nxfDZ5CnD36+NrL+ZwD/S7PjztRjB5PqLyP35ug?= =?utf-8?q?URhYD+GoI+P9esTJyu5GTYuY3nU8XcwIm3MAHdt1hzHp/h9BTQ3AVZl85BnWBS6bq?= =?utf-8?q?hnAj22tulv/wmu5Cr1FMESTveB8UYt32yhfbAaY3xUpqOPrdALKkquvT6PFpDreJ/?= =?utf-8?q?hj9mGAO8uFix+h3j153K7YEPwAdvUri60wb19/lsKaoQ5+UE2GzWfOM5tnUhBOPQj?= =?utf-8?q?Po/jup5YApUVu+jEL4r8JUpYOSI3Y0CmzBfBlPK60eRaAKfLXR294QPTXcgS5jggD?= =?utf-8?q?ohSYmms49/4d0UYEG8zz7132q5ym0oHIz7Fvhf1SbEx+yn7nD/kQiqNePpFZwe+dM?= =?utf-8?q?nN8Q8e9FUMy7TjfaSZNTY/21lSMERmaaPXnxX8i8eJE6S7m3tF6wOKkj9m2wkmNUl?= =?utf-8?q?NpxzO1cKT0AO7gu74RV8eCxhhgKn+SYYW2K545OIpvy+KOwESYVUfltNII509a7fy?= =?utf-8?q?4tIrqc6AocEPYWNvxRt3yKTWne4vj+1eMGr8ZzUiMosz/VOaYZtCqfKEugYjPxF18?= =?utf-8?q?X/1wp/AKGnBpM07AUebkAXBhSWOvneReK6quzEvK5sGBoAA0nE2xYUug5SJP4eI09?= =?utf-8?q?U7P0c7CPqp/vw4UY+EXcJSgvw62Ssgehsul/kFGVIJB6+9sshF2/WZBfOJEDuYM2z?= =?utf-8?q?U3v6Avh5BRhrGH9WKzQXwSXQfQlyDkcipmzhVuKpIXI1R8XXK8C0HwCXqd86SOyqQ?= =?utf-8?q?HKhjQ/WctEdoywGsGBgYD9O9E6KLjNKWfweKyyqPW70uBy+33R7J7gyXw9iurloCT?= =?utf-8?q?y/Zevb12ljgLrOdUqJQBqw25I8BtWBQ1VQl5uf1xcXQdp9uZ/24Vd6Sr6JupHkY6T?= =?utf-8?q?3meirnGeyUbB9R2fFWxJoOSTFBB8RLhRFn+R29e3Z3psorbmbD4DLwNjYzqbo3ULA?= =?utf-8?q?yYywsblWH08ZU4PGAznCvS553KjIr1yRntBXAYmp0Mr/gVeiqIFTO6YHRetaVaymR?= =?utf-8?q?InaMbb8ueDhG3BYqc8CDghcJ+N+Vfn3fSVcrKSkiwsX/oxHaIRrpO/p2El1oJo1TB?= =?utf-8?q?wOqJu0kJo50qGo5wKGrx4Ds3LpmXZe9skaZy3P/xZsrHbhGpOZgczK9k1kWuE1FUv?= =?utf-8?q?NPb07to7DvsSzMQnzNckKZhXfALF88YbT197tTEki0GZGh1VVctuCVVZ3I+eOfSCk?= =?utf-8?q?bwq9umEXb3W?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2024 05:51:39.1286 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7a27436-31ed-486f-96af-08dd129563ea X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CH1PEPF0000AD75.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5768 Holding the mutex is not necessary while scanning the string passed into platform_profile_store(). Tested-by: Mark Pearson Reviewed-by: Ilpo Järvinen Reviewed-by: Armin Wolf Reviewed-by: Mark Pearson Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 4f5623fc27c09..45ffd85a71dd5 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);