From patchwork Sat Nov 9 04:41:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13869207 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2048.outbound.protection.outlook.com [40.107.94.48]) (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 3D01A14658C; Sat, 9 Nov 2024 04:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731127353; cv=fail; b=WzpOhmfDgDH2gsoxBQteJu+szTF2H32tdpoD4grJ1oJdn1iqR38OcIZBHOh9NjoRv1iCc50aAnfWc1o/4Xb81gLfw93FWzdW8ChNdRqmp/i0eSYV8lJLAGeSvdotN/xqIeRu7YZbIkrjHWfDKuvgaK02HRMkx3vrb/PuUny3Cm8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731127353; c=relaxed/simple; bh=vmgke1hNgi+9jY2YjBI6Ei/XWu/10vuyZ2DT0pBncCY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uoiBBU2pUnd/gse9YD+7XkeMrwlwEpVL0gs4ZiDmyt8fFlqN6ns36As/S/DbrfDaz3K6d0VGDzX41xDgmn1NdBN8sdLst+WKh0h27Ar/ycTjXhixwsX2XRhrWQ96J9XbAw1p87uHdoNQXd7gxPGkiLJ/zVY+wDbwCN9oviascfU= 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=fW4iGcha; arc=fail smtp.client-ip=40.107.94.48 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="fW4iGcha" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VeADo22EtHaZb7IeoQdTC35nX4m4DVRUUZ5S43oKrSOX7tBD2oqIW6uNhwJfIK6Omhx9s+YVLIS8WA0znUUbvcycs9ron6XBQ1e/nLwdRWEVKaPY97qmAocj/RF/9gpHKaMtz05yawD/LREcemYu0pMntDZYKqpWiM91mBwAiO3WhOwjYTXp6HteJURyrt8Kxn9cx2Pi1d6PWO8tNrBhXCcBdlDll/MCqS4UW31eLZh0+YlC2O1eoYFOJ/zIFdiiPwUktyGODg/CJIf+tJNAC9AGoQtX6hSB62R1qNksHroRjX6twThDE69H6cjkpnOQZp3xkyJtKx9QI3xDM2kmdg== 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=2JOepbNXpw+MaowhRv9S0+a5ySr6FY/Rm6BniVYK8xY=; b=XhUx7/lKmWvwO8ckBGXIja7xdR5P0V0rqMfNmzRsnk1Hqop7O4A48jTAYAbYnkBhTBbIxaekIKUyZp9xhoiruUB0uFvHuGbOTVa2vsefWcca5XSAA0PailsFRH8oB5DwcmGiTEJlw2IycspkpNi7ERXpzZ4zVPonSqG3mRdoazJ2TJxg0g3jHFX8Nn7b0+UlkgI7lvtqwA+oHNFFnEDbGvMef98zza6OiSc/8gbC15OJDePXYmk/QsMw5yb9Z10plQAss+jhtk7pOGil/6dva96q8+yxNIzYaTwf/6QGYkN6CkV/gDQPPWXf9XNH9BJ9cdin/Bv6RAJlqNQeCxw/Ww== 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=2JOepbNXpw+MaowhRv9S0+a5ySr6FY/Rm6BniVYK8xY=; b=fW4iGchauHs6ApJwxH4e6nEeUAoi8ZsRZiOg6FrbVYeX9neDR+P2xI2QaiMqEiwuBDxNqVV3Tj38a4opUxnjR1HW1zCXR3qmEiqQfwvTHNSnh9ey1mZfhow2ZErNAmzFYCb5GIgEiKik3FJFyFDh9n3xbhWqKuU6DqoN7F/0vmc= Received: from SN7PR04CA0224.namprd04.prod.outlook.com (2603:10b6:806:127::19) by IA0PR12MB8648.namprd12.prod.outlook.com (2603:10b6:208:486::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.20; Sat, 9 Nov 2024 04:42:29 +0000 Received: from SN1PEPF0002636E.namprd02.prod.outlook.com (2603:10b6:806:127:cafe::23) by SN7PR04CA0224.outlook.office365.com (2603:10b6:806:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.21 via Frontend Transport; Sat, 9 Nov 2024 04:42:29 +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 SN1PEPF0002636E.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8137.17 via Frontend Transport; Sat, 9 Nov 2024 04:42:29 +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; Fri, 8 Nov 2024 22:42:27 -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 v6 07/22] ACPI: platform_profile: Move matching string for new profile out of mutex Date: Fri, 8 Nov 2024 22:41:36 -0600 Message-ID: <20241109044151.29804-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241109044151.29804-1-mario.limonciello@amd.com> References: <20241109044151.29804-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: 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: SN1PEPF0002636E:EE_|IA0PR12MB8648:EE_ X-MS-Office365-Filtering-Correlation-Id: 6680f159-39c2-4474-fda5-08dd0078ead3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?2XmmlKLeVm/9gv0FBSrrRduFBpC/2G5?= =?utf-8?q?tS70aJwFh1dqIv1fU0vIZFj2ZL+UwbyuTofYGcr/BVM+XhTgbYm7JHJe/eToIkgpg?= =?utf-8?q?lM/Xazfww8x3ANSLZnGHOmJGZUnRaiLhKRYkHjLnUXfCipkGMqEebfS4ZW6M7W2UM?= =?utf-8?q?tC5bgHuP+rcIYHTDM+vdd2Q2+e+ImmwPltSQZunPxWY+IbRGBCIUqKS930GgseF7P?= =?utf-8?q?NC4hWnGpzU9eIC2rYYiREPPA6eujOZTUYtYyV0Th2w757AGxDDycsXV+mygwfxRTi?= =?utf-8?q?/nA4/gXXxa7PPFYnHo2sRwpoTTnVfk7ujM/f7VXjefplnhTbBOrMeG6mXVvZqxZVM?= =?utf-8?q?r45LpsIzg6qAElVmvgkX9DEep/DFk75VCnr3sm80OeXON6PKEeFL296k+EiaKJxZe?= =?utf-8?q?usm+h0E4WGaZux+GNFFIj+33pMGZ3509W2s+xoa6V9GS14dCUX52+7lOcbj/TJdmG?= =?utf-8?q?uMQN06HLL1UsJpozqy36ncrdcUlPPU5ubQCp93uDNW91zEI8geDL0//aob3KZI781?= =?utf-8?q?JfUR6ctQwVOfrwn7SEALc43zuEyNnznYdj/QWzpx1wVusoCkW5nRwhMD8VN2Fj5Bv?= =?utf-8?q?9KMbUr8pnpXtJcdEyYRFI/AhVLf+p+IpkExu7dlIoyJjwrvgNcD2hK+QMjLSguECM?= =?utf-8?q?sfD5eHj/SRXWH+Nl+JMJa1jP4QyjxfvOBnkGSceg1vHrv/kMyvsFPUlOevsBuTJUW?= =?utf-8?q?N4DIHHdTxqQSeow8IJiZSfZIYDFFzg+UpFyxMLg66u/LqwiykBSDIRpTyfzQvdEmE?= =?utf-8?q?Hgv8F0ovK5Sklc54gOfDhrvX3zZWuuDndIKeVYEZ+e+ShJM4zPJ6CQO+zetpcDsXp?= =?utf-8?q?kRfGVQ0ApocVLtv1U1yLFi9ID1AbYdeJdGLRur17IT7Cp3fujom3KFUsfS+CNP4zD?= =?utf-8?q?MjmllGAy8fLiZOJdvw3gbccf4F4vJ+i3OgUMzluae0c0J7kV0XSXMSkN+EzbwTH4s?= =?utf-8?q?VreTSfohV3Dz/pMLplSVZSconkBg0dWkfGRWKNj1kMgSLbEO4d4H28XZvP5Dnwgl8?= =?utf-8?q?lbYGnQRyBzWiVICh/t1P3n61TlemvxtOYecNhm7ZRzp+NAGE3AUPJLgBj3ZiL+Qxz?= =?utf-8?q?7NfruRDh+Oy6PnqpHrvwLxYZplsGqGkZA+3oiy9tp9FEVOexzHSN+rTSbp+fULTSf?= =?utf-8?q?+p7vrOvmsJDJsaxDeKDjYPQK1kLiklHmUc56EdIzwrVOCmOTeYOyXI/035eBxZa+e?= =?utf-8?q?K7HVi7TeU9oDW77bMnYJpI9V5qESRsNoNOjqOAeDLbiJvxo4j0BQRHr7VUFxT3uwr?= =?utf-8?q?CE56sFoHGvl30cLhMMYCAyifxOgaFwB9lRLHSctAmTZXwQsgcCnDD7x0dPkb37hg7?= =?utf-8?q?EsWRmj9NJJWPtV5/YdNTKUU5Q67AP/DViw=3D=3D?= 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)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Nov 2024 04:42:29.1534 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6680f159-39c2-4474-fda5-08dd0078ead3 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: SN1PEPF0002636E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8648 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 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);