From patchwork Tue Nov 19 17:17:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13880350 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2053.outbound.protection.outlook.com [40.107.94.53]) (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 0150A1D2B3C; Tue, 19 Nov 2024 17:21:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036878; cv=fail; b=uERnwgBnXDvkMWXFbWHNxjudG7jzxhkTd906O1/JL8EJ6il7zCXvYOi/Z0DkFUmsGOIiz2xnsW78F0+Aww21O+9WsXRVW2oDZykDXXb+Z4gu/FP1etcOYeqaB5vx+YJ0ICvUnsApYBTgWCmv/lnyUdmIkP90qYnQYznTEYvtG3o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036878; 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=huo83eeQO3AHWkBSCP27DJzAt3/3MOdDD1o7xxjo9JcaBX6ZzLFn0WzzL2OmAzmwEHHcHhPHtwI7g5YrbS1v8KJ6KZM16uveJ6TpcUbbLXoOwmcBFmdmfMmrk8KzPjBAf+nB//D6Ttq9fGHpnjW8V7Eji3MjwHtKUqJtvszGCjM= 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=KUrnSnw5; arc=fail smtp.client-ip=40.107.94.53 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="KUrnSnw5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qygAIZ7IyCjqHVLXHTp2vHqSrm0dHvMQDwsNBUsh1sr2+UJDrsXSatPZYFhiUM4eXQpgba6tJEEn8eendGBr3kOiKsOcKZcq4hSzZB3YSBLw15ebP9xpBzSMPnXUjuUA4uSejO9IzhQeYCMXNjpSlzkVwi0it4blenIUiNVHR2yZ8Bw623N2/HcBxvQHgzoJ1YLoN/SXoryLONv5p/iOG46FbBLzTM1M84oL1TO3fxCdUnvKt2w2YobLnYCbEY+DcJvI8qwnKPiB4xTFti+24iUIDByPUxZpXBa8u4Ea+a7bzuJuRVuWEViNyRe5cxwrGkL9Z+gmdAEq3ne05ABqTg== 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=ot92jfqwm+3DYOWGD7X2+aazbF4sAnHBdhdrCd1LnyCWzi30jIW/iva3ts3CcoGmt5mugDrK++mX35yabGAGODXvwf9xySNIoSR9ZrKmu5sdhuJ6exYZVJ5Sdssjulm0uknuYQZJArrkzPzmGtoG+ax1qB5rd9PypC22o89MbfFTzRyI8CpXt20zjRjIEe6CxyFrrWD8DBpSpXc7DTmm1mq0cZFPdImBriBFvAv1xSIVvFL9cl3bwY3OcJrUcgQjOg0GRaoMhR7MLAaI0ygmsBO09Pi7sWCA4WiccaTZ02LGeVClz5ZXEt3c+Qt22h3IKnkpqyg36GeoaianF8Er8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.12) 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=KUrnSnw5SlUZPe7Pzz6Tqvyi7wvFgQUdhtyb4x1IZvcYzKxvhfvpJLzFUwrE/nr9M7GXRjd4JL5+Zg4LJ5NSFA7eSxFueBcAl1w0r3bICW54xcsPUlMjPpVFuarwc/BcysJpqPO8s59Z6NB4F4rQV1fWRiYuzqe4GSOtShzebGg= Received: from PH7PR17CA0048.namprd17.prod.outlook.com (2603:10b6:510:323::11) by PH7PR12MB6908.namprd12.prod.outlook.com (2603:10b6:510:1ba::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Tue, 19 Nov 2024 17:21:11 +0000 Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:510:323:cafe::fd) by PH7PR17CA0048.outlook.office365.com (2603:10b6:510:323::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24 via Frontend Transport; Tue, 19 Nov 2024 17:21:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.12) 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.12 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.12; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.12) by CY4PEPF0000EDD6.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8158.14 via Frontend Transport; Tue, 19 Nov 2024 17:21:11 +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; Tue, 19 Nov 2024 11:21:08 -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 v7 07/22] ACPI: platform_profile: Move matching string for new profile out of mutex Date: Tue, 19 Nov 2024 11:17:24 -0600 Message-ID: <20241119171739.77028-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241119171739.77028-1-mario.limonciello@amd.com> References: <20241119171739.77028-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: CY4PEPF0000EDD6:EE_|PH7PR12MB6908:EE_ X-MS-Office365-Filtering-Correlation-Id: 69ac4448-5c7f-4907-7cda-08dd08be903d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?nnQB+wcrnUbYVf3iDvHSIUIqTVC6/KF?= =?utf-8?q?2oI1KmQm3RYE8Cw3cMmWsWlxZZxMTesUAPvG226+rawMq4s3a5xziW3P3ExncRsum?= =?utf-8?q?X6IYmorono2jYzT6wBvAcXfXP/lsSus73Yq5OcdMv3bQkZHienGmHUWU2bfIn9eWp?= =?utf-8?q?woPUdcVzgoq7KAgMuEQP2MR9m1A9y4YbMbFZ3zFPJ7nSDUqWp2PsXvDzJBCE6Ka9d?= =?utf-8?q?EDGRe88ynyPKnp7urvipk9jiuXIZ0dC7pHSfSxXiO+51txdQGZHpI+gDKpkOa46lD?= =?utf-8?q?XtYrdIVWfVPvbVE2JzMKeSFP6FU32EyekJ4McP3O+ywuOacJ0AjYi0QsvT2jWw71F?= =?utf-8?q?rJNVYNmpbD8RKdzm5dRpb64tne/MOGlIUZAA3RJ4dz39gfeN05EieQ+Peq2rx8Nsk?= =?utf-8?q?J18ks2ybJwk73x/MV1mvzGirFatKMPay+3HbNbriBLT1gkUznVEGlqGuiHi2ZsFZR?= =?utf-8?q?gAIQnU/Hq7FafZnk1lpTnsqOFmNBgU9IGqd4qNTmC4EdJWRlETjP5kOY5+BA5nVUX?= =?utf-8?q?5op5pqm/lTCsG3+Xh+YMnhwZjyvLQlblV3v39mVpUD9oZ8PGq8pFZqrohh6kubrbm?= =?utf-8?q?471GiwwMZmngLTXTsvs+UoyeyfwZZ4QMbbLbyMqnjMPGWEaPYJe2Wp7CEyVepRIs5?= =?utf-8?q?qUmdK1u79d9imLxUE2gfNTu/ERXJuuq/3Tbsgy+y/rz60xxcRmxmQJb0fGP+EuqkH?= =?utf-8?q?GRDwGBLDimGefU5ufNXwEngOPm/laY3VNtaHHnBkgyJi/87UfVE1j8Bbxfx+U1Sms?= =?utf-8?q?iD3KDzCX92MldklMMAlD/KMfs1YfVhXuHlzIf/zkFYpuQHngEdrqaakXCSParZVNC?= =?utf-8?q?OBMx2zyyV5pB53eS0/sf052g8mfYMtLYQh8luIQtl9TlWKwKsEeYhB0RWSfGTWWz7?= =?utf-8?q?1f2gwa/ApcDYQ6h4piU2adwHL9fIXQji0quZAbLgDqXcuGTQCqPnpGa1LJZl2cE6+?= =?utf-8?q?cmbWhWiifoEw1v6Qe5BTRaudZwaJtX431NEXaUneASM5Ejv0NdqADXrypzVUGlr8c?= =?utf-8?q?b8u7FvQdM4LvA/sFHqUW5mndFeEA2w36SLbLIE7QZlDXskNvjkeARhgqrpS5ZM6Ym?= =?utf-8?q?1w+xGUV2jiPb9yDxywBidXKod4Lfn9+icsZU462bg59OUib9fDoAfiQfSPsIJ+7mH?= =?utf-8?q?Fm6r6BgDZtjNv+Y44afZWKUpxmSCIWp9w3FhPZjpfnnqrB77vsycfbK5mPy+PHgqw?= =?utf-8?q?IDi9+I2fsSrvQjJ+y87V6Lnplvdkj2Davn0PXFrg8bDnZs28ZNGR0iMQiEiJH6Wvo?= =?utf-8?q?Wj+zVaYZijbzHbIMDblc0cUINCnAWWRKKLTI244eD5+PfINgUH4d1cqWSbw4XnK3d?= =?utf-8?q?5mDablmGr9GKtkgDxwAsHfZaWyS/vtrDFQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.12;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:atlvpn-bp.amd.com;CAT:NONE;SFS:(13230040)(1800799024)(7416014)(36860700013)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 17:21:11.1516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69ac4448-5c7f-4907-7cda-08dd08be903d 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.12];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000EDD6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6908 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);