From patchwork Fri Dec 6 03:19:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13896360 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2065.outbound.protection.outlook.com [40.107.244.65]) (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 99F0812FB0A; Fri, 6 Dec 2024 03:25:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733455550; cv=fail; b=OIz3WokWUEf6KNQNxbEFT7zEYmpwZcfR5HoX/uQU453SDjRkVV+NqqhJ9wkkr8LGHWOzDLyKVnB0HpDlE2/hPbOpImMKeyNHgy62Mg4hMzy/KCVa44IMzr9u5Q18bm3hZ/7vVbyFn7/zlGevgRbUOW+AJo0gmzULWFV5nuoIPN8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733455550; 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=nTwf2Qb8hY3j7mUAa8pnllu+zNZIQooilvC9HIPYxl16XtVL0UnFlIX/sp8LFYPmA0liwNJ/w6HZfW2ZhM3AMKS7dK7F41WYiJ4SDkk7w+/PJd+gb8F88XrXoo7oWQ/rShwIstx65WoGLOn5Y87GZSZT04YaIVIsW2huL0Of2B0= 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=pcx0vGz2; arc=fail smtp.client-ip=40.107.244.65 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="pcx0vGz2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WhQL+lKXdTUAjpnZwVP1S9uKynPxxRS2TJs33Xps/Npoh7NiEbJaQcLg7T/esbAaP+qqgGu0O9IIvpTujXYYZIiRnDBbZ3J7wNRnanBxzJkkNBdHYvwn6su1XyK990LUsUYWQ7uKxxM66ZKn+3aVO8lFK2sYzFCzzARwIYulbrEJ72Ucs5dLV2+8xGM/2FW9jT3pt3olF5SWvd4YfDOZubWhCYmasAhkhp6j/DXKRqOf4zZyqDgOd8MMRqH+0mvFzAESXYF7aGCdbz6rcEUDE9KLVOBw6y6xQb2umpGSWcADd9u45K/o6T/6jPJSmGCFaCdr7kvNagS3vXA6jW1trg== 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=mKW4rbBA0uHRmTLhxXi2HCjkrFFt1WwUlrKAmzJ0Ws+wN+yvYIYb1bb4YEMuv8EcB9o3AGSwbe1ytqu8xA4qYTNmcqYY3XnOYoN8jF/hI/mpa9OVSi9CeMSZ3ZwhTqZqvWrAqWHqqggTSS693UgmV8WF7dGMo/LGwBtl9qvizxm7ikqgW1gtLp26O1xuXz/5BcOajShc2S4Tgwpr/Ob4Yn9sEIF4Ym5ifYE8I8pcG0ZOX1ldINOuDnOTY5sxLAbVW01zp8Iunx9FNB5E06jS8CORLok5sNQvPXR44ZE/beg5KeagGUrDCN6kPHVQczgM1pGmR2zJZqLDQ5XEytQg+w== 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=pcx0vGz2h7NbW1UacIreB5MdVtA5FAG0tavVKFH+fQ5xh9Y1lYaEPOwf9J5riH95nfCJhIsDYYDOuG6h6i8VeBlKTBorFEXHqMHXol/L5NXWet2n39GGqGZu9P+m1STnKCadPwJDs0JZCm8Fn1l37hhGPF1biOcAtkR8wWQmCdU= Received: from MW4PR04CA0040.namprd04.prod.outlook.com (2603:10b6:303:6a::15) by DS0PR12MB8416.namprd12.prod.outlook.com (2603:10b6:8:ff::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Fri, 6 Dec 2024 03:25:45 +0000 Received: from MWH0EPF000A6734.namprd04.prod.outlook.com (2603:10b6:303:6a:cafe::6a) by MW4PR04CA0040.outlook.office365.com (2603:10b6:303:6a::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Fri, 6 Dec 2024 03:25:45 +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 MWH0EPF000A6734.mail.protection.outlook.com (10.167.249.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Fri, 6 Dec 2024 03:25:45 +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; Thu, 5 Dec 2024 21:24:10 -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 v10 07/22] ACPI: platform_profile: Move matching string for new profile out of mutex Date: Thu, 5 Dec 2024 21:19:03 -0600 Message-ID: <20241206031918.1537-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241206031918.1537-1-mario.limonciello@amd.com> References: <20241206031918.1537-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6734:EE_|DS0PR12MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: 7231f82c-1bd7-4b09-8a0a-08dd15a5abda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?hQ4v23PXC07ektbywLDgFiapwkvDu4J?= =?utf-8?q?tBE0qoGdVQycAhDvya9Z0+MNBxGP8XcKhmQtvFTg7AQHW6KsNFMY+09PrlXhAFRbe?= =?utf-8?q?7l3LOs/7hz7yLlu0Swo/sEUmeWLKbJKJMBo1iMlc5+mOCybg41k98vEnzKnMmcHzF?= =?utf-8?q?p7pCEuCWndiWL5ELV4PDfxRAKyMlSSRnE4ZDM9bjjSxqYmDtb7zD/+buGTx+El4cm?= =?utf-8?q?5OHJRba/jXN9KwPzht5PolWKN1mZM2WeJfPRaVfClLMCoa6saUZUZwads9UnGsZIK?= =?utf-8?q?JEYhHL2QRra4YURB48He9F6+Q+0OD+jta0qgfvzM47/5FHe0WKwpul/SWnb7Zon1/?= =?utf-8?q?uGX7dygTKjF3RAzzzOCes0vCQRadmV4QmpVdjXWjBBt4QQ4TS0XsLXHw106l6rh84?= =?utf-8?q?9WMpzmTqgerXjeSxu9KKrHnggWpcxjOJVHn6uiV6RKAMPQwWXWyVPsa1GvH6VbsFl?= =?utf-8?q?Hp9NTvIvKKgeW+4pOIR3XD9zCzpwdSjgJPKSnax0Hf30607vR5Zy8W5XZI2dhdlRO?= =?utf-8?q?uWiBMkfoHChoew6Ljc5l76+rx9q8uWfn5AYD2g//pNEKShWRsCBpl9QiIE0sqIw4T?= =?utf-8?q?D8R3u8tfTVmVEUcBXcI6p7HcL1E9lBuiWr9f+wtlAS7TeeqrMZSBRDO442fKtrLbi?= =?utf-8?q?a9lFnNNxGHF156QFxLlAnpuSozjYgi3S0/cxOE1V96fED1S2d/XdCI+HyseWBmeY1?= =?utf-8?q?5wT0YqBWMFVzyf/fPvUPYan23W/UFWGeFLEX5d7WsqRa732fstBCrw3Ad0Kj85/vu?= =?utf-8?q?yseNRPlhz39MzEbGWYE1GgO8jzBjrsFN6hfGgKp5ixdSmjqPCEQiPwjW65C6/rUBI?= =?utf-8?q?OA/xztGYaFF6mjrkWhjdv0YEooO0YYNBYIsqJ3yqvvHRf6Rew9nr1lnmwb11hqDup?= =?utf-8?q?Zctt+CievE19rfz/IpJtkrrAwfXRwST8ZnoqrLd/SpSrh/KMdA3Mkt/UvYgwrDDLt?= =?utf-8?q?NVxYfT4ieBrAoGa4lygM9WJ1ORnws/x+03yKl5Bvbzy9jY6y0ORsrGmVj1llg2Zyn?= =?utf-8?q?5x46fjkNyH+azg8FF3JKDqBNSfG5P78EtYXDJ65kRNV/mWyI2SddVCoZH3uAdp2v1?= =?utf-8?q?lAv3c2HsPqVEM3t7oMwhW1oP3qACRfY5K4dh8p3sdtazsxybXlVAmjCQvgI8qABhr?= =?utf-8?q?Sgaqgb3RZTl1vZvGue60Ch9B679KERb1Fxlc+J0IZ0c/c2b55v07AXvFQUC+ZEk2m?= =?utf-8?q?jbkEGDR/A/6ypSCAKj9OxxYM+K+lr61g3uKAcGSI/8K3E2WoR3o/IXlevPKf2i0zV?= =?utf-8?q?r8f+fxXCFed7nnG2J1jLS7OU09AnFvONw9xW+ct8omEfDU2sWpitOVEG73DWRdQL/?= =?utf-8?q?ntFxN1Rz3q959paLQnjrYj/I0wQG4NBuMaFah6400eYJzhF6PJpNngwTPSTV1Cn+D?= =?utf-8?q?jM736z3ZK/S?= 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)(36860700013)(376014)(7416014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 03:25:45.1772 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7231f82c-1bd7-4b09-8a0a-08dd15a5abda 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: MWH0EPF000A6734.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8416 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);