From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?JpFq4Ol2mOKt6MQ9aV7snUcmxngxVkP8Rvpo+f2rJN9BLf2hUKh/v0mzdI1V?= =?us-ascii?Q?lpXOqBGmiu5nB9qQGlx3/kcQHdXNAl5TpaTfOpZ9BUkyIoyN8T2g5Zreh4rl?= =?us-ascii?Q?n3dS1jF9fjbgMj7+covgE6vI3fws8Og0ZVJUruCn7Uxg1MalKSaELOaJB0BO?= =?us-ascii?Q?nw1SA28hs1RSTGiD0QcZnULpTg5ZP2x3ZkG+qmEVEFiiuVmXiuJVZZha7HyY?= =?us-ascii?Q?aVmd41VF09Layu4ZNZr/aLGpsO+1U/4mmKH4v42o4NlwBfa98aNVrB/hMctg?= =?us-ascii?Q?dINxtZp3Bn6OQASSxzXZ2LfkXgwkD/2KG2xRyBt/+61vTXjgpRdWUyDp+Z52?= =?us-ascii?Q?FavFFfY5jvCHEfk4FifSn3rBmyt3+T4pjVafRIJ2Jj68C0UC0Te+/r9+K2Zb?= =?us-ascii?Q?bdzwrUC+S1aDeU74GwSJlJEUnDfzc4q2Td8GUh/Ow9KSS3nkYEHyhAYk92E9?= =?us-ascii?Q?tmryiA1Zm5A3+CVnrRgfcNPUDWcZImOgNRRTKotU2/z7hKDSKZHvXVhfJ/J1?= =?us-ascii?Q?7EG09Q5t48ePnDZXPSvhRGL+MuwCRDYJ+UFSLg3ZvXIBc7Hf9mY7rEdgIZeL?= =?us-ascii?Q?kfd3XMOKLYnY5qejkECKBJbmt55DToPLyrGaMQKMVnKAAcZPiy5avDnZZfB4?= =?us-ascii?Q?RU4xlT2d4vNtRRkPg6VrUhz4K5oj5awXNJk+Gaj6pSubkRiAQ5LJqg9RiACW?= =?us-ascii?Q?hpQ3XLxIMFmcQTBJiyVATdrgFcfW7Qdn2reCZ3tyupwgBEIbu4fN4YzVcTJh?= =?us-ascii?Q?xqWZ7QHx7dEwMWx3q6yPbSVBt8THEkwikSZuudy0/w0MEclr41QPTK3tTty1?= =?us-ascii?Q?u0BJSO87qdPTah8ITndFTJXwMAH6dZruU2rVIknsAVOn7A95mw7/JgcfB8Az?= =?us-ascii?Q?EIWOn0SkYwUn9aDyPUVTuLEyWKbeSbVEJBHQ4Yely24NbgVTY97UEy5XUdyu?= =?us-ascii?Q?MBMziC2pGHd7G4jlNw65TxAdzuXO+AXBRQcg4ra5wE94g4F3+l5+qHah08Ef?= =?us-ascii?Q?OtOicVYfWRjMZbHQc0tETbFM/3pl1GhTQVNTcbTe8jVPtEhOz5PKSDgFFkMt?= =?us-ascii?Q?rfmoZe5IlbC9FFNwEgXQanL1nFv0/4Zlhc+9A2Lp54NHu6d+8cpy9MPU/jS6?= =?us-ascii?Q?kadlAfuDC4qZvsE+3F2X05rEUN0qZR7RjExc3WQ4nQDTTGDnSuR9nq+kJsiG?= =?us-ascii?Q?LNAtFSaXxkdPoVczr/bc57iL9Ch6KRpoIJNin6Fw8unnet901U+lLXTeBASL?= =?us-ascii?Q?xyB0PeDCMV/BrnzAWn89VZcMjqyiL9kobKNRtA7+6iI1ws0FynBwAM1/qA7L?= =?us-ascii?Q?sRdoRK9KTfiZQwxwL0VLnQDGciqgQGeF1KkTlxwTynYQhSpKdddf6vzJiHl4?= =?us-ascii?Q?FMS1+wUvrXhQJNGXoOIeAC6EGZyYtH9fXm5lw+AIINyjhI9bAw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(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 Content-Type: text/plain; charset="utf-8" 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: Lyndon Sanche Reviewed-by: Mark Pearson --- 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_d= evice *sdev) =20 tpd->sdev =3D sdev; =20 + tpd->handler.name =3D "Surface Platform Profile"; tpd->handler.profile_get =3D ssam_platform_profile_get; tpd->handler.profile_set =3D ssam_platform_profile_set; =20 diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wm= i.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; =20 + platform_profile_handler.name =3D "acer-wmi"; platform_profile_handler.profile_get =3D acer_predator_v4_platform_profile_get; platform_profile_handler.profile_set =3D 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); } =20 + dev->pprof.name =3D "amd-pmf"; dev->pprof.profile_get =3D amd_pmf_profile_get; dev->pprof.profile_set =3D amd_pmf_profile_set; =20 diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wm= i.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 *as= us) =20 dev_info(dev, "Using throttle_thermal_policy for platform_profile support= \n"); =20 + asus->platform_profile_handler.name =3D "asus-wmi"; asus->platform_profile_handler.profile_get =3D asus_wmi_platform_profile_= get; asus->platform_profile_handler.profile_set =3D asus_wmi_platform_profile_= set; =20 diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/del= l/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 =3D kzalloc(sizeof(*thermal_handler), GFP_KERNEL); if (!thermal_handler) return -ENOMEM; + thermal_handler->name =3D "dell-pc"; thermal_handler->profile_get =3D thermal_platform_profile_get; thermal_handler->profile_set =3D thermal_platform_profile_set; =20 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); } =20 + platform_profile_handler.name =3D "hp-wmi"; set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); =20 diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/i= deapad-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_p= rivate *priv) =20 mutex_init(&priv->dytc->mutex); =20 + priv->dytc->pprof.name =3D "ideapad-laptop"; priv->dytc->priv =3D priv; priv->dytc->pprof.profile_get =3D dytc_profile_get; priv->dytc->pprof.profile_set =3D dytc_profile_set; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platf= orm/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, co= nst void *context) priv->wdev =3D wdev; dev_set_drvdata(&wdev->dev, priv); =20 + priv->handler.name =3D "inspur-wmi"; priv->handler.profile_get =3D inspur_platform_profile_get; priv->handler.profile_set =3D inspur_platform_profile_set; =20 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_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) } =20 static struct platform_profile_handler dytc_profile =3D { + .name =3D "thinkpad-acpi", .profile_get =3D dytc_profile_get, .profile_set =3D dytc_profile_set, }; diff --git a/include/linux/platform_profile.h b/include/linux/platform_prof= ile.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 { }; =20 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); --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?Ntqk6YsVgvOlUwbkvgQnX10peoi8VO9vAFuX7KVoFQDRIC6ptm2Hc1qmBWO1?= =?us-ascii?Q?c6oPbjgSkQ9f5xNPUKP+SetZJK3IChFUfwzVZQcvrhO/1rMoOKtIey85sIXw?= =?us-ascii?Q?L7C7NTxOwn0fbxpmiEL0Edbp7Cd45P9W5JPkJmRcJSVNNtKcMSmaS7nRlAtz?= =?us-ascii?Q?+7Zz/9jOSyIIcCRmjHuDRgcpbqE68v7xwa73YaAwVg0laHsaYYlmIIrLCfCG?= =?us-ascii?Q?lgBSxa7Oq1Diy+0HcCO1y++c5LNEJgO9yfxmQsjdHOGJdxyKTTmgQFpIZF67?= =?us-ascii?Q?rYGdwJq4b/+Jq81xi5bQBZ0ONTWql08gayZ2XliXL6oaH8mqR+pM9mCXQdQ8?= =?us-ascii?Q?vs+L/kvpnjF4RJ3BWEq2UkePYvB001dp2NUEuICrSxjzY1gBJ79Sx51PqqsW?= =?us-ascii?Q?FEgW4GP+SCIPzEFd/PimgsllZWHLDqken997Kky50uyXr2dBAqDe6gxxvXCf?= =?us-ascii?Q?I8o95UpL1vpiiZriuzc2zB7eZIwr9p8pqf7ZvW3OhB8kqO2lv1qyLEdQAkQk?= =?us-ascii?Q?Fl8UjpFlCz8Tb7s6DnnfGbCI21Xe1bkJrbOZM1DmrxvjhM4DX8MuxOxd53Gr?= =?us-ascii?Q?5JEwYc6y8SWa8ORGJFAuhsOIHwYHxSF3b3ZbKT8p3/pVLAATeGzBUGorO0yC?= =?us-ascii?Q?s/t4akGf42G0HHYDR7JGvSlVFffp2VcPVwlIvL5vAbFe8BSOxbTSwegs/Kvi?= =?us-ascii?Q?O/1OnD4yICZwjX+VJI/luPCIm8LswS5YPokFHA/n0JNeokPK6h2GkAqqa4xX?= =?us-ascii?Q?e0arM/0J/Xu2YH1LhZ9tPEEM2g8lZ6rS1xXap+O9MyfvUzvuXSRoI4SbeZGl?= =?us-ascii?Q?A8eisH6jo/fLH1+mWpPXbADmalw8A318f0o5UbNcTyraQnx/ZaCn89DrT1Bp?= =?us-ascii?Q?U0hWWvC18tFZ3ldZ8Svjl6sFI9kYZ27c8WVuHav0mCNL1d69LaF7NRsLWWXh?= =?us-ascii?Q?8iYqefs5CyQ3iEfh6a51WyhXhsDlZ/fp9STAPKFTp0wWQu/QEsMZhhkVzxP0?= =?us-ascii?Q?rXwAUX5PQpY26nStY3nzqY87txN6JXOARQUqODoaDJ5KWqNCJ6kbtZMMGZe1?= =?us-ascii?Q?jfXL55vboF0Ay8kiIJlaoUiZRQwSP4CsMSGgVMRnhsfooQh0ZmnRnR4wPVr6?= =?us-ascii?Q?tAGcFtJhRntQ1WK4xyo85zfimNuXhBqhyB1ewz6BmBQGhRW5yv7fooy9u9vD?= =?us-ascii?Q?hEMvRoERL7JdShFTXxB7IQqw1H8905UEVOOfihoPa8WEn834NVC7RZ36oBfp?= =?us-ascii?Q?73RRnSKQcnK3a7icFvK8Lg5mztu/JiAEPNPm+R/JZB+xXJimxWyxQRckXRrq?= =?us-ascii?Q?IO5l8WzGT5RSBe6xt33r6BqSv2xxtr0N+bkBhMbQ+8m2QkFR8otFgs6xVWsw?= =?us-ascii?Q?m/+HoP573BhptZBD+yYKOV4rYsZLau+y2bC+Pez89y/yaGBK0A=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(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 Content-Type: text/plain; charset="utf-8" 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_d= evice *sdev) return -ENOMEM; =20 tpd->sdev =3D sdev; + sdev->tpd =3D tpd; =20 tpd->handler.name =3D "Surface Platform Profile"; tpd->handler.profile_get =3D ssam_platform_profile_get; diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surf= ace_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; =20 struct ssam_device_uid uid; + struct ssam_platform_profile_device *tpd; =20 unsigned long flags; }; --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?wEPLHtbewqi9F3FRQzaiZbKUPKPMfInISxnrOfjt6Wn+h0bihuyIsXdDYigd?= =?us-ascii?Q?v08/yBD3UWClKORdQHLdf6H6I2bLLrrykN34Htn4qfqIBHVVknfp6VHC4+jE?= =?us-ascii?Q?eC79hqhx4Zup7bfNeCvM6ZCbWUztJdfCKRmaaw9lbJZScJo0sPA7mRPei1Z6?= =?us-ascii?Q?chyy2pUNrMrbGeFj8JRNM/Au4VTSHKVjqQvgHf9qqfnIVlwNYb8hCs0oKzPI?= =?us-ascii?Q?OTVGEARfdjrpaNHsZA+aUXZfKCHPMjLFt3mJckF0p8jF1KMmSku5bV8FgcFy?= =?us-ascii?Q?+4tAeQbmMt/UybdnLfAQ2SuP3FkCywgMmiWk+8m+S38hCMfGPuCoYh/SRxgz?= =?us-ascii?Q?x26Z0dj3286z77hoRyw41IMeP57Pa3jgoYi27vM3Uui5WEppkYJQJpVE3XT6?= =?us-ascii?Q?6BoANl4ZOH+wukmAEau1jdnFtqJ+xatTgdum6rje6a31mmuznbZlm+b+JBQC?= =?us-ascii?Q?lU3uBi3TbGhNajgr3djpIfKkFjEFSLnEK4phEqLoaofSjFi7xbWnZVOLp7JZ?= =?us-ascii?Q?PedxEpsp53lX7BNkwAXQ2qKrmtbWX2DCMd5/dwBIwfi6Le2ztv7mtfLekCq6?= =?us-ascii?Q?ohZ4gzSbVPfe141nj8qc9CZzYmCYaTi0Qbhunj8IEYwrH8PvOhiCRkD6DE23?= =?us-ascii?Q?aZ6muRBeMX52AvJ/VPGVJ5p5xj8yVtZBu41ecX7lmlkzWJvbxuS7KQdE4UEw?= =?us-ascii?Q?e3xBviq317RT+GLHFVi3rXQYZxjtW1B5XnKhITiAYGV0N1z5hClnnnU7JH39?= =?us-ascii?Q?uE5HS6RDxjnK3UPPJarkMggoRVC5IGzLCIUWVVM3JVrOK/AfaFEyDaYDgWmj?= =?us-ascii?Q?R7XyqYmROMJRU/YhczUoFobl42CT6ikJBJFmWZrYyfLi0tKykwmmfNKqwyYv?= =?us-ascii?Q?1HN6b+b25EHvrzaINZkQxBcgVE2Oe5z2Laq1HN3KBsBgXGpwMbm1W3zH9PWu?= =?us-ascii?Q?L5dlfCGcJzOcoNhsFl/CR7gc5t7GuomKqsZx6fUXQU5+Nej+9YQRi0883LZc?= =?us-ascii?Q?YqaoBbJe/vD9TubjbLDoeQicTm+8Q3CmFlzRbg+UmvOpW5TuxMmXN+mFm8TM?= =?us-ascii?Q?RfZRGupjt/fIw+QcrpqR5PhTKhIRbTzUnu6arrI3uSYXaaY++AqsKO3utABd?= =?us-ascii?Q?bIuuw3JFhHL6TAI0XIU+8NMd1cE4OwohkI/Nq4EQM2qAh6mlPn0r1Fn/2Ayg?= =?us-ascii?Q?jLCD/L/99Ce88D2ratVXVbtWaFcA48oXSVSgDVUL07awkdL684iqfaVm26PR?= =?us-ascii?Q?Jb5O02eycV5IYrBiVXRsGqXrpQTvcdhMzsn4TCNPPbSmF6eGJIX4hCM424C/?= =?us-ascii?Q?LG92tDQLR7AikgOwckrXkxiFIzSgtwZqINBwgEUd9HY5KoKB58dwmMIIPB9a?= =?us-ascii?Q?iLWT8qB38ud2VbUhW6uYFAPFJD7cmiMQ8sPKdfOBZthMaPpCfw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(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 Content-Type: text/plain; charset="utf-8" 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_profil= e.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_h= andler *pprof) } EXPORT_SYMBOL_GPL(platform_profile_register); =20 -int platform_profile_remove(void) +int platform_profile_remove(struct platform_profile_handler *pprof) { sysfs_remove_group(acpi_kobj, &platform_profile_group); =20 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_d= evice *sdev) =20 static void surface_platform_profile_remove(struct ssam_device *sdev) { - platform_profile_remove(); + platform_profile_remove(&sdev->tpd->handler); } =20 static const struct ssam_device_id ssam_platform_profile_match[] =3D { diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wm= i.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) =20 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_devi= ce *device) acer_rfkill_exit(); =20 if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } =20 #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) =20 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-wm= i.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 *d= evice) asus_wmi_battery_exit(asus); =20 if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); =20 kfree(asus); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/del= l/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) } =20 if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } =20 static int hp_wmi_resume_handler(struct device *device) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/i= deapad-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; =20 - platform_profile_remove(); + platform_profile_remove(&priv->dytc->pprof); mutex_destroy(&priv->dytc->mutex); kfree(priv->dytc); =20 diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platf= orm/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, co= nst void *context) =20 static void inspur_wmi_remove(struct wmi_device *wdev) { - platform_profile_remove(); + struct inspur_wmi_priv *priv; + priv =3D dev_get_drvdata(&wdev->dev); + platform_profile_remove(&priv->handler); } =20 static const struct wmi_device_id inspur_wmi_id_table[] =3D { diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/th= inkpad_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) =20 static void dytc_profile_exit(void) { - platform_profile_remove(); + platform_profile_remove(&dytc_profile); } =20 static struct ibm_struct dytc_profile_driver_data =3D { diff --git a/include/linux/platform_profile.h b/include/linux/platform_prof= ile.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 { }; =20 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); =20 --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?qUspQmn29qbPWoOSO5VY5XrrgGqde9e7upGjSKvYWXvr4Cru2ItzZjO7RWhf?= =?us-ascii?Q?vu5yQ8X2WtJPR2h+zQsRwaVlX0RQ/N2mpUNGukoXDY3gwBfbm8j/pPXGkDZn?= =?us-ascii?Q?jDfbV6MGgHB08CfR9wV+Asq6+w8S4fFSMs/aqrZx2AFl9GurzJa2Smaki07h?= =?us-ascii?Q?kgf3b+kUzLgFbm+bonlD0tkr/dNOhwikF6zXKJJrzJjE5L8blRvXJMdHH6Fp?= =?us-ascii?Q?3K5xGeGv9coiMtD5I6b3l4BOeaAvbP9fhg8AgJROotT342JVmMB51kAyGLa+?= =?us-ascii?Q?QVm5FrQI2QdCtB4sUsVadS2gMtxBFqAEmYaWmzYWptJy40yHDJPZKdfnH2pB?= =?us-ascii?Q?k4nJBlW64Ip8QMMYL4XHxr5auvAn8yK314BzR5c8rEA8QE1E21w/g/38Ixq2?= =?us-ascii?Q?q5/ltJxoKdilYZwqfj5U5eI5lO4plBhX6cy1qIdguFt8XIRap1JEnziC0fMu?= =?us-ascii?Q?sK1gt0ttLZRje7JXQvNvp+4p0E0t66NjeRrQ4nvaOhKrFvb5DlvQrvvOolpo?= =?us-ascii?Q?16co9/z63vkU8RfcQJQkGCoDHA6CuXxf2tRtPV8azGR9wnCWyird9NPuVb5S?= =?us-ascii?Q?w8Ul0DpjsUs4Z+UOdqg4lKE5E1/MA0HHeDzrHMfnqtEtSNDRQkJIJZMH+Uow?= =?us-ascii?Q?NIBlJbF9ZKKyve4/7kkL3whE17VioeHUaDAZApBSmGcZLAI2QV2fc57zryF9?= =?us-ascii?Q?CwWGF0dqams06LCTHRGR+ol6H3mV//H6n2DaF1p3xkZyqYpKgj2sPH48JeY7?= =?us-ascii?Q?QDDjNS+b2frVWBFP+aRXKI55VpHQZk6VZvqeg20E3za2TVaA8MDo1dPa68oL?= =?us-ascii?Q?UXVhhsfXNfzL0kbqgVpxIWm4kDHMfgl/CsJ+TVdLxbhIC3P3wq0duxqBtVLa?= =?us-ascii?Q?OdXN6uyMjWlM88JLoPG8QG/uytREBZK/KuBUAOHyusB9e7cIpF58zyYcnAux?= =?us-ascii?Q?17UZnSoH5P88aDsUF/3DPF+JfVQWGaGq3knwUlLdoXvNErXQGwVYBkcekmeg?= =?us-ascii?Q?Hz2Zh8vIzza5p5N96duSf/Aya4suZbOJ/oFkCWGLjYzxQHcroeuNngRVXp+7?= =?us-ascii?Q?OxEfFQX5U5C+RcCF43GB8eULR5G7wSq7njSiuRxaB2t1Rdmx0l/e9Au1Fy4h?= =?us-ascii?Q?txE3/GrjVhlksbq0fiVMt7taQKt8W+xKJyPw82othEw1V/GYcS9c5tHqcnhw?= =?us-ascii?Q?wRNDUxcdzve61VQEZkqD9PY9Z01Bf2yK0/iZEdkNrfW7gX5BVs6oSM34w1gH?= =?us-ascii?Q?oSef3qXgON4PkgNy4IGxnKkNCpcPJ3CcVN6ZflOx+sZxmTWdMhL3wcEvinPv?= =?us-ascii?Q?myiAMgM5ARI2WZezdXi8vK5arXGGCM7e/3fXa0ngAX+RsKjWGp4VnNHHVHjC?= =?us-ascii?Q?mydIO1+ZFauUjtbH+rtTTMKLMGSSD+f20Y/PFBWXmk+D3GfWpg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(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 Content-Type: text/plain; charset="utf-8" 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_profil= e.c index c24744da20916..0c60fc970b6e8 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,6 +10,7 @@ #include =20 static struct platform_profile_handler *cur_profile; +static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); =20 static const char * const profile_names[] =3D { @@ -198,6 +199,7 @@ int platform_profile_register(struct platform_profile_h= andler *pprof) mutex_unlock(&profile_lock); return err; } + list_add_tail(&pprof->list, &platform_profile_handler_list); =20 cur_profile =3D pprof; mutex_unlock(&profile_lock); @@ -207,8 +209,9 @@ EXPORT_SYMBOL_GPL(platform_profile_register); =20 int platform_profile_remove(struct platform_profile_handler *pprof) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + list_del(&pprof->list); =20 + sysfs_remove_group(acpi_kobj, &platform_profile_group); mutex_lock(&profile_lock); cur_profile =3D NULL; mutex_unlock(&profile_lock); diff --git a/include/linux/platform_profile.h b/include/linux/platform_prof= ile.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, --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?OLSds4KUzU672NLEslTlQiM/rP3ak+jzbf6OBENgsqqe9nS5KLMqGaNxYHp/?= =?us-ascii?Q?1BSiS33gzc+MDcxDvk3EDuDymqFZaHS5F/wVJZLvQ7esunim7UY0BfnwLtNj?= =?us-ascii?Q?OwBD/RRJrueSoImoC1pZDiuYf1r5OoR+5Dx7qSDZoXKXwJsc2Mp2m1ZOej9H?= =?us-ascii?Q?doML8vZ0GLk2PemIqvub2FG/vTRQymW7wQbe1peZV9LHG++64Shp/tuhYug/?= =?us-ascii?Q?MVtZfP5HBFXWmvKcHNwzi0axsPQNLEi8jQO4tVIZ6kVfVwKY5fTCrv5t6BgM?= =?us-ascii?Q?vMuEmtqGAH/t4eFgYumC5Cias+j1XQMFsBBInd4jkiQKb7PyZOkXpu0z+yiV?= =?us-ascii?Q?esAXqfFn+npeBDtR8M4vLesty85w5EKxsSbZFY62DzHgNVXk+r3IWTigDQom?= =?us-ascii?Q?NR3qCxUMa0lL9WsAUBG/Ebw0VJDE6C5tGrBKuZGT034AeDKerYEa153PyHkA?= =?us-ascii?Q?ncRH7cVzImTeCb88lpm6vdiqrJaHc82ba3ZEu/0K91lUSCb82gvuF5WojuVR?= =?us-ascii?Q?0gPKc4OH3xwH+ewpdt1REwc3zlseRBl6i3zHe5IJl/Pvl2gSENgRYcvoA9i1?= =?us-ascii?Q?zzb+1yKWJo6nDJvAfcp7/K8sIAvY6ZhHah9JU0B1ZGoSU4kJ2GH02/Upk9/U?= =?us-ascii?Q?OzE2+56Y31pXd3wCBtHOkP3bulfK0pttzDIM4KkPo/iiU2s+4EC3eQUgqnX2?= =?us-ascii?Q?wpwl9BC2u18n88OEG4rYmo3xtrg59x3CU5KXcLeyraAjOBm1gr9tk/rHHlhP?= =?us-ascii?Q?Cf4S5CeLGTlz2Sh92JeX4marZiNE6kIvesokU7J5R18Dlp0p4Not9PViwxf4?= =?us-ascii?Q?ZVMFWZaXP7Y31kvFoOlyTVDWA1rrUD1ogp+AqqDhgpDv/h+npe4T+jPw2BMX?= =?us-ascii?Q?EdNh7ikTpVuAxsRxLA/XE21T8iKyOcRLH26ynhBllE834+xwe81+yjeeSDod?= =?us-ascii?Q?YCrhqGRw7xHC4dxgm4mKc3gbKcPXxF3SyiSYW4xxK7eWkOSPKCbJy/TAn1YR?= =?us-ascii?Q?/i7N15Y78JGdBEFQuN/pjQnX/USfb49hY4Fbr73xPItcnrivaFBn06FjA664?= =?us-ascii?Q?v8qMbHVscOljEQEdscr1QJDf3io3prpZw74Abpc3h8PoyIPbXoGO549o4mjr?= =?us-ascii?Q?gSUO0DQnmIckWMmDlEKExOHXjk0J1SHq3eHFyJHEJ6j13PKwUHe8oeM/mmp1?= =?us-ascii?Q?ZXMnSSjtaII6z0Trqw1oE4IwSB8x5ARJDWnO+zRsfqKF1ivyr57DxyRnyBfS?= =?us-ascii?Q?ALlx5Qt05JW2OfKgDHwOV6wgVqme4rM8/IUh2OGk0b0oi9xkzx/fGD895xZv?= =?us-ascii?Q?QFT9SQyFsA9swprGnXknTDK9wNaBiV04I+s9rwgu/i/Q1dJg8Xv3IgVke0xn?= =?us-ascii?Q?Chs/9cRmNMCYPE+2geHYti3EG9woN0ANxxR1W8Q9wD3lPlGYRQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(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 Content-Type: text/plain; charset="utf-8" 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_profil= e.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; =20 - 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; - } =20 /* 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; - } =20 err =3D 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); =20 cur_profile =3D pprof; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); =20 int platform_profile_remove(struct platform_profile_handler *pprof) { + guard(mutex)(&profile_lock); + list_del(&pprof->list); =20 sysfs_remove_group(acpi_kobj, &platform_profile_group); - mutex_lock(&profile_lock); cur_profile =3D NULL; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?5xjng2U4MHVH0zv1hVTPKSonS6Vzc5kujFoS85UCvjiQPqicTBhg4Zi7H2IB?= =?us-ascii?Q?8bC5DYKpauCc+ijP4bPXj9u/HfVlTECrxvk1CsUVsDurZi8EQal5Oqq7QVV0?= =?us-ascii?Q?JFZkysR0XSHS9iC5fFXqg/crchiobCUwQtZTrsFYSPjakymq9/rTVEaNMonN?= =?us-ascii?Q?j8SV4Xx4qrON0zYLtH7OU5vUmcJKxoE6m3z5filBDIuwE6Whqn3++w8wYNFn?= =?us-ascii?Q?3RiNQ3+WJ2npF8xESWhvLDjtlEvuGvDzHXt5EQa5rOtPngvp4MhOcedeqT+C?= =?us-ascii?Q?hP2c08ToTOG63CZCzdyn07xRZ3OSrRajMJZdIu+JWW6gzlej9FM34DPiYxhP?= =?us-ascii?Q?CwIoBarIWO1ai/2658jfEo3qU5ZnYRu1mCl/bQ2IGzPoGAMoc30Xzy5awxEL?= =?us-ascii?Q?6x4KdOm7YlZANwh21o+7EEYalrz8N6MMUIVICLOzQflw+fyI+H6sjxBPL8VF?= =?us-ascii?Q?5tsWb84jVXW0Y3SEYPceCBJbTWYxta4c3IhdzEFOLcH2aBqhwIarUOBFFz3w?= =?us-ascii?Q?7xH3KOWkgWdtbIBMxjS+RNErovmxn6XcHN/lAOgRVH3vmp7w9NIbZfaF4Iab?= =?us-ascii?Q?QHOP49nPIDYfIkQLjy4ihCeaOC4sptV3XcdoZ/Prv8bsoQZXDyPOQ9mq82E1?= =?us-ascii?Q?ElqDchZdwcyAWGtIhU5VUPgIz2w0zHNdydveFdY6wJ1/Y5MGQSQnRMbylwR+?= =?us-ascii?Q?WSvAKC/BGvUaPzk2uzxq9733pYfZI4wabI0Md0Gwzn9I1vfJVJf15Om90a9g?= =?us-ascii?Q?qUvZ71knnN6X08cF+qeycR6J/OZ4qp/qiAjIAS3AL8wit5zn8ydOmsokMTnC?= =?us-ascii?Q?33bxbLHRwnxyY4hng00Oy4ny50D53PhES+2rfuJRTKvd6BMhNyQ9r9cIfsYC?= =?us-ascii?Q?FOo6XWqNIEc3U7rmxZEPOwRBTt/nyY3/pNAXD2UWvwUzmJ2bs0XFdicXVOnl?= =?us-ascii?Q?nHy10RQOVFSuPggzbPl5/S1fI7xALM52sgZ5HpJgZTHIOSeKupNTVMucqjtU?= =?us-ascii?Q?Cwz+2gKZ+TyCyt7/+5h/5zJadNhKOy+6bS7hSi+xJTyY88k0ZKXs4qbHABsh?= =?us-ascii?Q?Zup4eAbmmVkID823ZZkP5TJ8ZxBvDQ5Uqw8hU0Xi354pLOLTmPMnSRlB7Vid?= =?us-ascii?Q?j9oePVoXACrVBUixbAmDlFT3M0qUOw/FkXDGWzd8MEoM/NOH1915y1aNdxsJ?= =?us-ascii?Q?iloBLrTFYgcjQB9G1xDiq/vaUaV1ZWEv5ELvR3OHC1Aff5rH9WbTUeRKHK4Z?= =?us-ascii?Q?fAzkQv38hmiBYPDsVHsMQxHDE21P8dVDQ1OGGrCVapiKm0Ht+RaBPIDBjS+1?= =?us-ascii?Q?jWZcICP1XP8SIzSLCUpExxSjTABF9p27ZPqgv8G/qvmZgO05EjtW4Ay6oSpq?= =?us-ascii?Q?iQNUXL09Yee9vjay2E0hAMjcu0agj9n70I2/j/oaWK5fnuR79w=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(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 Content-Type: text/plain; charset="utf-8" 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_profil= e.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[] =3D { }; static_assert(ARRAY_SIZE(profile_names) =3D=3D PLATFORM_PROFILE_LAST); =20 +static bool platform_profile_is_registered(void) +{ + struct list_head *pos; + int count =3D 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_ha= ndler *pprof) =20 list_del(&pprof->list); =20 - sysfs_remove_group(acpi_kobj, &platform_profile_group); cur_profile =3D NULL; + if (!platform_profile_is_registered()) + sysfs_remove_group(acpi_kobj, &platform_profile_group); + return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?FRo7iDhYkeFv/Z9mOomfQLeeg3o9sfS/DBoE5HS210kpkZoewUrXkr/3mve5?= =?us-ascii?Q?R/WBKE65c9ye8Vt4yieU4ESPGmzMNkxEAGhh3LXSQBNknql1Mrb6QcmTShQ0?= =?us-ascii?Q?fgoBrAgibEOTaTq6VCnhVIc/9kVb1LA1qrSLAzkSC1EyJ+3JPZtVYZJVaJEC?= =?us-ascii?Q?TkaSaFOtvStfsVNt7hwOxVTX2wbDaY3pqOM86JWQ4I8TxFnmj5ICvbihh8U7?= =?us-ascii?Q?i5FrcekvlXu4BoTGs3N2T1mq6EAtga1EtfwagGI+9WUTnRQTthzmSNl2x/ZW?= =?us-ascii?Q?aPYBGly4RacGkXT6koyjCtHS+lKpNetcJH9qZcWxExYqQ1TMZDBuxl0NpBBt?= =?us-ascii?Q?fYrZI3aWUHTlaGhe69YH9nMDaEZupevPZFEt7x1fh+NXNT1LR8+oo4omtm4B?= =?us-ascii?Q?ntgs0olWBACoIVHmHVmjdHL9fSrVWI7r3t/bGIOEulj+bnJN9vDvIq+S4+b9?= =?us-ascii?Q?Oy7SC4Cs+AgX8n/9YkVfDYzQgnS97A2poTc/mihRaUNV0PzQRNJL95SenqK2?= =?us-ascii?Q?Efr/oGEsrbqXVzwC1wEnFV5gh/qFGjRxMD3tefULRzGCbeyOXS8cE2l872Uv?= =?us-ascii?Q?th3IQIm6Z+7coPmK2CN3JdkU7a7Kl26ufrcufDlVSkNyQ/5fSeHii7z9Ol8a?= =?us-ascii?Q?X+Y80H9pk87hvBsH2EigUef03OGKogoo1KgDUggos1X3kr6ld1AnnO+737Z5?= =?us-ascii?Q?GPqUa+zv4btIFvr73hl7H6ocTYiVN5bShLHJEwJYpj5qOQifR9nYYUop7cDM?= =?us-ascii?Q?yyzX8BXOh747DAzEAfA8uZiJoGKfaK8jpo1dYM4zNdKahDEWsOGhk9o1pTr+?= =?us-ascii?Q?XlAMnA6LsqXnrBot0ymGDyAUDn9ZPHuH4OS4X/gv1pscp2Ya5eop/O2VXH3t?= =?us-ascii?Q?2g60872m9qW+IXaGSwr1XwmR52K879XRU0IZkSl6qXbaQzRWYaMdsXoRBC6o?= =?us-ascii?Q?e5JQ0Xwm9RoZxmhWJNh+LKyk8IcDCIrrNOi/OjyWQIzPYxtrJvNJS5gVcScC?= =?us-ascii?Q?2+MI7D08rk6yZR+zQXgL6C+CGlzCOogjSwef/A5hJrHQLxgsyp02N7ie2aEr?= =?us-ascii?Q?UPuYsqOG+5D8CYedcklEN67+k5bwLBOnl2grHgWlCrbQP8Ckrw6wwNtjTViG?= =?us-ascii?Q?aYnKx5W0kgmk24Mj4gez/xwW4AARE3BVBuRlYXjGHwm1c49o0XhwnJCWVP63?= =?us-ascii?Q?HnvcMMgxNes6lFBAGHEZ3MSgJ6ojBt2//DMJI5r2VFhTCDVME6FeOyPuzi4G?= =?us-ascii?Q?sBvYX+YCnSueJ5ZQpHAvQsC5a+At1WWYX4zyQggstMbXn1waOFiXjPXS07hJ?= =?us-ascii?Q?X/OPG35+lNZeeiKKxmF/WUvq8ERPIU2uo9k3m53qhN8bgbNoXTcA3nmA3Lwq?= =?us-ascii?Q?2dIP/3d6vQBA/qpIqy59Opvz/L5YQV9oCR1GZLNPPpmPMrgquw=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(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 Content-Type: text/plain; charset="utf-8" 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_profil= e.c index 091ca6941a925..915e3c49f0b5f 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -9,7 +9,6 @@ #include #include =20 -static struct platform_profile_handler *cur_profile; static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); =20 @@ -36,26 +35,26 @@ static ssize_t platform_profile_choices_show(struct dev= ice *dev, struct device_attribute *attr, char *buf) { + struct platform_profile_handler *handler; + unsigned long seen =3D 0; int len =3D 0; - int err, i; - - err =3D 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 =3D=3D 0) + len +=3D sysfs_emit_at(buf, len, "%s", profile_names[i]); + else + len +=3D sysfs_emit_at(buf, len, " %s", profile_names[i]); + seen |=3D BIT(i); + } + } } =20 - for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) { - if (len =3D=3D 0) - len +=3D sysfs_emit_at(buf, len, "%s", profile_names[i]); - else - len +=3D sysfs_emit_at(buf, len, " %s", profile_names[i]); - } len +=3D sysfs_emit_at(buf, len, "\n"); - mutex_unlock(&profile_lock); return len; } =20 @@ -64,22 +63,20 @@ static ssize_t platform_profile_show(struct device *dev, char *buf) { enum platform_profile_option profile =3D PLATFORM_PROFILE_BALANCED; + struct platform_profile_handler *handler; int err; =20 - err =3D mutex_lock_interruptible(&profile_lock); - if (err) - return err; =20 - 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 =3D handler->profile_get(handler, &profile); + if (err) + return err; + } } =20 - err =3D 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 >=3D ARRAY_SIZE(profile_names)))) return -EIO; @@ -91,37 +88,48 @@ static ssize_t platform_profile_store(struct device *de= v, struct device_attribute *attr, const char *buf, size_t count) { + struct platform_profile_handler *handler; + enum platform_profile_option profile; int err, i; =20 - err =3D mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - /* Scan for a matching profile */ i =3D sysfs_match_string(profile_names, buf); if (i < 0) { - mutex_unlock(&profile_lock); return -EINVAL; } =20 - /* 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 =3D handler->profile_get(handler, &profile); + if (err) + return err; + } + + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err =3D 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; + } } =20 - err =3D 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; } =20 @@ -140,7 +148,8 @@ static const struct attribute_group platform_profile_gr= oup =3D { =20 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); =20 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 =3D PLATFORM_PROFILE_LAST; + enum platform_profile_option next2 =3D PLATFORM_PROFILE_LAST; int err; =20 - err =3D mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - - err =3D cur_profile->profile_get(cur_profile, &profile); - if (err) { - mutex_unlock(&profile_lock); - return err; - } - - next =3D find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, - profile + 1); - - if (WARN_ON(next =3D=3D 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 =3D handler->profile_get(handler, &profile); + if (err) + return err; + + if (next =3D=3D PLATFORM_PROFILE_LAST) + next =3D find_next_bit_wrap(handler->choices, + PLATFORM_PROFILE_LAST, + profile + 1); + else + next2 =3D find_next_bit_wrap(handler->choices, + PLATFORM_PROFILE_LAST, + profile + 1); + + if (WARN_ON(next =3D=3D PLATFORM_PROFILE_LAST)) + return -EINVAL; + + if (next2 =3D=3D PLATFORM_PROFILE_LAST) + continue; + + if (next !=3D next2) { + pr_warn("Next profile to cycle to is ambiguous between platform_profil= e handlers\n"); + return -EINVAL; + } + next =3D next2; + } + + /* + * Second pass: apply "next" to each handler + * If any failures occur unwind and revert all back to the original prof= ile + */ + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err =3D 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 =3D handler->profile_set(handler, profile); + if (err) + pr_err("Failed to revert profile for handler %s\n", handler->name); + } + } } =20 - err =3D 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"); =20 - return err; + return 0; } EXPORT_SYMBOL_GPL(platform_profile_cycle); =20 @@ -190,21 +224,19 @@ int platform_profile_register(struct platform_profile= _handler *pprof) int err; =20 guard(mutex)(&profile_lock); - /* We can only have one active profile */ - if (cur_profile) - return -EEXIST; =20 /* 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; =20 - err =3D sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) - return err; + if (!platform_profile_is_registered()) { + err =3D sysfs_create_group(acpi_kobj, &platform_profile_group); + if (err) + return err; + } list_add_tail(&pprof->list, &platform_profile_handler_list); =20 - cur_profile =3D pprof; return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); @@ -215,7 +247,6 @@ int platform_profile_remove(struct platform_profile_han= dler *pprof) =20 list_del(&pprof->list); =20 - cur_profile =3D NULL; if (!platform_profile_is_registered()) sysfs_remove_group(acpi_kobj, &platform_profile_group); =20 --=20 2.43.0 From nobody Mon Nov 25 14:37:04 2024 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=20J=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=20Kleine-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: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: =?us-ascii?Q?eZ/6MGAOJYd0ASO8IaGkZH98vEEjY8KHeFXYJjuqgyHTXJzGUPERA3LYPwzg?= =?us-ascii?Q?xuoDNa/5FgrMQRT/mlGkMUtj9MyoOJJFCm0IDhIJSY/lJf4FoqP5b0OkgFRA?= =?us-ascii?Q?Et503PqzqtG/iQ1Wyeo0Mh4xuiYqgV4RqwGNcTZClZbmlVwUNbPvel8sRRvW?= =?us-ascii?Q?owMbWwx7rOrIEP5ULNbeJF5IbW7TWBZXWHnVccLkJyFMcfgHcZMetQOYVq+l?= =?us-ascii?Q?vnoHE/Oh5mlksyVfJaXL7m7E7mnoJoteaviiI+OzRJSdD0RPe5A30bWIS8xC?= =?us-ascii?Q?LOMOZ9X2b5NZJZcQvX7TTDAEwhYw5ZsyiFWJ+jVqEbaEYzK/BdZ/QdiEWroU?= =?us-ascii?Q?DdpY+vvjCx7Y+dm8KOsSnIOra1faIATe3/9KIGwJja8gJGKrm5oxeo2MFxYv?= =?us-ascii?Q?v7R/XorBlLAU/0OkfQcQY0Ne/2dOkYZHddwjQU+35NZb/phO4cUzPn7lk25j?= =?us-ascii?Q?UESzqbMZowNsLoofQT4nKs/NtgOXEnwGn2eXA9Q/MMTpLvOpZOWtLzHOpIZB?= =?us-ascii?Q?hd+1WQItF5m+zvJ61GRPnL/gxm4wg9iptl2TH7qIQ3H/V+nFyA/inEYyiGmO?= =?us-ascii?Q?3HXMegeTf26tC4cw6VgM1WsvCFc/np75DE6AHXshvXLYZbCNDyCBWAiKizVm?= =?us-ascii?Q?bFwGNdKKIfNtBZZmucepn6fxFXCXo22oKwUzlO7MB+9GxlQV+gz9mmh8H6Vx?= =?us-ascii?Q?RulkvwYLodzjUcohIghdfdje6gBnmxmAAO6QP0UzeOwaM0MHYGS5jRoLIb1K?= =?us-ascii?Q?CZEuXlfmJLscSpZwyV6+FkXGTkrdXO26jLLBXzBkUIFZMoz0V/EZLcXfnhpy?= =?us-ascii?Q?lPg+RbSKLkXfb47SOPbIPmSQ7QKFNw7lSKI9gq2JlhIy6Ak7hrNOqCWDB1p6?= =?us-ascii?Q?T9YTT7TJbSh1Ia7UkfFsSI8NfRI7mSjkeS/68vYtleh7EvNHPepoNtpTfleU?= =?us-ascii?Q?b6T854VZE5o3l9W1OhA/ZJQO1spXR8B83LrWOuHunCVyPInpZHhFmnTtDkJE?= =?us-ascii?Q?KTYFEX0W/kJbsY6DRqsXT0WlkKmxuZmCnjDpKjbzc1Vntg1pLkAm4PDDab1O?= =?us-ascii?Q?cPFo4lw02xkDE3OSDo2Qljsh8SVplo0/JFgyhN2uYQayn7YaO4g+WJ4HJXZT?= =?us-ascii?Q?HrIZU6jjLI7axJGUz58YtFoLMj0EKx8ZcjMhjrQpjp12m2UgWSRKwuqAqNsz?= =?us-ascii?Q?pHGG3zA+rwTwaKjjBpt9VwVvWc3J3tVTrJHP4xifyLcExCHaVfff/kJwN4bV?= =?us-ascii?Q?uo7/U0y/lw2tQTKRV7YAXPMdMKSzD3Bdag2i401dw1OBBizLgS/5llHpe+Ce?= =?us-ascii?Q?Ysy+xphWeAvkkp49pNcPUR7RX0Ck1X66LzaOVhaSiJTOnkpk/uJ8GyV4nWWD?= =?us-ascii?Q?SKQAxpgDXePOCrNKilrHoSpr/0E4jL9KUgcyohFNv8A8nJtE5g=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(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 Content-Type: text/plain; charset="utf-8" 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/a= md/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) +=3D amd-pmf.o amd-pmf-objs :=3D 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); =20 - 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/x= 86/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 =3D { - .supported_func =3D 0x4003, -}; - -static const struct dmi_system_id fwbug_list[] =3D { - { - .ident =3D "ROG Zephyrus G14", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GA403U"), - }, - .driver_data =3D &quirk_no_sps_bug, - }, - { - .ident =3D "ROG Ally X", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"), - }, - .driver_data =3D &quirk_no_sps_bug, - }, - { - .ident =3D "ASUS TUF Gaming A14", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FA401W"), - }, - .driver_data =3D &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 =3D dmi_first_match(fwbug_list); - if (!dmi_id) - return; - - quirks =3D dmi_id->driver_data; - if (quirks->supported_func) { - dev->supported_func =3D 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_de= v *dev, u32 val, u32 preq void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_ena= ct_table *in); void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_t= able *in); =20 -/* Quirk infrastructure */ -void amd_pmf_quirks_init(struct amd_pmf_dev *dev); - #endif /* PMF_H */ --=20 2.43.0