From patchwork Fri Oct 25 19:30:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851450 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) (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 9BCB81865FC; Fri, 25 Oct 2024 19:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884682; cv=fail; b=mt005x7pZjCZqugqiXLJ+CzggFFZZTZBxQY/SX3g+9nvE5Qfj6NzuLhiM/ZONFhDo7kfK46oWM9yU3DV3dOkSK8ifUg+66tqbOYNmxBJ9iyEO92ZSBCJNkrbdT4ukOmAyCr1SyDsqMQCYOpFUqx5xGCCwfCMtcSpeeRasfmN+F4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884682; c=relaxed/simple; bh=bxJZQQH5u37wsrdZxWT59ikCwcRP1zRdbJjm1wvomuM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CC3guemhoyQMTRxxWM5HdgWdGjyWmrZ0zkOTrzccdKRCMyQwSX/0mMbP5reVKLKy7vGIFwVzmFTB5LqSSFq4827hgGyB3LhCCsgChgmeBbZ5eTsjSYBEFa8ajQxVMb3SjgSDS0PV84JlR4ldlubDNo5ZB9PxIbdyVVXwxSo1Nbc= 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=D+IFjqnx; arc=fail smtp.client-ip=40.107.92.66 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="D+IFjqnx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hYA/ywPEAfX8/lYj7GFxyOPVUsow3+BHsfsy0tQorqEU79uaP9SEwgJVSBzPrKzlALgUL85mptEuR+QVWu8WxIXdcUXC0c2fEtLYgX3NoenzJsbx3N4OB4VrzjeAlkUlCwlskO03+Y13Rm137DLWgB26HS0GFIpYmE5F7ex3kkfjF909yhcmpE1CIRVaOTINpuKTdfZpfQTzf8/4uk6zQmzFhXko2hEGPxid6r7NCEstp1fR5VVmeKIVNiCydFZsd4T1QogL0BPJ+PLw8KmspBSv8rvZzrHiLiPgdElgKttcAxUQ45ajHgH0PE/sMQE+Co2j33lq99m6MXVhw/MNXg== 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=jEIYs8yjfKQCobKxq64NDBeI6kyImPvWvB8magPOI6Q=; b=KScsjUn8/Yrp9H2VqnWBGHE4bd7kEK7opz7YlpaQIaa3sAnz4ebyItecHwsf23s4D1Y35pVMwE2l3NzT+R4QnhYFXiXRvVhODXGxeqFyqxpdmP9JYc/i9L32QWKO83yzJLN7WeyttpILHXXeN6m/BrznhJfp9FPkv69i+qtwPeMptvZIlUjNGR4NhUHpnliO8akUOoTtVAqG4obxbVgE0O45+3bH2Os6HANgRkTEohZ0y0/z059ervai7XOLZfjr11w3OZCrqdZtXLxzH1DZEDYLWaWj8Wv434Dj28z2tPY9pkDpFhDgZogmyQDOxm3Q+VxHCBYKpxpiN+Z+YJEErQ== 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=jEIYs8yjfKQCobKxq64NDBeI6kyImPvWvB8magPOI6Q=; b=D+IFjqnxi14EgRA1xJ1iN/GNR/G3TSk0t6+yzR4qjnekWtX26VquI2Ibh8oRuo/S88RzczNcRIPDzLzB0jnMZ7UY/UTNFQYo/L0Wl9uHOGGne7zuX7og+aynW0b4tiCxRWEQtEtMIMsYAFhkD0V9PQmWO/1Kj27uNLPAoRXuurw= Received: from BN9PR03CA0164.namprd03.prod.outlook.com (2603:10b6:408:f4::19) by MW4PR12MB6753.namprd12.prod.outlook.com (2603:10b6:303:1ec::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 19:31:14 +0000 Received: from BN1PEPF0000468E.namprd05.prod.outlook.com (2603:10b6:408:f4:cafe::fd) by BN9PR03CA0164.outlook.office365.com (2603:10b6:408:f4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Fri, 25 Oct 2024 19:31:13 +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 BN1PEPF0000468E.mail.protection.outlook.com (10.167.243.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:13 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:10 -0500 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 Subject: [PATCH 1/8] ACPI: platform-profile: Add a name member to handlers Date: Fri, 25 Oct 2024 14:30:48 -0500 Message-ID: <20241025193055.2235-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468E:EE_|MW4PR12MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: cc629b13-2ce6-4ad0-3a67-08dcf52b9660 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: JpFq4Ol2mOKt6MQ9aV7snUcmxngxVkP8Rvpo+f2rJN9BLf2hUKh/v0mzdI1VlpXOqBGmiu5nB9qQGlx3/kcQHdXNAl5TpaTfOpZ9BUkyIoyN8T2g5Zreh4rln3dS1jF9fjbgMj7+covgE6vI3fws8Og0ZVJUruCn7Uxg1MalKSaELOaJB0BOnw1SA28hs1RSTGiD0QcZnULpTg5ZP2x3ZkG+qmEVEFiiuVmXiuJVZZha7HyYaVmd41VF09Layu4ZNZr/aLGpsO+1U/4mmKH4v42o4NlwBfa98aNVrB/hMctgdINxtZp3Bn6OQASSxzXZ2LfkXgwkD/2KG2xRyBt/+61vTXjgpRdWUyDp+Z52FavFFfY5jvCHEfk4FifSn3rBmyt3+T4pjVafRIJ2Jj68C0UC0Te+/r9+K2ZbbdzwrUC+S1aDeU74GwSJlJEUnDfzc4q2Td8GUh/Ow9KSS3nkYEHyhAYk92E9tmryiA1Zm5A3+CVnrRgfcNPUDWcZImOgNRRTKotU2/z7hKDSKZHvXVhfJ/J17EG09Q5t48ePnDZXPSvhRGL+MuwCRDYJ+UFSLg3ZvXIBc7Hf9mY7rEdgIZeLkfd3XMOKLYnY5qejkECKBJbmt55DToPLyrGaMQKMVnKAAcZPiy5avDnZZfB4RU4xlT2d4vNtRRkPg6VrUhz4K5oj5awXNJk+Gaj6pSubkRiAQ5LJqg9RiACWhpQ3XLxIMFmcQTBJiyVATdrgFcfW7Qdn2reCZ3tyupwgBEIbu4fN4YzVcTJhxqWZ7QHx7dEwMWx3q6yPbSVBt8THEkwikSZuudy0/w0MEclr41QPTK3tTty1u0BJSO87qdPTah8ITndFTJXwMAH6dZruU2rVIknsAVOn7A95mw7/JgcfB8AzEIWOn0SkYwUn9aDyPUVTuLEyWKbeSbVEJBHQ4Yely24NbgVTY97UEy5XUdyuMBMziC2pGHd7G4jlNw65TxAdzuXO+AXBRQcg4ra5wE94g4F3+l5+qHah08EfOtOicVYfWRjMZbHQc0tETbFM/3pl1GhTQVNTcbTe8jVPtEhOz5PKSDgFFkMtrfmoZe5IlbC9FFNwEgXQanL1nFv0/4Zlhc+9A2Lp54NHu6d+8cpy9MPU/jS6kadlAfuDC4qZvsE+3F2X05rEUN0qZR7RjExc3WQ4nQDTTGDnSuR9nq+kJsiGLNAtFSaXxkdPoVczr/bc57iL9Ch6KRpoIJNin6Fw8unnet901U+lLXTeBASLxyB0PeDCMV/BrnzAWn89VZcMjqyiL9kobKNRtA7+6iI1ws0FynBwAM1/qA7LsRdoRK9KTfiZQwxwL0VLnQDGciqgQGeF1KkTlxwTynYQhSpKdddf6vzJiHl4FMS1+wUvrXhQJNGXoOIeAC6EGZyYtH9fXm5lw+AIINyjhI9bAw== 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)(376014)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:13.4274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc629b13-2ce6-4ad0-3a67-08dcf52b9660 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: BN1PEPF0000468E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6753 In order to prepare for allowing multiple handlers, introduce a name field that can be used to distinguish between different handlers. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Reviewed-by: Lyndon Sanche --- drivers/platform/surface/surface_platform_profile.c | 1 + drivers/platform/x86/acer-wmi.c | 1 + drivers/platform/x86/amd/pmf/sps.c | 1 + drivers/platform/x86/asus-wmi.c | 1 + drivers/platform/x86/dell/dell-pc.c | 1 + drivers/platform/x86/hp/hp-wmi.c | 1 + drivers/platform/x86/ideapad-laptop.c | 1 + drivers/platform/x86/inspur_platform_profile.c | 1 + drivers/platform/x86/thinkpad_acpi.c | 1 + include/linux/platform_profile.h | 1 + 10 files changed, 10 insertions(+) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 3de864bc66108..61aa488a80eb5 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -211,6 +211,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->sdev = sdev; + tpd->handler.name = "Surface Platform Profile"; tpd->handler.profile_get = ssam_platform_profile_get; tpd->handler.profile_set = ssam_platform_profile_set; diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index d09baa3d3d902..53fbc9b4d3df7 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1878,6 +1878,7 @@ static int acer_platform_profile_setup(void) if (quirks->predator_v4) { int err; + platform_profile_handler.name = "acer-wmi"; platform_profile_handler.profile_get = acer_predator_v4_platform_profile_get; platform_profile_handler.profile_set = diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 92f7fb22277dc..e2d0cc92c4396 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -405,6 +405,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) amd_pmf_set_sps_power_limits(dev); } + dev->pprof.name = "amd-pmf"; dev->pprof.profile_get = amd_pmf_profile_get; dev->pprof.profile_set = amd_pmf_profile_set; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 2ccc23b259d3e..c7c104c65a85a 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3910,6 +3910,7 @@ static int platform_profile_setup(struct asus_wmi *asus) dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); + asus->platform_profile_handler.name = "asus-wmi"; asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 972385ca1990b..3cf79e55e3129 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -247,6 +247,7 @@ static int thermal_init(void) thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL); if (!thermal_handler) return -ENOMEM; + thermal_handler->name = "dell-pc"; thermal_handler->profile_get = thermal_platform_profile_get; thermal_handler->profile_set = thermal_platform_profile_set; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 81ccc96ffe40a..26cac73caf2b9 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1624,6 +1624,7 @@ static int thermal_profile_setup(void) set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); } + platform_profile_handler.name = "hp-wmi"; set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 9d8c3f064050e..1f94c14c3b832 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1102,6 +1102,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) mutex_init(&priv->dytc->mutex); + priv->dytc->pprof.name = "ideapad-laptop"; priv->dytc->priv = priv; priv->dytc->pprof.profile_get = dytc_profile_get; priv->dytc->pprof.profile_set = dytc_profile_set; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 8440defa67886..03da2c8cf6789 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -177,6 +177,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); + priv->handler.name = "inspur-wmi"; priv->handler.profile_get = inspur_platform_profile_get; priv->handler.profile_set = inspur_platform_profile_set; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 4c1b0553f8720..c8c316b8507a5 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10549,6 +10549,7 @@ static void dytc_profile_refresh(void) } static struct platform_profile_handler dytc_profile = { + .name = "thinkpad-acpi", .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index f5492ed413f36..6fa988e417428 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -27,6 +27,7 @@ enum platform_profile_option { }; struct platform_profile_handler { + const char *name; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); From patchwork Fri Oct 25 19:30:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851451 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2075.outbound.protection.outlook.com [40.107.93.75]) (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 7A3B920D50E; Fri, 25 Oct 2024 19:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884682; cv=fail; b=N+U8P9ZQQDLx8BS8QR51jLxrCxJbPCr8xdYXvMU5qTk9QEVyQypPFrVZe8eCjeRQRd99gFX7OwnX76cjqUZaRRek8xlhjPp9giSznd+Ko3aa56p9/S7TPMbfgH5DkaFo9d20qioqLi1bVM/vPAb/T32JFaJI6RtyKpsI3Wl6B2I= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884682; c=relaxed/simple; bh=gBsO93LxXLrpSUB0cQo8jB4mNoNxiCoYwvz8YjiIGLY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NXzxMU111tPoxz/sZlejgPSuJzc0lw8mCLpREurIhK4pBfPH1EbpwyQvo2FKd7JaAhNz62U1PRtYgM3SFxVz7Uhefs6b9+S7mDdUUtT8KBFEwkDyzj749sTm01MXcr3F8NEoghgti2oOGWP+NJ+r6XD8mtPTmMOR9ogMDUOwmU0= 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=eh/oAF5Q; arc=fail smtp.client-ip=40.107.93.75 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="eh/oAF5Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NqMlyye4Rk3NcstzZ3560OuB2YA7dHviucqs7GacoaHzJO11mNCUALopGBoCT3OINgn2HUMb42afxuJeQBK1+WLGUwPR/gHkc6A1kCVC3Eg/N2D2VTg4ypAgQMGLYQlPpw7SmoOcdIjyuQm02TxvyBCbYbop3cgr4Js8VzhKzTABE+38TSlhWgK9dVy3U5Q1N1U/cTP37ttWQtqk9mmUKJbQUWmnoNWk9OAt0wdPh/QrOrl4cL2M+XfSNTlNTP9cOhWKnyjTuEeOhiTXtl7B29LTVMybXb7e3nnFUDuS9ivMP1j93Iew6ELx+epnW+/YMMPd8gEnaTo/oi+ZNEAwSQ== 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=JX0zSg9sTkJ1rkpfVbkJvszGd1a2nk8KGfe+WG2+cqU=; b=hswdL73Kgj1iRXrMhtcSbGoPXEYx8EOR44/9wQeAw3JmucXr0BOaEvv/EgcXighbvCmA7MwpGASjym5/SMohZIlzT5GdSU8tpHbfEMD/LIX/aw+hz4vcq0AbE6/QzkEJR8X0GOoCVNB4FG+3l1onbdhNjqHw0kTaR0MIuAtOMu7GFSfOiJkTLgXGjnaYH+DH7DiLm+hIM3286i1WGyjfLIsTb1CyQ5TiEGAhLxNDj8VTxEcFmH2cW2vujZHYmy6ctvLh4XVTLaYrxSiLKVjX1g1/pIg5Ja9Sc9j6RPvCYI5U2wiqR+shtyxXPCqCG6FuIF65sr34iM56jNYlWVF39Q== 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=JX0zSg9sTkJ1rkpfVbkJvszGd1a2nk8KGfe+WG2+cqU=; b=eh/oAF5QgS2osXfQT7vLrg3qqmh+RWkCmO/RCDTGllU5iB3nmGeRNUCFmB+mEjsTpzv3zxkfM9W1px1fkFQHlf2CSTt74X3EdjpjcTYDOmAqTwdM4Ml5AJ4KFZQ5558OHJFDRrg2SObjOrIzz3Ig2XizphegPgNRQM8bXh4kPfE= Received: from BN9PR03CA0173.namprd03.prod.outlook.com (2603:10b6:408:f4::28) by DS0PR12MB7677.namprd12.prod.outlook.com (2603:10b6:8:136::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Fri, 25 Oct 2024 19:31:16 +0000 Received: from BN1PEPF0000468E.namprd05.prod.outlook.com (2603:10b6:408:f4:cafe::9b) by BN9PR03CA0173.outlook.office365.com (2603:10b6:408:f4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20 via Frontend Transport; Fri, 25 Oct 2024 19:31:15 +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 BN1PEPF0000468E.mail.protection.outlook.com (10.167.243.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:15 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:12 -0500 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 Subject: [PATCH 2/8] platform/surface: aggregator: Add platform handler pointer to device Date: Fri, 25 Oct 2024 14:30:49 -0500 Message-ID: <20241025193055.2235-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468E:EE_|DS0PR12MB7677:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f7d86b7-00c6-4f43-a0fa-08dcf52b97ca X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: Ntqk6YsVgvOlUwbkvgQnX10peoi8VO9vAFuX7KVoFQDRIC6ptm2Hc1qmBWO1c6oPbjgSkQ9f5xNPUKP+SetZJK3IChFUfwzVZQcvrhO/1rMoOKtIey85sIXwL7C7NTxOwn0fbxpmiEL0Edbp7Cd45P9W5JPkJmRcJSVNNtKcMSmaS7nRlAtz+7Zz/9jOSyIIcCRmjHuDRgcpbqE68v7xwa73YaAwVg0laHsaYYlmIIrLCfCGlgBSxa7Oq1Diy+0HcCO1y++c5LNEJgO9yfxmQsjdHOGJdxyKTTmgQFpIZF67rYGdwJq4b/+Jq81xi5bQBZ0ONTWql08gayZ2XliXL6oaH8mqR+pM9mCXQdQ8vs+L/kvpnjF4RJ3BWEq2UkePYvB001dp2NUEuICrSxjzY1gBJ79Sx51PqqsWFEgW4GP+SCIPzEFd/PimgsllZWHLDqken997Kky50uyXr2dBAqDe6gxxvXCfI8o95UpL1vpiiZriuzc2zB7eZIwr9p8pqf7ZvW3OhB8kqO2lv1qyLEdQAkQkFl8UjpFlCz8Tb7s6DnnfGbCI21Xe1bkJrbOZM1DmrxvjhM4DX8MuxOxd53Gr5JEwYc6y8SWa8ORGJFAuhsOIHwYHxSF3b3ZbKT8p3/pVLAATeGzBUGorO0yCs/t4akGf42G0HHYDR7JGvSlVFffp2VcPVwlIvL5vAbFe8BSOxbTSwegs/KviO/1OnD4yICZwjX+VJI/luPCIm8LswS5YPokFHA/n0JNeokPK6h2GkAqqa4xXe0arM/0J/Xu2YH1LhZ9tPEEM2g8lZ6rS1xXap+O9MyfvUzvuXSRoI4SbeZGlA8eisH6jo/fLH1+mWpPXbADmalw8A318f0o5UbNcTyraQnx/ZaCn89DrT1BpU0hWWvC18tFZ3ldZ8Svjl6sFI9kYZ27c8WVuHav0mCNL1d69LaF7NRsLWWXh8iYqefs5CyQ3iEfh6a51WyhXhsDlZ/fp9STAPKFTp0wWQu/QEsMZhhkVzxP0rXwAUX5PQpY26nStY3nzqY87txN6JXOARQUqODoaDJ5KWqNCJ6kbtZMMGZe1jfXL55vboF0Ay8kiIJlaoUiZRQwSP4CsMSGgVMRnhsfooQh0ZmnRnR4wPVr6tAGcFtJhRntQ1WK4xyo85zfimNuXhBqhyB1ewz6BmBQGhRW5yv7fooy9u9vDhEMvRoERL7JdShFTXxB7IQqw1H8905UEVOOfihoPa8WEn834NVC7RZ36oBfp73RRnSKQcnK3a7icFvK8Lg5mztu/JiAEPNPm+R/JZB+xXJimxWyxQRckXRrqIO5l8WzGT5RSBe6xt33r6BqSv2xxtr0N+bkBhMbQ+8m2QkFR8otFgs6xVWswm/+HoP573BhptZBD+yYKOV4rYsZLau+y2bC+Pez89y/yaGBK0A== 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)(7416014)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:15.8180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f7d86b7-00c6-4f43-a0fa-08dcf52b97ca 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: BN1PEPF0000468E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7677 To be able to reference the platform handler in remove, add a pointer to `struct ssam_device`. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede --- drivers/platform/surface/surface_platform_profile.c | 1 + include/linux/surface_aggregator/device.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 61aa488a80eb5..958afd7bce223 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -210,6 +210,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) return -ENOMEM; tpd->sdev = sdev; + sdev->tpd = tpd; tpd->handler.name = "Surface Platform Profile"; tpd->handler.profile_get = ssam_platform_profile_get; diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h index 8cd8c38cf3f30..6a72b5bdc8782 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -164,6 +164,7 @@ enum ssam_device_flags { * @dev: Driver model representation of the device. * @ctrl: SSAM controller managing this device. * @uid: UID identifying the device. + * @tpd: Platform profile device data. * @flags: Device state flags, see &enum ssam_device_flags. */ struct ssam_device { @@ -171,6 +172,7 @@ struct ssam_device { struct ssam_controller *ctrl; struct ssam_device_uid uid; + struct ssam_platform_profile_device *tpd; unsigned long flags; }; From patchwork Fri Oct 25 19:30:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851452 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.42]) (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 5519020F3D2; Fri, 25 Oct 2024 19:31:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884685; cv=fail; b=u7NgxTawHiD8vhUZ5+NNcU4hDZ07fjl5DsXb4nDAuLG5aFIK8plnYCQi0RC7tzhUzarAALBQlBbF48YcK/lrIxlO+bgFYaZcWIYhxxFNP0nmfHzP+xKliekAOpyESlGh2sn0E1TcmVakEk2ppH8aCRkGGL34PXBYzoa+1oE+vlo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884685; c=relaxed/simple; bh=hMw6zIo/223jL3dQCUPUm0MdGVoOJfFBye6dEyeROQk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iHj0ahS1M2gXy2zoqdOU7jVqo9ML8MCBP3f+LRj7B/ZbNBMtybAT2yiRieQMNGwjcv5iLh40TLM7pNeLpc4FZgUZnYNOKQLecdo5TRPbB1IMTG8zdkQfWTbU0U9z7YJ+gV5CcIUWMc8VlhUd+xHPoz3KjlhqRzIlwEjHHredV2A= 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=YV3aM4o5; arc=fail smtp.client-ip=40.107.93.42 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="YV3aM4o5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ogJL0RADQIFPuqDif6VbiPlup6pt8GyWE+xfaFwpOa3Og5FQoVq6tu3Q9r0VvIGn2LNWMd31RljM1qVFZg7nQtmnpTWgflGNo5kuoodTxBijYV+WI0uUBVLrSHb/yVFCW1+o1P5OMTNK9rcgRiqDWoaatR+IGqshx3Fig+RQqvdTn096MHEUn7+ndywegpbFpSvVOMGodVTJRXETUF0YdNOQ89asLkzqd/J/E4ruEBSKLQVW12TtSzYRv7VHQvma3Up3g5ZqfYFwU9ILd0q59wAPGuXhWiU9IOxCOyQuGILk3vGS1ei1W1v4jm00vh3cTqgG+90TnGvFAPrT8JGFHA== 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=RUoN55vWEQwotmnObzjKYDkpY0b2UXDFMHUves5KrIQ=; b=BB6GKt6aM9T1/OqbAr/J6g6klpOtavfe22MDvdFz/SCToyBFKGcAQ2Ee8OvEHEJHcY9sx3+0rk6md9zqimLyC+KSBupYmTJV+r2RkFNF67kYAyMa371vSBijIFBNesSC0BJDyqWHUrtlD9F/9ap7915D5FjQ/BqxU42iVWdIYkOBSastsTQX/3TM/iU5IiAh1Igfr1t5qqKk5ElJQgMy3ag6hbHohuAPryZxnLQBwHLl+hbWL5xfTwbqTXbESDi7oll0u/35nRqV7M8+bhpaYrjJTfn1LhA+uv8d4zDo3YFGkEbeMP8GzoFmfrAUUYKerjkBzzgNqRks0xlwHcfI2g== 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=RUoN55vWEQwotmnObzjKYDkpY0b2UXDFMHUves5KrIQ=; b=YV3aM4o5VrdC/tB9J9S3y9uUOSGfpncWM5e8QekyrwI7q32bYUhyHbKq6rrg3R9xr77+GUK2meU5FSFwEGEiOQuU+tHa4XsFpRAX0UCPpiaj2jBjZXbhG3OGOJTxvAjITIDMK+QFHXd3xvP0Z/1vUXqNecPdhvugvxkOJwqwog8= Received: from BN9PR03CA0152.namprd03.prod.outlook.com (2603:10b6:408:f4::7) by SJ0PR12MB6686.namprd12.prod.outlook.com (2603:10b6:a03:479::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 19:31:18 +0000 Received: from BN1PEPF0000468E.namprd05.prod.outlook.com (2603:10b6:408:f4:cafe::6c) by BN9PR03CA0152.outlook.office365.com (2603:10b6:408:f4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Fri, 25 Oct 2024 19:31:18 +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 BN1PEPF0000468E.mail.protection.outlook.com (10.167.243.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:18 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:15 -0500 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 Subject: [PATCH 3/8] ACPI: platform_profile: Add platform handler argument to platform_profile_remove() Date: Fri, 25 Oct 2024 14:30:50 -0500 Message-ID: <20241025193055.2235-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468E:EE_|SJ0PR12MB6686:EE_ X-MS-Office365-Filtering-Correlation-Id: 745ae89e-dedb-46fd-42b3-08dcf52b9930 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: wEPLHtbewqi9F3FRQzaiZbKUPKPMfInISxnrOfjt6Wn+h0bihuyIsXdDYigdv08/yBD3UWClKORdQHLdf6H6I2bLLrrykN34Htn4qfqIBHVVknfp6VHC4+jEeC79hqhx4Zup7bfNeCvM6ZCbWUztJdfCKRmaaw9lbJZScJo0sPA7mRPei1Z6chyy2pUNrMrbGeFj8JRNM/Au4VTSHKVjqQvgHf9qqfnIVlwNYb8hCs0oKzPIOTVGEARfdjrpaNHsZA+aUXZfKCHPMjLFt3mJckF0p8jF1KMmSku5bV8FgcFy+4tAeQbmMt/UybdnLfAQ2SuP3FkCywgMmiWk+8m+S38hCMfGPuCoYh/SRxgzx26Z0dj3286z77hoRyw41IMeP57Pa3jgoYi27vM3Uui5WEppkYJQJpVE3XT66BoANl4ZOH+wukmAEau1jdnFtqJ+xatTgdum6rje6a31mmuznbZlm+b+JBQClU3uBi3TbGhNajgr3djpIfKkFjEFSLnEK4phEqLoaofSjFi7xbWnZVOLp7JZPedxEpsp53lX7BNkwAXQ2qKrmtbWX2DCMd5/dwBIwfi6Le2ztv7mtfLekCq6ohZ4gzSbVPfe141nj8qc9CZzYmCYaTi0Qbhunj8IEYwrH8PvOhiCRkD6DE23aZ6muRBeMX52AvJ/VPGVJ5p5xj8yVtZBu41ecX7lmlkzWJvbxuS7KQdE4UEwe3xBviq317RT+GLHFVi3rXQYZxjtW1B5XnKhITiAYGV0N1z5hClnnnU7JH39uE5HS6RDxjnK3UPPJarkMggoRVC5IGzLCIUWVVM3JVrOK/AfaFEyDaYDgWmjR7XyqYmROMJRU/YhczUoFobl42CT6ikJBJFmWZrYyfLi0tKykwmmfNKqwyYv1HN6b+b25EHvrzaINZkQxBcgVE2Oe5z2Laq1HN3KBsBgXGpwMbm1W3zH9PWuL5dlfCGcJzOcoNhsFl/CR7gc5t7GuomKqsZx6fUXQU5+Nej+9YQRi0883LZcYqaoBbJe/vD9TubjbLDoeQicTm+8Q3CmFlzRbg+UmvOpW5TuxMmXN+mFm8TMRfZRGupjt/fIw+QcrpqR5PhTKhIRbTzUnu6arrI3uSYXaaY++AqsKO3utABdbIuuw3JFhHL6TAI0XIU+8NMd1cE4OwohkI/Nq4EQM2qAh6mlPn0r1Fn/2AygjLCD/L/99Ce88D2ratVXVbtWaFcA48oXSVSgDVUL07awkdL684iqfaVm26PRJb5O02eycV5IYrBiVXRsGqXrpQTvcdhMzsn4TCNPPbSmF6eGJIX4hCM424C/LG92tDQLR7AikgOwckrXkxiFIzSgtwZqINBwgEUd9HY5KoKB58dwmMIIPB9aiLWT8qB38ud2VbUhW6uYFAPFJD7cmiMQ8sPKdfOBZthMaPpCfw== 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)(376014)(7416014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:18.1618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 745ae89e-dedb-46fd-42b3-08dcf52b9930 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: BN1PEPF0000468E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6686 To allow registering and unregistering multiple platform handlers calls to platform_profile_remove() will need to know which handler is to be removed. Add an argument for this. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 2 +- drivers/platform/surface/surface_platform_profile.c | 2 +- drivers/platform/x86/acer-wmi.c | 4 ++-- drivers/platform/x86/amd/pmf/sps.c | 2 +- drivers/platform/x86/asus-wmi.c | 4 ++-- drivers/platform/x86/dell/dell-pc.c | 2 +- drivers/platform/x86/hp/hp-wmi.c | 2 +- drivers/platform/x86/ideapad-laptop.c | 2 +- drivers/platform/x86/inspur_platform_profile.c | 4 +++- drivers/platform/x86/thinkpad_acpi.c | 2 +- include/linux/platform_profile.h | 2 +- 11 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index d2f7fd7743a13..c24744da20916 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -205,7 +205,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) } EXPORT_SYMBOL_GPL(platform_profile_register); -int platform_profile_remove(void) +int platform_profile_remove(struct platform_profile_handler *pprof) { sysfs_remove_group(acpi_kobj, &platform_profile_group); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 958afd7bce223..0879b739c5e8b 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -228,7 +228,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) static void surface_platform_profile_remove(struct ssam_device *sdev) { - platform_profile_remove(); + platform_profile_remove(&sdev->tpd->handler); } static const struct ssam_device_id ssam_platform_profile_match[] = { diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 53fbc9b4d3df7..71761d4220c26 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2546,7 +2546,7 @@ static int acer_platform_probe(struct platform_device *device) error_hwmon: if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); error_platform_profile: acer_rfkill_exit(); error_rfkill: @@ -2569,7 +2569,7 @@ static void acer_platform_remove(struct platform_device *device) acer_rfkill_exit(); if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } #ifdef CONFIG_PM_SLEEP diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index e2d0cc92c4396..cfa88c0c9e594 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -425,5 +425,5 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) void amd_pmf_deinit_sps(struct amd_pmf_dev *dev) { - platform_profile_remove(); + platform_profile_remove(&dev->pprof); } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c7c104c65a85a..f5f8cda7fd19c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -4885,7 +4885,7 @@ static int asus_wmi_add(struct platform_device *pdev) fail_custom_fan_curve: fail_platform_profile_setup: if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); fail_fan_boost_mode: fail_platform: kfree(asus); @@ -4912,7 +4912,7 @@ static void asus_wmi_remove(struct platform_device *device) asus_wmi_battery_exit(asus); if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); kfree(asus); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 3cf79e55e3129..4196154cc37d9 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -273,7 +273,7 @@ static int thermal_init(void) static void thermal_cleanup(void) { if (thermal_handler) { - platform_profile_remove(); + platform_profile_remove(thermal_handler); kfree(thermal_handler); } } diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 26cac73caf2b9..bb8771d8b5cd8 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1692,7 +1692,7 @@ static void __exit hp_wmi_bios_remove(struct platform_device *device) } if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } static int hp_wmi_resume_handler(struct device *device) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 1f94c14c3b832..50819ac919e87 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1135,7 +1135,7 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv) if (!priv->dytc) return; - platform_profile_remove(); + platform_profile_remove(&priv->dytc->pprof); mutex_destroy(&priv->dytc->mutex); kfree(priv->dytc); diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 03da2c8cf6789..f6bc5ca9da91d 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -190,7 +190,9 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) static void inspur_wmi_remove(struct wmi_device *wdev) { - platform_profile_remove(); + struct inspur_wmi_priv *priv; + priv = dev_get_drvdata(&wdev->dev); + platform_profile_remove(&priv->handler); } static const struct wmi_device_id inspur_wmi_id_table[] = { diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c8c316b8507a5..619a4db74e5f3 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10637,7 +10637,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) static void dytc_profile_exit(void) { - platform_profile_remove(); + platform_profile_remove(&dytc_profile); } static struct ibm_struct dytc_profile_driver_data = { diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 6fa988e417428..58279b76d740e 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -36,7 +36,7 @@ struct platform_profile_handler { }; int platform_profile_register(struct platform_profile_handler *pprof); -int platform_profile_remove(void); +int platform_profile_remove(struct platform_profile_handler *pprof); int platform_profile_cycle(void); void platform_profile_notify(void); From patchwork Fri Oct 25 19:30:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851453 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2089.outbound.protection.outlook.com [40.107.95.89]) (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 B18A8214423; Fri, 25 Oct 2024 19:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884690; cv=fail; b=jkoZRyKMTSNv5sAPLAuMxckdfdAltv9jxs5p5QFpiwcDSL6Ev2wk37h+76pm+0dzFC4jqWqOyN7r0RJF7Zg5zOpWnQINh+A/69o92XLREzoe02oi/OhzLe9i/dzzVVilXpPirB3g7Mv8Y92SIWaWGfkk+AAjoSteUotjpgKay0E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884690; c=relaxed/simple; bh=dIJb0QFhBgrm5zW8lPzoo3mcj7ROXAuZgMmOQH2hFwQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mOV3s9DdStJ4WvNFpqWK6ujGDxtvlJVq1X9j879SWZlDzbvI/vpee1sNOP4xRI1wZc6+7i74wYbA9sKzBKfZyF03QAzZgzT8GXfiSWhrZKfouW1Vyi2R+dgzQxmSehRqGIipHxKLDAK3WZ6hCS5c9dGHKbgzJ3eJfKRU/fwysl0= 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=Bx11NF0g; arc=fail smtp.client-ip=40.107.95.89 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="Bx11NF0g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DOhXHAZbw7RnNU+nOP6+bAukBlbyTFv/pBw6ZS7nFGzOxrsm5k2cyZ2Ys2gggaWZzri2G+5T2y9VztsyBI59vSk2qOklh3JEqddWl7bTYQlIE9N82F7ggLsYBS9W3WOkDBxY5IfjLqG9iq2EndPJhsuFNw0Cpq77cxmDHf3I/glIGY54qFmuD9ouwkJcKp0GgdDaTi7E7SctUMqhZI9f4l3n4ywl8YvCV0DRa7SYAPYbzTqtZZvLhOFXQNvSg883ErQrbkzrdnhErPJd36cMCDAv1gkQO8Se8BKY8MZ18nI/A2kTeHCIKTuBsN/89QsD9dprHu0FDZoXajQBJvM9fA== 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=Zr7QLpTwdIcmp3ofgNzIY9Zzj7NcyKmHo1AdKkpWMSw=; b=svhcJPUN6TVtgUk07hOTy1TYVj8PeYxpEFkPY6L+rs3/LZxQoh7uNeWcP31x3OVXA7vhU4GzQ8pGlPq3q1/yNN2Dlbjw/WG2De6U1NiV+10lxhC9po3SF6GRC3G4l8Ya3Vg/he6wtlUCYArN8Vt+SADsvh6nsmPF0YMkrQorhzzs1cresuUUcrzohlFoYBFp++7bWnxnvOFQxNpREsBxBMIbr46uXRiI12N1Io3eIBKQ2ewNAcsKIbE74DKxVngwqifxw7m9nUHCye9T6fOm0GoPVt4xLxc53NWlLMYbV8FJFqJaN9drH5cz31F9Xp/JhJSTJeqCvgDuq6doAlKbAA== 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=Zr7QLpTwdIcmp3ofgNzIY9Zzj7NcyKmHo1AdKkpWMSw=; b=Bx11NF0gOYn2jUK4sO7sgIo2MOCfcUzY2hhR8fZjdfnb8I0xmiAsn/JTaytjUTU6wSSrkUqksOlv6EB5NDHutZzrpLde7mSI89glzUovB+IQqTZ1b2vUeDz9F2ysrK/LgCqoCBQ517FLKB1NZpC01vomlK0BO1wJrsVfDKio8Pw= Received: from BL1PR13CA0237.namprd13.prod.outlook.com (2603:10b6:208:2bf::32) by PH7PR12MB6955.namprd12.prod.outlook.com (2603:10b6:510:1b8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 19:31:20 +0000 Received: from BN1PEPF0000468D.namprd05.prod.outlook.com (2603:10b6:208:2bf:cafe::87) by BL1PR13CA0237.outlook.office365.com (2603:10b6:208:2bf::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.9 via Frontend Transport; Fri, 25 Oct 2024 19:31:20 +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 BN1PEPF0000468D.mail.protection.outlook.com (10.167.243.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:20 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:17 -0500 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 Subject: [PATCH 4/8] ACPI: platform_profile: Add a list to platform profile handler Date: Fri, 25 Oct 2024 14:30:51 -0500 Message-ID: <20241025193055.2235-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468D:EE_|PH7PR12MB6955:EE_ X-MS-Office365-Filtering-Correlation-Id: 841f7e13-03fd-4e19-126d-08dcf52b9a78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: qUspQmn29qbPWoOSO5VY5XrrgGqde9e7upGjSKvYWXvr4Cru2ItzZjO7RWhfvu5yQ8X2WtJPR2h+zQsRwaVlX0RQ/N2mpUNGukoXDY3gwBfbm8j/pPXGkDZnjDfbV6MGgHB08CfR9wV+Asq6+w8S4fFSMs/aqrZx2AFl9GurzJa2Smaki07hkgf3b+kUzLgFbm+bonlD0tkr/dNOhwikF6zXKJJrzJjE5L8blRvXJMdHH6Fp3K5xGeGv9coiMtD5I6b3l4BOeaAvbP9fhg8AgJROotT342JVmMB51kAyGLa+QVm5FrQI2QdCtB4sUsVadS2gMtxBFqAEmYaWmzYWptJy40yHDJPZKdfnH2pBk4nJBlW64Ip8QMMYL4XHxr5auvAn8yK314BzR5c8rEA8QE1E21w/g/38Ixq2q5/ltJxoKdilYZwqfj5U5eI5lO4plBhX6cy1qIdguFt8XIRap1JEnziC0fMusK1gt0ttLZRje7JXQvNvp+4p0E0t66NjeRrQ4nvaOhKrFvb5DlvQrvvOolpo16co9/z63vkU8RfcQJQkGCoDHA6CuXxf2tRtPV8azGR9wnCWyird9NPuVb5Sw8Ul0DpjsUs4Z+UOdqg4lKE5E1/MA0HHeDzrHMfnqtEtSNDRQkJIJZMH+UowNIBlJbF9ZKKyve4/7kkL3whE17VioeHUaDAZApBSmGcZLAI2QV2fc57zryF9CwWGF0dqams06LCTHRGR+ol6H3mV//H6n2DaF1p3xkZyqYpKgj2sPH48JeY7QDDjNS+b2frVWBFP+aRXKI55VpHQZk6VZvqeg20E3za2TVaA8MDo1dPa68oLUXVhhsfXNfzL0kbqgVpxIWm4kDHMfgl/CsJ+TVdLxbhIC3P3wq0duxqBtVLaOdXN6uyMjWlM88JLoPG8QG/uytREBZK/KuBUAOHyusB9e7cIpF58zyYcnAux17UZnSoH5P88aDsUF/3DPF+JfVQWGaGq3knwUlLdoXvNErXQGwVYBkcekmegHz2Zh8vIzza5p5N96duSf/Aya4suZbOJ/oFkCWGLjYzxQHcroeuNngRVXp+7OxEfFQX5U5C+RcCF43GB8eULR5G7wSq7njSiuRxaB2t1Rdmx0l/e9Au1Fy4htxE3/GrjVhlksbq0fiVMt7taQKt8W+xKJyPw82othEw1V/GYcS9c5tHqcnhwwRNDUxcdzve61VQEZkqD9PY9Z01Bf2yK0/iZEdkNrfW7gX5BVs6oSM34w1gHoSef3qXgON4PkgNy4IGxnKkNCpcPJ3CcVN6ZflOx+sZxmTWdMhL3wcEvinPvmyiAMgM5ARI2WZezdXi8vK5arXGGCM7e/3fXa0ngAX+RsKjWGp4VnNHHVHjCmydIO1+ZFauUjtbH+rtTTMKLMGSSD+f20Y/PFBWXmk+D3GfWpg== 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)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:20.3101 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 841f7e13-03fd-4e19-126d-08dcf52b9a78 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: BN1PEPF0000468D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6955 In order to prepare for having support for multiple platform handlers a list will be needed to iterate over them for various platform profile handler calls. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 5 ++++- include/linux/platform_profile.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index c24744da20916..0c60fc970b6e8 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,6 +10,7 @@ #include static struct platform_profile_handler *cur_profile; +static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = { @@ -198,6 +199,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) mutex_unlock(&profile_lock); return err; } + list_add_tail(&pprof->list, &platform_profile_handler_list); cur_profile = pprof; mutex_unlock(&profile_lock); @@ -207,8 +209,9 @@ EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + list_del(&pprof->list); + sysfs_remove_group(acpi_kobj, &platform_profile_group); mutex_lock(&profile_lock); cur_profile = NULL; mutex_unlock(&profile_lock); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 58279b76d740e..9ded63a9ae6f1 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -29,6 +29,7 @@ enum platform_profile_option { struct platform_profile_handler { const char *name; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; + struct list_head list; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); int (*profile_set)(struct platform_profile_handler *pprof, From patchwork Fri Oct 25 19:30:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851454 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2075.outbound.protection.outlook.com [40.107.236.75]) (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 AD50D214422; Fri, 25 Oct 2024 19:31:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884691; cv=fail; b=W+Fd2EqmXtbwf94bsq7F3IHbOjC5B00SpTA6qcIc1BWG2kGMSXkEcO83Wi4IajMPbpsuiok1t5dlXAGu6olHjRdoxZkhiGNgcPKv9hrHdboF9cLYq5zFj1TEE2Bnx2PQ7XIlTLMcoKzXIDvTyLpro1D4CBK+3rQf1cciHkHY2U0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884691; c=relaxed/simple; bh=spV1oWSxaiP0iUMve5lU/g7LPNUjsrqoRF2gYjL4k7Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uWpUBoK8Wbp9AmSFY6LccXuWHfYddiHuckLHSvXEnQhzKRmOyi3u7sBYtr3cfvrsYN97Wi62D0YB61mn+sP+JIogs6O/U9axJjujlnoJ39Ro1f0PyWtYA2zb4x22UcM9cKHId2egAAt21mippUT3i18pFLWkOUYcFHHiIaZYYgo= 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=v0tZ1mBW; arc=fail smtp.client-ip=40.107.236.75 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="v0tZ1mBW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XIsC88F6b9ITFFQpE8UIjJk9HJs4AJuTgBcmSpWctQ9HGm223z2hv7i5YDpXiN1VmeQrPn0bijApifgruj66fdqmxSQ1oAU6T36aV0LuUcAH6A8P1JgXM3jccFp+Wfnd7koLhZEeaS8C4TWI0gZQX5q9D4SHk93Ci49TAvgjQuKXJ+pSKk5K7FrSIq6gv8817IjoIquwXlaQ6u9IgpeDYzj1AnC/ieJ6U8Yt6dCMaI50RDdApD7ban+PfGR39VzpOJtfp5CJWi6ot8OKVMbwIrOF8a/m2Be9lwrJ7XPSMGGjdJiyJGW8nbgBbnhlPQ8xUFmf/tZnJh3ncR1/J6/0Mw== 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=3c+zXUlBJmPUTl8NDGPU+lL5c162ZcPznfGyvRoHpRs=; b=FsUaRUI/fHkNPiRFTkVnb9wy0r90S4PeYXArnew/14f+B3xby+htUNdKDqhhHap/96u0gmi0HztzcB+0T7k+djmKbSR0AvvsCVKtGqrRVgW8tCMbH1CrZuayJfujH0SZcrNkkYgIsifeE9AT9X2GjBH2tKD161A2zEdRR187//1OqpOYjVN1FEjKjPHR5oy1Z5xZZJZSG0WjgzxrJUpmAcJO+wFuT3w5XqF7bFgnFE4QT8QTmWUhaIzwmGddgLc7oZYgNaUV5vcEGcmUjQqHe2BwNccIkhGClZuxuYBICl1GQfrA/6xzrPwcstiVPAywco3wu1Y0IYwFTT8oW/MrjA== 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=3c+zXUlBJmPUTl8NDGPU+lL5c162ZcPznfGyvRoHpRs=; b=v0tZ1mBWZeROccxGynmy2F7GfwRDxdG9horu+E9Bzgnt0tTRb6FrabhHh6ahyHpXf5AhrT/Kd2bGpWgr+SaEwnhRSrRrutca8OnFZ6+2pi7U6Xij32KTODm+6yBdLrB8rXPMFzCqHAUb10D69CWX3tpenxq1XR+GRWo7+7HT5O8= Received: from BL0PR02CA0094.namprd02.prod.outlook.com (2603:10b6:208:51::35) by SN7PR12MB6930.namprd12.prod.outlook.com (2603:10b6:806:262::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 19:31:23 +0000 Received: from BN1PEPF0000468B.namprd05.prod.outlook.com (2603:10b6:208:51:cafe::3f) by BL0PR02CA0094.outlook.office365.com (2603:10b6:208:51::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20 via Frontend Transport; Fri, 25 Oct 2024 19:31:22 +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 BN1PEPF0000468B.mail.protection.outlook.com (10.167.243.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:22 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:19 -0500 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 Subject: [PATCH 5/8] ACPI: platform_profile: Use guard(mutex) for register/unregister Date: Fri, 25 Oct 2024 14:30:52 -0500 Message-ID: <20241025193055.2235-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468B:EE_|SN7PR12MB6930:EE_ X-MS-Office365-Filtering-Correlation-Id: 4af54f72-5c31-4739-670f-08dcf52b9bdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: OLSds4KUzU672NLEslTlQiM/rP3ak+jzbf6OBENgsqqe9nS5KLMqGaNxYHp/1BSiS33gzc+MDcxDvk3EDuDymqFZaHS5F/wVJZLvQ7esunim7UY0BfnwLtNjOwBD/RRJrueSoImoC1pZDiuYf1r5OoR+5Dx7qSDZoXKXwJsc2Mp2m1ZOej9HdoML8vZ0GLk2PemIqvub2FG/vTRQymW7wQbe1peZV9LHG++64Shp/tuhYug/MVtZfP5HBFXWmvKcHNwzi0axsPQNLEi8jQO4tVIZ6kVfVwKY5fTCrv5t6BgMvMuEmtqGAH/t4eFgYumC5Cias+j1XQMFsBBInd4jkiQKb7PyZOkXpu0z+yiVesAXqfFn+npeBDtR8M4vLesty85w5EKxsSbZFY62DzHgNVXk+r3IWTigDQomNR3qCxUMa0lL9WsAUBG/Ebw0VJDE6C5tGrBKuZGT034AeDKerYEa153PyHkAncRH7cVzImTeCb88lpm6vdiqrJaHc82ba3ZEu/0K91lUSCb82gvuF5WojuVR0gPKc4OH3xwH+ewpdt1REwc3zlseRBl6i3zHe5IJl/Pvl2gSENgRYcvoA9i1zzb+1yKWJo6nDJvAfcp7/K8sIAvY6ZhHah9JU0B1ZGoSU4kJ2GH02/Upk9/UOzE2+56Y31pXd3wCBtHOkP3bulfK0pttzDIM4KkPo/iiU2s+4EC3eQUgqnX2wpwl9BC2u18n88OEG4rYmo3xtrg59x3CU5KXcLeyraAjOBm1gr9tk/rHHlhPCf4S5CeLGTlz2Sh92JeX4marZiNE6kIvesokU7J5R18Dlp0p4Not9PViwxf4ZVMFWZaXP7Y31kvFoOlyTVDWA1rrUD1ogp+AqqDhgpDv/h+npe4T+jPw2BMXEdNh7ikTpVuAxsRxLA/XE21T8iKyOcRLH26ynhBllE834+xwe81+yjeeSDodYCrhqGRw7xHC4dxgm4mKc3gbKcPXxF3SyiSYW4xxK7eWkOSPKCbJy/TAn1YR/i7N15Y78JGdBEFQuN/pjQnX/USfb49hY4Fbr73xPItcnrivaFBn06FjA664v8qMbHVscOljEQEdscr1QJDf3io3prpZw74Abpc3h8PoyIPbXoGO549o4mjrgSUO0DQnmIckWMmDlEKExOHXjk0J1SHq3eHFyJHEJ6j13PKwUHe8oeM/mmp1ZXMnSSjtaII6z0Trqw1oE4IwSB8x5ARJDWnO+zRsfqKF1ivyr57DxyRnyBfSALlx5Qt05JW2OfKgDHwOV6wgVqme4rM8/IUh2OGk0b0oi9xkzx/fGD895xZvQFT9SQyFsA9swprGnXknTDK9wNaBiV04I+s9rwgu/i/Q1dJg8Xv3IgVke0xnChs/9cRmNMCYPE+2geHYti3EG9woN0ANxxR1W8Q9wD3lPlGYRQ== 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)(7416014)(376014)(36860700013)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:22.6388 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4af54f72-5c31-4739-670f-08dcf52b9bdb 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: BN1PEPF0000468B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6930 guard(mutex) can be used to automatically release mutexes when going out of scope. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 0c60fc970b6e8..81928adccfade 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -180,41 +180,34 @@ int platform_profile_register(struct platform_profile_handler *pprof) { int err; - 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; - } /* 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); + !pprof->profile_set || !pprof->profile_get) return -EINVAL; - } err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) { - mutex_unlock(&profile_lock); + if (err) return err; - } list_add_tail(&pprof->list, &platform_profile_handler_list); cur_profile = pprof; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { + guard(mutex)(&profile_lock); + list_del(&pprof->list); sysfs_remove_group(acpi_kobj, &platform_profile_group); - mutex_lock(&profile_lock); cur_profile = NULL; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); From patchwork Fri Oct 25 19:30:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851455 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2082.outbound.protection.outlook.com [40.107.220.82]) (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 20A80214427; Fri, 25 Oct 2024 19:31:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884692; cv=fail; b=Ewvx2ixcDETztCpMV8Reo69NNUSZ5t1FW5eqS6vt2/tWFL1yCsPVqcurhGc3ZlwCa2Ypp4vW34VshsXK0hgfrKlhGaypWkvMb+To+jIZ6mBDVaM9onSHSZH8jfSBvko9OhF3TDVCTV22sF7v1MtQLrRlfe11yuvAq6X7gSAA4K0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884692; c=relaxed/simple; bh=k/ANqFqNEwWa5R2ML/JsuMGBll6V454USlLRd2ET8Uw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t1gbIlNL2+mrQbOZxCRcEJTzEChDfrfnD80IbuIJiA6RNBEyQ19HpwB859Fs2BX4+OQlD54PWSJpi4yM/ucrs6meA208IXrFf8OAPMUIokhbWNc6xp6P5Z6VoS0UJt3WWlqdi24+Z32fE8p8ylqHFNP9QUFhCQQfLK5zEU0+Wt4= 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=WmyuSHN/; arc=fail smtp.client-ip=40.107.220.82 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="WmyuSHN/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lug6okoZi58DWxp6/2GAWt1uN4MDNhycP5up9FN+FkdumMcyeTdR8fciWM0V/6rjO8GGN7EqGE0/0iJ3Ml6orvMYPZ3r1VCp4NS5nIF3L6PnfF046rIH5fUAdlpjpFnxTCrGas34SbRRP/3JwiTCfhdNdi3QaFt0AN/hy5vLJT/HFIDRTA6KWfuEetPFk4qtoEhyHuoTc1wAyv2ax95It6mJZyDrr9Me9EU7ATD0jHzSdXDiHHYyKhTo0x85w3iCBPCkRuARegj6og0/tYPDdW0i/jQtR6rZZ+YSpuC6n2FD8dWC+v3chiTodlzVFyBX9dwC9hAQlSQfxBWp1y0I7A== 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=OI4g1QYxLoaoVfoLJKM4B0sPq2gWIRwShicRPPMw/d8=; b=FJ6BFCFSTDJxj5y7BsXf/osHvyesP4hyH3a6Isv7Voxp91M7kAh8mJ86TN+tLSynezj03FhGhUTQxHAW3+aWCOZpMso9j/h5v73aKzjDg2tNLh2JNNvCnQpDA1qMDZoOVr3WoliGOOqRvxwZTbNFwWgIuYLNsLTbiG9X9gB9oVi0ocaqaxsbivMRN5XaqrVBc8TJ2lrmgfZ+CxsV7PpDI7DGKOT5r7sqk2YP6Ej7p6bqiTmkA1sIXZosYmF1H84kXoFVpCCmh//cmKcOdci9LQNpjaNwtNO9HxLpHdhixjOBp31gBUgHJ5vQA/EdVnAeq7Gl/14ZbQxMKK5xd3mx0g== 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=OI4g1QYxLoaoVfoLJKM4B0sPq2gWIRwShicRPPMw/d8=; b=WmyuSHN/MYnqSnFtzpZJpltLMcC2w8Qd0uv/uiEbNkpS/Y90Icw7O0HPm6YeJKk2PwvbgmIiOwMrZ1LK2sCULaEbZ0impe8HZrevGMe8U2IXm0irVfiNb1L7+qHQouVIrcOIfdD74EkbRoHV+SI8p0CWAI+JgkTsMER8Ig3yttY= Received: from BL6PEPF00016418.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:7) by IA0PR12MB9047.namprd12.prod.outlook.com (2603:10b6:208:402::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Fri, 25 Oct 2024 19:31:25 +0000 Received: from BN1PEPF0000468A.namprd05.prod.outlook.com (2a01:111:f403:c803::3) by BL6PEPF00016418.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.24 via Frontend Transport; Fri, 25 Oct 2024 19:31:24 +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 BN1PEPF0000468A.mail.protection.outlook.com (10.167.243.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:24 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:21 -0500 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 Subject: [PATCH 6/8] ACPI: platform_profile: Only remove group when no more handler registered Date: Fri, 25 Oct 2024 14:30:53 -0500 Message-ID: <20241025193055.2235-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF0000468A:EE_|IA0PR12MB9047:EE_ X-MS-Office365-Filtering-Correlation-Id: 4ef99606-3026-4fc3-b790-08dcf52b9d2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: 5xjng2U4MHVH0zv1hVTPKSonS6Vzc5kujFoS85UCvjiQPqicTBhg4Zi7H2IB8bC5DYKpauCc+ijP4bPXj9u/HfVlTECrxvk1CsUVsDurZi8EQal5Oqq7QVV0JFZkysR0XSHS9iC5fFXqg/crchiobCUwQtZTrsFYSPjakymq9/rTVEaNMonNj8SV4Xx4qrON0zYLtH7OU5vUmcJKxoE6m3z5filBDIuwE6Whqn3++w8wYNFn3RiNQ3+WJ2npF8xESWhvLDjtlEvuGvDzHXt5EQa5rOtPngvp4MhOcedeqT+ChP2c08ToTOG63CZCzdyn07xRZ3OSrRajMJZdIu+JWW6gzlej9FM34DPiYxhPCwIoBarIWO1ai/2658jfEo3qU5ZnYRu1mCl/bQ2IGzPoGAMoc30Xzy5awxEL6x4KdOm7YlZANwh21o+7EEYalrz8N6MMUIVICLOzQflw+fyI+H6sjxBPL8VF5tsWb84jVXW0Y3SEYPceCBJbTWYxta4c3IhdzEFOLcH2aBqhwIarUOBFFz3w7xH3KOWkgWdtbIBMxjS+RNErovmxn6XcHN/lAOgRVH3vmp7w9NIbZfaF4IabQHOP49nPIDYfIkQLjy4ihCeaOC4sptV3XcdoZ/Prv8bsoQZXDyPOQ9mq82E1ElqDchZdwcyAWGtIhU5VUPgIz2w0zHNdydveFdY6wJ1/Y5MGQSQnRMbylwR+WSvAKC/BGvUaPzk2uzxq9733pYfZI4wabI0Md0Gwzn9I1vfJVJf15Om90a9gqUvZ71knnN6X08cF+qeycR6J/OZ4qp/qiAjIAS3AL8wit5zn8ydOmsokMTnC33bxbLHRwnxyY4hng00Oy4ny50D53PhES+2rfuJRTKvd6BMhNyQ9r9cIfsYCFOo6XWqNIEc3U7rmxZEPOwRBTt/nyY3/pNAXD2UWvwUzmJ2bs0XFdicXVOnlnHy10RQOVFSuPggzbPl5/S1fI7xALM52sgZ5HpJgZTHIOSeKupNTVMucqjtUCwz+2gKZ+TyCyt7/+5h/5zJadNhKOy+6bS7hSi+xJTyY88k0ZKXs4qbHABshZup4eAbmmVkID823ZZkP5TJ8ZxBvDQ5Uqw8hU0Xi354pLOLTmPMnSRlB7Vidj9oePVoXACrVBUixbAmDlFT3M0qUOw/FkXDGWzd8MEoM/NOH1915y1aNdxsJiloBLrTFYgcjQB9G1xDiq/vaUaV1ZWEv5ELvR3OHC1Aff5rH9WbTUeRKHK4ZfAzkQv38hmiBYPDsVHsMQxHDE21P8dVDQ1OGGrCVapiKm0Ht+RaBPIDBjS+1jWZcICP1XP8SIzSLCUpExxSjTABF9p27ZPqgv8G/qvmZgO05EjtW4Ay6oSpqiQNUXL09Yee9vjay2E0hAMjcu0agj9n70I2/j/oaWK5fnuR79w== 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)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:24.8535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4ef99606-3026-4fc3-b790-08dcf52b9d2f 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: BN1PEPF0000468A.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB9047 As multiple handlers may register for ACPI platform profile handler, only remove the sysfs group when the last one unregisters. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 81928adccfade..091ca6941a925 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -23,6 +23,15 @@ static const char * const profile_names[] = { }; static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); +static bool platform_profile_is_registered(void) +{ + struct list_head *pos; + int count = 0; + list_for_each(pos, &platform_profile_handler_list) + count++; + return count > 0; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -206,8 +215,10 @@ int platform_profile_remove(struct platform_profile_handler *pprof) list_del(&pprof->list); - sysfs_remove_group(acpi_kobj, &platform_profile_group); cur_profile = NULL; + if (!platform_profile_is_registered()) + sysfs_remove_group(acpi_kobj, &platform_profile_group); + return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); From patchwork Fri Oct 25 19:30:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851456 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2050.outbound.protection.outlook.com [40.107.95.50]) (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 13E3921443D; Fri, 25 Oct 2024 19:31:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884694; cv=fail; b=ErcsRxr7+3PKbq4D1X/Dp6IFxHGOf9xTGo1Y7lLtvfaSfEPtDH3ELnff6MX4CJjCPGmg/YrCxa8PE2wTFE5WXhlKldWjlVuI9BeyImZZTPrJ+OgbJfClVH95kiDeYuE/7FUfqRxu2LeM5dRKMnAxGX5X/MI8eYtWjySuHMPmfYA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884694; c=relaxed/simple; bh=wusaujXCnZwPF/O4STiRL9V+S66uhGOqJ4ezGxrisgc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hSvWBUFT05z5aoxTh59GOE8s8bkBMA5EV+ZRzX4GV2N1EBNPJKjyIfWZmX9nerDSDMIjew2HyIDf1FsOru4XyGO8LHkaEYV5ta31DvLKrOqHMOLdz6PJm/3mIRgnuWBnAlnqSgWk6LswxTf6Mh5T/2pA2EB+0g/BU7f4Yw15uWA= 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=Nc0rtOoI; arc=fail smtp.client-ip=40.107.95.50 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="Nc0rtOoI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KNpuHvK508pBaBDEalgvXqIoEr+7ZCV+OQu80aUBrFHP1H449pM6C2olMwyNCrjDOVb0t4O6mbAG7L/tVhA3TAdYCni4Q25A8YQT/X3cufKjZGG0ov4XZEwOLBxs0iTYUXWQj1aZfcklH2oiw+QSbeK9EISg0A3GXthP/i6OkJ2a6rYyJDdlSNsyco3kczA1PdnAuq5kCTGRvXNbN18Bm8qvnZ/6QV7b4QcT2tTFGamGyOuiDGzGbfrjiGzeg1UarnRQ3gIOMQm/d+/wx0I3xs1fR2dxhQ5j/eGACPm5invP+C6NrL28tdPw+NC300OP0d4oTtv4Jj6jiEYeiLWfpg== 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=hKiQvmoZtD8CSvVYQIfxEjMiSDJjjVblJNgXAD+Fd1s=; b=BrhKNwBAt/lc8vp46f3QiTwFEIplBEu921F2VrO0ffxcEqBi0wp+OAcm4dvW8yyuqQK4sZ+GfUwWiNcgQdyrsW3xWaxMZku3qgZmiHj4cFrUewQzDYrfxttE54Tra9PjLCN1xZHDls92cUzqLIlBSVfgVxneFeWwfALcNDTv5jO9lVPHjWxL1iRU61DyqY4AnsNv2Mgy89XG3t9we3T8ZlyQTl8IWjIAbM43qju+jewOxX33/oKWJpYgYmuE2nLf4ft2sQ+D1arCe2NcKqtWd5jqYbfGVs0/PQBx2w2LW6CDZDBosh+5iJF+HlOpYExeI2ze6XHc7HXXPNnJ2V/B4A== 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=hKiQvmoZtD8CSvVYQIfxEjMiSDJjjVblJNgXAD+Fd1s=; b=Nc0rtOoIPoGerZrtOdEUtRieyRE7vROV7200f49JI2OlnOT6qy4VkQ+2PpRzD53Qv5AKlBqh2KvYArHBKr513kOQHQ/sPgRs+4eoJJ3fBNsenaZxM41dzgh9kCG2gj1MUr07gtJnaBRz8e4pXCNpwbGtva/5VNchs7bayemBZYI= Received: from MW4PR03CA0142.namprd03.prod.outlook.com (2603:10b6:303:8c::27) by DM4PR12MB7694.namprd12.prod.outlook.com (2603:10b6:8:102::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.19; Fri, 25 Oct 2024 19:31:28 +0000 Received: from BN1PEPF00004689.namprd05.prod.outlook.com (2603:10b6:303:8c:cafe::e7) by MW4PR03CA0142.outlook.office365.com (2603:10b6:303:8c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Fri, 25 Oct 2024 19:31:27 +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 BN1PEPF00004689.mail.protection.outlook.com (10.167.243.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:27 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:24 -0500 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 Subject: [PATCH 7/8] ACPI: platform_profile: Add support for multiple handlers Date: Fri, 25 Oct 2024 14:30:54 -0500 Message-ID: <20241025193055.2235-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF00004689:EE_|DM4PR12MB7694:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b7c0259-3995-4fa2-d020-08dcf52b9ed9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: FRo7iDhYkeFv/Z9mOomfQLeeg3o9sfS/DBoE5HS210kpkZoewUrXkr/3mve5R/WBKE65c9ye8Vt4yieU4ESPGmzMNkxEAGhh3LXSQBNknql1Mrb6QcmTShQ0fgoBrAgibEOTaTq6VCnhVIc/9kVb1LA1qrSLAzkSC1EyJ+3JPZtVYZJVaJECTkaSaFOtvStfsVNt7hwOxVTX2wbDaY3pqOM86JWQ4I8TxFnmj5ICvbihh8U7i5FrcekvlXu4BoTGs3N2T1mq6EAtga1EtfwagGI+9WUTnRQTthzmSNl2x/ZWaPYBGly4RacGkXT6koyjCtHS+lKpNetcJH9qZcWxExYqQ1TMZDBuxl0NpBBtfYrZI3aWUHTlaGhe69YH9nMDaEZupevPZFEt7x1fh+NXNT1LR8+oo4omtm4Bntgs0olWBACoIVHmHVmjdHL9fSrVWI7r3t/bGIOEulj+bnJN9vDvIq+S4+b9Oy7SC4Cs+AgX8n/9YkVfDYzQgnS97A2poTc/mihRaUNV0PzQRNJL95SenqK2Efr/oGEsrbqXVzwC1wEnFV5gh/qFGjRxMD3tefULRzGCbeyOXS8cE2l872Uvth3IQIm6Z+7coPmK2CN3JdkU7a7Kl26ufrcufDlVSkNyQ/5fSeHii7z9Ol8aX+Y80H9pk87hvBsH2EigUef03OGKogoo1KgDUggos1X3kr6ld1AnnO+737Z5GPqUa+zv4btIFvr73hl7H6ocTYiVN5bShLHJEwJYpj5qOQifR9nYYUop7cDMyyzX8BXOh747DAzEAfA8uZiJoGKfaK8jpo1dYM4zNdKahDEWsOGhk9o1pTr+XlAMnA6LsqXnrBot0ymGDyAUDn9ZPHuH4OS4X/gv1pscp2Ya5eop/O2VXH3t2g60872m9qW+IXaGSwr1XwmR52K879XRU0IZkSl6qXbaQzRWYaMdsXoRBC6oe5JQ0Xwm9RoZxmhWJNh+LKyk8IcDCIrrNOi/OjyWQIzPYxtrJvNJS5gVcScC2+MI7D08rk6yZR+zQXgL6C+CGlzCOogjSwef/A5hJrHQLxgsyp02N7ie2aErUPuYsqOG+5D8CYedcklEN67+k5bwLBOnl2grHgWlCrbQP8Ckrw6wwNtjTViGaYnKx5W0kgmk24Mj4gez/xwW4AARE3BVBuRlYXjGHwm1c49o0XhwnJCWVP63HnvcMMgxNes6lFBAGHEZ3MSgJ6ojBt2//DMJI5r2VFhTCDVME6FeOyPuzi4GsBvYX+YCnSueJ5ZQpHAvQsC5a+At1WWYX4zyQggstMbXn1waOFiXjPXS07hJX/OPG35+lNZeeiKKxmF/WUvq8ERPIU2uo9k3m53qhN8bgbNoXTcA3nmA3Lwq2dIP/3d6vQBA/qpIqy59Opvz/L5YQV9oCR1GZLNPPpmPMrgquw== 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)(376014)(36860700013)(7416014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:27.6616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b7c0259-3995-4fa2-d020-08dcf52b9ed9 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: BN1PEPF00004689.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7694 Multiple drivers may attempt to register platform profile handlers, but only one may be registered and the behavior is non-deterministic for which one wins. It's mostly controlled by probing order. This can be problematic if one driver changes CPU settings and another driver notifies the EC for changing fan curves. Modify the ACPI platform profile handler to let multiple drivers register platform profile handlers and abstract this detail from userspace. From userspace perspective the user will see profiles available across both drivers. However to avoid chaos only allow changing to profiles that are common in both drivers. If any problems occur when changing profiles for any driver, then revert back to the previous profile. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 203 ++++++++++++++++++-------------- 1 file changed, 117 insertions(+), 86 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 091ca6941a925..915e3c49f0b5f 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -9,7 +9,6 @@ #include #include -static struct platform_profile_handler *cur_profile; static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); @@ -36,26 +35,26 @@ static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) { + struct platform_profile_handler *handler; + unsigned long seen = 0; int len = 0; - int err, i; - - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; + int i; + + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + list_for_each_entry(handler, &platform_profile_handler_list, list) { + for_each_set_bit(i, handler->choices, PLATFORM_PROFILE_LAST) { + if (seen & BIT(i)) + continue; + if (len == 0) + len += sysfs_emit_at(buf, len, "%s", profile_names[i]); + else + len += sysfs_emit_at(buf, len, " %s", profile_names[i]); + seen |= BIT(i); + } + } } - for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) { - if (len == 0) - len += sysfs_emit_at(buf, len, "%s", profile_names[i]); - else - len += sysfs_emit_at(buf, len, " %s", profile_names[i]); - } len += sysfs_emit_at(buf, len, "\n"); - mutex_unlock(&profile_lock); return len; } @@ -64,22 +63,20 @@ static ssize_t platform_profile_show(struct device *dev, char *buf) { enum platform_profile_option profile = PLATFORM_PROFILE_BALANCED; + struct platform_profile_handler *handler; int err; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!platform_profile_is_registered()) + return -ENODEV; + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_get(handler, &profile); + if (err) + return err; + } } - err = cur_profile->profile_get(cur_profile, &profile); - mutex_unlock(&profile_lock); - if (err) - return err; - /* Check that profile is valid index */ if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) return -EIO; @@ -91,37 +88,48 @@ static ssize_t platform_profile_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + struct platform_profile_handler *handler; + enum platform_profile_option profile; int err, i; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - 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); - return -EOPNOTSUPP; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!platform_profile_is_registered()) + return -ENODEV; + + /* Check that all handlers support this profile choice */ + list_for_each_entry(handler, &platform_profile_handler_list, list) { + if (!test_bit(i, handler->choices)) + return -EOPNOTSUPP; + + /* save the profile so that it can be reverted if necessary */ + err = handler->profile_get(handler, &profile); + if (err) + return err; + } + + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, i); + if (err) { + pr_err("Failed to set profile for handler %s\n", handler->name); + break; + } + } + if (err) { + list_for_each_entry_continue_reverse(handler, &platform_profile_handler_list, list) { + if (handler->profile_set(handler, profile)) + pr_err("Failed to revert profile for handler %s\n", handler->name); + } + return err; + } } - err = cur_profile->profile_set(cur_profile, i); - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); - - mutex_unlock(&profile_lock); - if (err) - return err; + sysfs_notify(acpi_kobj, NULL, "platform_profile"); return count; } @@ -140,7 +148,8 @@ static const struct attribute_group platform_profile_group = { void platform_profile_notify(void) { - if (!cur_profile) + guard(mutex)(&profile_lock); + if (!platform_profile_is_registered()) return; sysfs_notify(acpi_kobj, NULL, "platform_profile"); } @@ -148,40 +157,65 @@ EXPORT_SYMBOL_GPL(platform_profile_notify); int platform_profile_cycle(void) { + struct platform_profile_handler *handler; enum platform_profile_option profile; - enum platform_profile_option next; + enum platform_profile_option next = PLATFORM_PROFILE_LAST; + enum platform_profile_option next2 = PLATFORM_PROFILE_LAST; int err; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - - err = cur_profile->profile_get(cur_profile, &profile); - if (err) { - mutex_unlock(&profile_lock); - return err; - } - - next = find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, - profile + 1); - - if (WARN_ON(next == PLATFORM_PROFILE_LAST)) { - mutex_unlock(&profile_lock); - return -EINVAL; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + /* first pass, make sure all handlers agree on the definition of "next" profile */ + list_for_each_entry(handler, &platform_profile_handler_list, list) { + + err = handler->profile_get(handler, &profile); + if (err) + return err; + + if (next == PLATFORM_PROFILE_LAST) + next = find_next_bit_wrap(handler->choices, + PLATFORM_PROFILE_LAST, + profile + 1); + else + next2 = find_next_bit_wrap(handler->choices, + PLATFORM_PROFILE_LAST, + profile + 1); + + if (WARN_ON(next == PLATFORM_PROFILE_LAST)) + return -EINVAL; + + if (next2 == PLATFORM_PROFILE_LAST) + continue; + + if (next != next2) { + pr_warn("Next profile to cycle to is ambiguous between platform_profile handlers\n"); + return -EINVAL; + } + next = next2; + } + + /* + * Second pass: apply "next" to each handler + * If any failures occur unwind and revert all back to the original profile + */ + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, next); + if (err) { + pr_err("Failed to set profile for handler %s\n", handler->name); + break; + } + } + if (err) { + list_for_each_entry_continue_reverse(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, profile); + if (err) + pr_err("Failed to revert profile for handler %s\n", handler->name); + } + } } - err = cur_profile->profile_set(cur_profile, next); - mutex_unlock(&profile_lock); - - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + sysfs_notify(acpi_kobj, NULL, "platform_profile"); - return err; + return 0; } EXPORT_SYMBOL_GPL(platform_profile_cycle); @@ -190,21 +224,19 @@ int platform_profile_register(struct platform_profile_handler *pprof) int err; guard(mutex)(&profile_lock); - /* We can only have one active profile */ - if (cur_profile) - 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) return -EINVAL; - err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) - return err; + if (!platform_profile_is_registered()) { + err = sysfs_create_group(acpi_kobj, &platform_profile_group); + if (err) + return err; + } list_add_tail(&pprof->list, &platform_profile_handler_list); - cur_profile = pprof; return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); @@ -215,7 +247,6 @@ int platform_profile_remove(struct platform_profile_handler *pprof) list_del(&pprof->list); - cur_profile = NULL; if (!platform_profile_is_registered()) sysfs_remove_group(acpi_kobj, &platform_profile_group); From patchwork Fri Oct 25 19:30:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13851457 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2058.outbound.protection.outlook.com [40.107.243.58]) (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 EB6CC216208; Fri, 25 Oct 2024 19:31:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884698; cv=fail; b=BUOfGx1so9StLgi7Byb5KmzsJJjV3VG6gwvY4sP7fRJNRD9U0OSoc9Tq6W3Aa1rL8y/dNuJa7Q91WR67BAI7+9uaG10MILSniOfSW9u3xq8AliBWn/cDBoYWl3JP1eYvxTx9mLTWdTv1hJ2EepX5r3y4vdHCsrDvyGGnAgDID/g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729884698; c=relaxed/simple; bh=l1NpPYbI1izrOBXlWSw8t//ZEymsa2FMxrONvbtd7M0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dBE42vn5HOTlaibU9lx+eEUINM81OMSaftP7mIyuifCcZUajycEmJExHZwfHdF7H1XN8zOXkPYJnJxB7gW1NuARiGWgkGfOqRj8MpNEGdAulkcU6rW0ZDrziMk790apZ5eEFlp8O++/Mr8SZyL6umYX2PVcNXqUnHCKBs5GC9vo= 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=HJEPTPnh; arc=fail smtp.client-ip=40.107.243.58 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="HJEPTPnh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lkRbcbdaJthgXssKDJQdZx7Fu4CkRtyVIity4UPWteW56JG7VU8SoQXh7qs0hEChraxsfdEgUWBQBh714Ymq/Tv2M9N7G0CDuJpUj8jIhWaiWbLKEccHxS6x+8nhcHQCtSIPDFecicKd9scuhd/NixzZn9Z0cpjT/wmXp0U8ms/52oQKShDY97nPWIqga4Szv9iRljp+6VWYjXmL2+7d01/GJEZNtWxaTMyeNRqV79dk8c0O382V49/2KebCO/JMTWc9Ux3L/Kmi+RkuSXYl2E+hqeK1zg6eAUP6+bTDXSTSrWBFlQKXj52bgX8HL6na3LmJxt+qFjjt5v8QHXvFdQ== 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=wULtWbk/f8Xi0zwfoBxp2g6NVV/1PuBYHNNKAVq3ltM=; b=AkKi/wdsPr+1Ysrv4OHiA2caO2mPaL0Df+c6dAIQUiumJ+YNOtwRL8SrKv8L2EEoRBZGXIPAP3TwvB9wetkeLQJgzJ8X19aW1JCWQMFEvMYP3bvxhcOANe03ETCxk+Jl5DVHvnCNoYjV6kn3/HzsW050UeXIxIwEPPLWLpIXyqR4T65dqdhM8NQVqV5KKwqAOVLT62dz0ldGx4oCoLiFoQO4WtOOfgqLl7NkZwbBe7jc6hfZeIXck+w5i1OnYMUH3UHs7Uu+z4GAr01srwl+HhXVgWiZQNSu2WMcf9VWD9naGnrGEdOgXfy1FqW5I9yqgWkE149kdOtETWX9zAk8zQ== 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=wULtWbk/f8Xi0zwfoBxp2g6NVV/1PuBYHNNKAVq3ltM=; b=HJEPTPnhVg/UoCi3gOA72M9SBkRzTs7MnP13C/O0W/Oox+vvKA8Nk/uNkn5BP3NPYG2kmQsa0Fpk2e5iWoUHPhPD+B/rAIcHBSiuhFPYIPgMNjBT9F4Dv0PBJZdKVNTxfG+Z6EYtnbhaN6OqUtsdva9jsvMeWwPQneu3Bb18dTg= Received: from BN9PR03CA0366.namprd03.prod.outlook.com (2603:10b6:408:f7::11) by PH7PR12MB7331.namprd12.prod.outlook.com (2603:10b6:510:20e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Fri, 25 Oct 2024 19:31:29 +0000 Received: from BN1PEPF00004687.namprd05.prod.outlook.com (2603:10b6:408:f7:cafe::58) by BN9PR03CA0366.outlook.office365.com (2603:10b6:408:f7::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Fri, 25 Oct 2024 19:31: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 BN1PEPF00004687.mail.protection.outlook.com (10.167.243.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Fri, 25 Oct 2024 19:31:29 +0000 Received: from AUS-P9-MLIMONCI.xilinx.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, 25 Oct 2024 14:31:26 -0500 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 Subject: [PATCH 8/8] platform/x86/amd: pmf: Drop all quirks Date: Fri, 25 Oct 2024 14:30:55 -0500 Message-ID: <20241025193055.2235-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025193055.2235-1-mario.limonciello@amd.com> References: <20241025193055.2235-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: BN1PEPF00004687:EE_|PH7PR12MB7331:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b68d2d1-4953-450d-83ee-08dcf52b9fe9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: eZ/6MGAOJYd0ASO8IaGkZH98vEEjY8KHeFXYJjuqgyHTXJzGUPERA3LYPwzgxuoDNa/5FgrMQRT/mlGkMUtj9MyoOJJFCm0IDhIJSY/lJf4FoqP5b0OkgFRAEt503PqzqtG/iQ1Wyeo0Mh4xuiYqgV4RqwGNcTZClZbmlVwUNbPvel8sRRvWowMbWwx7rOrIEP5ULNbeJF5IbW7TWBZXWHnVccLkJyFMcfgHcZMetQOYVq+lvnoHE/Oh5mlksyVfJaXL7m7E7mnoJoteaviiI+OzRJSdD0RPe5A30bWIS8xCLOMOZ9X2b5NZJZcQvX7TTDAEwhYw5ZsyiFWJ+jVqEbaEYzK/BdZ/QdiEWroUDdpY+vvjCx7Y+dm8KOsSnIOra1faIATe3/9KIGwJja8gJGKrm5oxeo2MFxYvv7R/XorBlLAU/0OkfQcQY0Ne/2dOkYZHddwjQU+35NZb/phO4cUzPn7lk25jUESzqbMZowNsLoofQT4nKs/NtgOXEnwGn2eXA9Q/MMTpLvOpZOWtLzHOpIZBhd+1WQItF5m+zvJ61GRPnL/gxm4wg9iptl2TH7qIQ3H/V+nFyA/inEYyiGmO3HXMegeTf26tC4cw6VgM1WsvCFc/np75DE6AHXshvXLYZbCNDyCBWAiKizVmbFwGNdKKIfNtBZZmucepn6fxFXCXo22oKwUzlO7MB+9GxlQV+gz9mmh8H6VxRulkvwYLodzjUcohIghdfdje6gBnmxmAAO6QP0UzeOwaM0MHYGS5jRoLIb1KCZEuXlfmJLscSpZwyV6+FkXGTkrdXO26jLLBXzBkUIFZMoz0V/EZLcXfnhpylPg+RbSKLkXfb47SOPbIPmSQ7QKFNw7lSKI9gq2JlhIy6Ak7hrNOqCWDB1p6T9YTT7TJbSh1Ia7UkfFsSI8NfRI7mSjkeS/68vYtleh7EvNHPepoNtpTfleUb6T854VZE5o3l9W1OhA/ZJQO1spXR8B83LrWOuHunCVyPInpZHhFmnTtDkJEKTYFEX0W/kJbsY6DRqsXT0WlkKmxuZmCnjDpKjbzc1Vntg1pLkAm4PDDab1OcPFo4lw02xkDE3OSDo2Qljsh8SVplo0/JFgyhN2uYQayn7YaO4g+WJ4HJXZTHrIZU6jjLI7axJGUz58YtFoLMj0EKx8ZcjMhjrQpjp12m2UgWSRKwuqAqNszpHGG3zA+rwTwaKjjBpt9VwVvWc3J3tVTrJHP4xifyLcExCHaVfff/kJwN4bVuo7/U0y/lw2tQTKRV7YAXPMdMKSzD3Bdag2i401dw1OBBizLgS/5llHpe+CeYsy+xphWeAvkkp49pNcPUR7RX0Ck1X66LzaOVhaSiJTOnkpk/uJ8GyV4nWWDSKQAxpgDXePOCrNKilrHoSpr/0E4jL9KUgcyohFNv8A8nJtE5g== 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)(376014)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 19:31:29.4422 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b68d2d1-4953-450d-83ee-08dcf52b9fe9 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: BN1PEPF00004687.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7331 As multiple platform profile handlers can now be registered, the quirks to avoid registering amd-pmf as a handler are no longer necessary. Drop them. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmf/Makefile | 2 +- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf-quirks.c | 66 ----------------------- drivers/platform/x86/amd/pmf/pmf.h | 3 -- 4 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 drivers/platform/x86/amd/pmf/pmf-quirks.c diff --git a/drivers/platform/x86/amd/pmf/Makefile b/drivers/platform/x86/amd/pmf/Makefile index 7d6079b02589c..6b26e48ce8ad2 100644 --- a/drivers/platform/x86/amd/pmf/Makefile +++ b/drivers/platform/x86/amd/pmf/Makefile @@ -7,4 +7,4 @@ obj-$(CONFIG_AMD_PMF) += amd-pmf.o amd-pmf-objs := core.o acpi.o sps.o \ auto-mode.o cnqf.o \ - tee-if.o spc.o pmf-quirks.o + tee-if.o spc.o diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index 47126abd13ca0..6ad00b3d472fe 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -455,7 +455,6 @@ static int amd_pmf_probe(struct platform_device *pdev) mutex_init(&dev->lock); mutex_init(&dev->update_mutex); - amd_pmf_quirks_init(dev); apmf_acpi_init(dev); platform_set_drvdata(pdev, dev); amd_pmf_dbgfs_register(dev); diff --git a/drivers/platform/x86/amd/pmf/pmf-quirks.c b/drivers/platform/x86/amd/pmf/pmf-quirks.c deleted file mode 100644 index 7cde5733b9cac..0000000000000 --- a/drivers/platform/x86/amd/pmf/pmf-quirks.c +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * AMD Platform Management Framework Driver Quirks - * - * Copyright (c) 2024, Advanced Micro Devices, Inc. - * All Rights Reserved. - * - * Author: Mario Limonciello - */ - -#include - -#include "pmf.h" - -struct quirk_entry { - u32 supported_func; -}; - -static struct quirk_entry quirk_no_sps_bug = { - .supported_func = 0x4003, -}; - -static const struct dmi_system_id fwbug_list[] = { - { - .ident = "ROG Zephyrus G14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GA403U"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ROG Ally X", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ASUS TUF Gaming A14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FA401W"), - }, - .driver_data = &quirk_no_sps_bug, - }, - {} -}; - -void amd_pmf_quirks_init(struct amd_pmf_dev *dev) -{ - const struct dmi_system_id *dmi_id; - struct quirk_entry *quirks; - - dmi_id = dmi_first_match(fwbug_list); - if (!dmi_id) - return; - - quirks = dmi_id->driver_data; - if (quirks->supported_func) { - dev->supported_func = quirks->supported_func; - pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n", - dmi_id->ident); - } -} diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 8ce8816da9c16..b89aa38434faa 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -795,7 +795,4 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); -/* Quirk infrastructure */ -void amd_pmf_quirks_init(struct amd_pmf_dev *dev); - #endif /* PMF_H */