Message ID | 20241119171739.77028-7-mario.limonciello@amd.com |
---|---|
State | Superseded |
Headers | show
Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2072.outbound.protection.outlook.com [40.107.93.72]) (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 255131D2708; Tue, 19 Nov 2024 17:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036877; cv=fail; b=I2CS7hlXA2XadWmrHo1+2Frdxh1qlX3CZlQvhvamr7qnms53q8FkWcqRf6X0gW3S/LzNDcT6192tvMBCkC8nuIaeOKTyXzGNc05vyxnEQU30/NRXOwovtoBBXZzrWuvwtUltwiPMGSPGhBiGpRHc3WUP9j+xJoNRuqQ6olK+zHc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036877; c=relaxed/simple; bh=qxZR0ioXhz7I9mrAT8p2DAj4zP/orxCZ1guCEIlDwcY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Jt56qRUEAnl63xsOCzh+HUWQHopDCNtNsDNZQit93AMD7iZMnhPyK9VsVI6KCiC8u8H0C0XH7NEXHmfD4ZECUh7lzw+rpfQKZtAy8+FulRSZa+iAY6fZAKx22v7zBjzAJXi5nug8ftIXjvIci8n7f3zckDOgyAULc8vLiqk1ASo= 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=uE4qgv67; arc=fail smtp.client-ip=40.107.93.72 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="uE4qgv67" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=W2wylO5jr9tjnFaHHZHHl2IhJHMKm1fO2NG4eJ391VD7qlxQ2W3O6rguP5hHPnPfFy//thiGdYXEPiA+JXz1imW2hMCQefvJQCmpzc8OLrryLFyiTTmCSV8L/vPN8DhV4ELX6I5QDS8LZjFugOoNE46H7aeEwS/a2yst8AdTtBk+rAeYNuvA3eLPMIJ2k9PjO0phnLcaNDaKomZdrwH0b50ulocToP1jsQEX5QO8K8gSMqrn+YXy9YVsHENejC/jbXLrfawJoOM8Tm2VHlpjSrApDbz7zewW2nU/4l1lXT8pDtZ9hpAivVyRnja08qQQhDRk9cIN5wKCMupnzJdPJQ== 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=eb96Rfxdmtyo0JIpdtirBRC/6HMVRjTmHsGHHm4KVnY=; b=EyI3YNO2Z6KchJi9ZGJeNzpv88p44RP6zN41/m9ES4Sbom2gnrweoZbMM72O5cE1pvjdpe9mki90VOZLiVyB1x6bOlo3Po1a2TUjzQByfrHCzUFUBGvOigu1kW6PytIdwkDs//UO1ndjSHq0eT+9CLo1E7puYC2N228HQWnTuHdNvGX7Uocc3saSxgYARrh7LMxLljz28NbAf4LuJeu9mA0EKdjs8U11D3esFvGSECOd/c0mRXHej37mi59JKfY0QJdeRWoAdG9Qx7k5VFmCwRiM2QAGTZUJZDQoGqyQh5SKsPu0l8uuwhO9hWdVbD49RAEI5P6phHLbe6T6iWJYQQ== 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=eb96Rfxdmtyo0JIpdtirBRC/6HMVRjTmHsGHHm4KVnY=; b=uE4qgv678V+t+69Pu6mXQnBJ8mG+hyaokDNHf3tSoXVDOQhCd8uukBHt9L1r32/Wbz8CaSX6AAYaKaVdV11RJ6IJpQjqzmyhLMNEoddF5gGrB9ie70boRQ6vnouftuWTrxJu2Xc+uLNl+OYmKIfS19/lJesn6c+j54UgmKlHGuA= Received: from SJ2PR07CA0022.namprd07.prod.outlook.com (2603:10b6:a03:505::24) by BY5PR12MB4065.namprd12.prod.outlook.com (2603:10b6:a03:202::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.24; Tue, 19 Nov 2024 17:21:11 +0000 Received: from CY4PEPF0000EDD4.namprd03.prod.outlook.com (2603:10b6:a03:505:cafe::18) by SJ2PR07CA0022.outlook.office365.com (2603:10b6:a03:505::24) 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:10 +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 CY4PEPF0000EDD4.mail.protection.outlook.com (10.167.241.200) 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:10 +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:06 -0600 From: Mario Limonciello <mario.limonciello@amd.com> To: Hans de Goede <hdegoede@redhat.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com> CC: "Rafael J . Wysocki" <rafael@kernel.org>, Len Brown <lenb@kernel.org>, Maximilian Luz <luzmaximilian@gmail.com>, Lee Chun-Yi <jlee@suse.com>, "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>, Corentin Chary <corentin.chary@gmail.com>, "Luke D . Jones" <luke@ljones.dev>, Ike Panhc <ike.pan@canonical.com>, Henrique de Moraes Holschuh <hmh@hmh.eng.br>, "Alexis Belmonte" <alexbelm48@gmail.com>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Ai Chao <aichao@kylinos.cn>, Gergo Koteles <soyer@irl.hu>, open list <linux-kernel@vger.kernel.org>, "open list:ACPI" <linux-acpi@vger.kernel.org>, "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" <platform-driver-x86@vger.kernel.org>, "open list:THINKPAD ACPI EXTRAS DRIVER" <ibm-acpi-devel@lists.sourceforge.net>, Mark Pearson <mpearson-lenovo@squebb.ca>, Matthew Schwartz <matthew.schwartz@linux.dev>, Mario Limonciello <mario.limonciello@amd.com>, Armin Wolf <W_Armin@gmx.de> Subject: [PATCH v7 06/22] ACPI: platform_profile: Move sanity check out of the mutex Date: Tue, 19 Nov 2024 11:17:23 -0600 Message-ID: <20241119171739.77028-7-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: linux-acpi@vger.kernel.org List-Id: <linux-acpi.vger.kernel.org> List-Subscribe: <mailto:linux-acpi+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-acpi+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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: CY4PEPF0000EDD4:EE_|BY5PR12MB4065:EE_ X-MS-Office365-Filtering-Correlation-Id: 0dd9ec7a-38fa-46a2-fb33-08dd08be8fef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mRfOITZp+iieJatW1eMJgbzWYEmkkDs?= =?utf-8?q?Ez6zh7N4JB1zFn9Wv/+LDImvby7zpAgG3KD2AefBIGenPdgK9vAoE/WLZzn//7Tg1?= =?utf-8?q?HmtSpjj+FZO3PIaLoezA5T23Gq0TtvU6QXYiLpGu7UMCQ2QoQ8g8tBdb0VVxDaaAl?= =?utf-8?q?iaWpQp79OXe5WjumI1TnMzv0KjBXQ0kcJ77Wo6nor3uUb2WD55zRAdYkjnNcupDFp?= =?utf-8?q?3G6cbW+kyqVX7gGJeTCQBDsJlh0dXKxepAHnhCtZ/3Y9qEj0E7gamspS09Wq9y8qi?= =?utf-8?q?vXefBW05E+6HkmG5LTYkLrA4cClFuTw94E8WE27qmMJLXy/eHsd3KbyqVPPF+2+Wv?= =?utf-8?q?3rZ+GZc4OfRUiC5E1p3G+45SCMRm21Gz5ySqV1lmq+rLHp4nrJ1cPZJ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Tg57sYHF2s2hrE?= =?utf-8?q?S746jNow1vQcsIC6j1g7/HWT0B5i6btcNpV4hilaakILFRsgCj+Eya/LeBytRoYer?= =?utf-8?q?kVcb0CC0ua10+BvwNbabbq2AfAd0O09lmw=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)(376014)(7416014)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2024 17:21:10.5812 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0dd9ec7a-38fa-46a2-fb33-08dd08be8fef 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: CY4PEPF0000EDD4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4065 |
Series |
Add support for binding ACPI platform profile to multiple drivers
|
expand
|
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 927a2f7456c9a..4f5623fc27c09 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -179,6 +179,13 @@ int platform_profile_register(struct platform_profile_handler *pprof) { int err; + /* Sanity check the profile handler */ + if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || + !pprof->profile_set || !pprof->profile_get) { + pr_err("platform_profile: handler is invalid\n"); + return -EINVAL; + } + mutex_lock(&profile_lock); /* We can only have one active profile */ if (cur_profile) { @@ -186,13 +193,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) return -EEXIST; } - /* Sanity check the profile handler field are set */ - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->profile_set || !pprof->profile_get) { - mutex_unlock(&profile_lock); - return -EINVAL; - } - err = sysfs_create_group(acpi_kobj, &platform_profile_group); if (err) { mutex_unlock(&profile_lock);