Message ID | 20241119171739.77028-9-mario.limonciello@amd.com |
---|---|
State | New |
Headers | show
Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2062.outbound.protection.outlook.com [40.107.92.62]) (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 7DCEE1D27B4; Tue, 19 Nov 2024 17:21:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036879; cv=fail; b=ZZcJpsHRh8cGXhg0GjsrVFst9q1W8uxU3lizVBkFtNY4rjAg4AD81ux3FfQAte6D2slIVXKN/EwTx9KLJs97tK6oKPfaRTPDDHl4GPuqfx2JK14z18ZpdjJm5gitMb65wuGx1gct1fCSdF0KV/XiG554viUzJqW/Vvx0IH2dHH8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732036879; c=relaxed/simple; bh=JewyXTxhFRqy6h34+YKrMpsgMeLgKwlZqckAx0I+7ck=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tDb6+Xi9ci6KFLohI+lYejQJH7VeZnAhjpuHrkzx8Sdeg04z1QVPf35IwjAq4/x1DnSgXhcp8KLsONaHkdLNsjCW/CfiR1TY8swwQeWh/W29d5BzShC3vBAV5Hs7Ph5LVroj6ve7m3lIWLeasw8tzn9o1fr9uvzLvT5Rc7NmBbU= 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=edfjn6gy; arc=fail smtp.client-ip=40.107.92.62 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="edfjn6gy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hUikfqQSy70sVX+2YpY4GE8ND3kaigEJ0BeUz+SCeY3zLGxy2CyhoIjEnzNrazNYoBsor4Yxmg9/fNV5frWpTmSOnG5wIXbW+E7G7mJsSST2Lh6YgTofO906SCl1GZrUGsqnzJu2uLuadLsqmbvWmW8qGKikY3PLA2xfTf2nSYPRlUOVSQkEksUJPF2+67b5FFkTryESzkdtKJqOmBWYsLEp6hpRY5l7fqn8p7TJLs++Hl7RYjeKXTFCfKXRU06cpSnc6/1G5OZah/Dyv4xuNocOUXwTzuenuUs5o7tEHoeDoehXaEGINF3FFbA3gAzzvRxuW9n3JhcamBQIWiQwhw== 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=se/DRSG0jq4mSe3JIlni8+u15VBvik79rcxTvY6iGeE=; b=qh4oE13lfHnjG5ST/HYAaapJDcq5n8FwrbiUJmSXToddL5a7BhrNPRQMmEA+wDcnpSaURV3XEb/JWtPr04+BLDX0u6pwF1HY7phH3MqNGV+7jzL1igE+Q83DinTiN6nhTKgtGppRnThlB7FandwBYBG5msyyPaFvX13VtKn3BVuV0ygWPJKmi0ftyGajwpr9m7e2jRf4rzki47oppMBXhrK6R9mkl+43Cc9dxpKJSoQxYGoQLRpAgrtiV7PUAxIEX5oc3fVLROpvYnCLUdwxSaRnZJYp0fvmW9NlPLFP8xBLu9g9HOF288inFOFLxinZq0Oazixg2gvFf507xoEHAA== 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=se/DRSG0jq4mSe3JIlni8+u15VBvik79rcxTvY6iGeE=; b=edfjn6gy6/zYuhhLkGa1y+/NRlN79wzmD1ZoBvyOryd7MbwLTRAy8HSo7slqCIZeXU/rR+4pvO0ERK7P9HTyF4TSo6FlBkhNkKJkrkxM91i1plbElgQMCsjTC6E04UAvCeHM6Gix5jMKOVUWQ9DJxkUmikyig+cvehTq2MA3ceA= Received: from PH7PR17CA0041.namprd17.prod.outlook.com (2603:10b6:510:323::24) by DM6PR12MB4219.namprd12.prod.outlook.com (2603:10b6:5:217::14) 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:12 +0000 Received: from CY4PEPF0000EDD6.namprd03.prod.outlook.com (2603:10b6:510:323:cafe::32) by PH7PR17CA0041.outlook.office365.com (2603:10b6:510:323::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23 via Frontend Transport; Tue, 19 Nov 2024 17:21:12 +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:09 -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 08/22] ACPI: platform_profile: Use guard(mutex) for register/unregister Date: Tue, 19 Nov 2024 11:17:25 -0600 Message-ID: <20241119171739.77028-9-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: CY4PEPF0000EDD6:EE_|DM6PR12MB4219:EE_ X-MS-Office365-Filtering-Correlation-Id: 976cc9e1-d22b-4d36-4ffd-08dd08be90b2 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?THUgSlGfXQLaydNARwUSfYXWnr/WJjC?= =?utf-8?q?1OM427arTHqTj1k03ZJDUlvm7bOiiQq9/4VZgAHsD5PlQUdFkZJFf0xIdQWk0dYsa?= =?utf-8?q?1EyhstFRHI6PUVAPr7sH7riYUqdGR/Q2Re2I/GkYGFhfll9GtmcvuV+wOQOsOUX/W?= =?utf-8?q?dAJt62bF5EbiGifsI1sIciIMfYQeecI1uSpbptZkrP6gsqpRzgPkmjAhmYUxRKc+z?= =?utf-8?q?y35sZG0Vr/vHcVQAAzY9g9Vu3PstUpbJuQwrjDUsIZkC3qHJ0OgUb1wzVqrCq8srZ?= =?utf-8?q?I/OyzMQOnwyhax++ybbyouEprxBAv2Hp03I3eQWdDDG6VMzRith49u38Yffh0XFIx?= =?utf-8?q?pClXsKw+mEpghDxXRdlKHKAQzW+q8euI7QjcN4/7DtXrdcYlvtrngxsD6I3C1XF2y?= =?utf-8?q?BQ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PPqcdJdR9YXRtWwqwGBBSj6eRQjF0rqMbzEEni8PnLR1ncNSlD?= =?utf-8?q?Vncaft90bFMQmoLs+Bj8bZblLtC+U6AAQQ=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:11.9173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 976cc9e1-d22b-4d36-4ffd-08dd08be90b2 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: DM6PR12MB4219 |
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 45ffd85a71dd5..9729543df6333 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -184,32 +184,26 @@ int platform_profile_register(struct platform_profile_handler *pprof) return -EINVAL; } - mutex_lock(&profile_lock); + guard(mutex)(&profile_lock); /* We can only have one active profile */ - if (cur_profile) { - mutex_unlock(&profile_lock); + if (cur_profile) return -EEXIST; - } err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) { - mutex_unlock(&profile_lock); + if (err) return err; - } cur_profile = pprof; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + guard(mutex)(&profile_lock); - mutex_lock(&profile_lock); + sysfs_remove_group(acpi_kobj, &platform_profile_group); cur_profile = NULL; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove);