From patchwork Thu Oct 31 04:09:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857527 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) (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 4EA3C26AD0; Thu, 31 Oct 2024 04:10:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.78 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347830; cv=fail; b=g5qlJfXmzgktqmCeOkZFD+TKGcuvO78sXBPDFDMJynfn77Ll2qdtj8Uv+5m6Sx4mutJP6fIoW7/1VJmNbsQ0PN82Xd1pB8GkOWwoEU8O+q4xexUVlJZLt8BaF7k3hD1baKu39JTtVuxB04tY3q5H/n+5LBqTi8A7uHvQJXDSL9s= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347830; c=relaxed/simple; bh=LT207b0D2cujNgfZlGy/3GMB9YtgAVWVYuGVhHvtPc4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zcpb4NxF8qhqXj0ByNzSC0UU2lIiwdrEHqZTqqVSYcPDtQ1fPdgW1wE0+Vd5cmStTM+ymLsE2M1UwdeMEhhb8tZ5T909bOrjNBQB6I0rMVM52YX502r/YoMn9J9izRmswtDDoKQI88h6x85yzd9MXHoi/AhQDLhmoct1oAL2pAY= 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=e5XdRNFL; arc=fail smtp.client-ip=40.107.223.78 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="e5XdRNFL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=K4IZ2MBh9LVA5nzB33kTQr11Er2vp4pbB9BmYCIVaTyUgH7hOW5g3yr+vNuZq9K+T11ttTIXF3c5f7/1AgehXLusL5Ddo9XRMO1iSKBoB8Nnf2hV3ltjpBCmBSMCw4Oo+A71mgKHw0G+nZ0hEq9D7Sr/4a0cP/N+vAHqZ3E55Z2Mqfr+rJIHOGwMTJehggGQ+FzZjTKgDV/67oq5uONSjpbseeleWZGCrHChY4ZlXGiqrOGIZBTZ6Dm3RbW6ccvoaZL9jNsd5U5+zAvA+Ewc63XAXlD3s+fE23OkxaOv+7GkgN87Nu+Eb4TxKXudMrXioQck59MQ+LuLQhPrP7ts0Q== 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=wEaqHAtFNbzbSffeGrvACYzTZMNrQiHOw2ZiVs6GbLU=; b=JcnBpfZNCHiixlS2I+w39oqTt3RWkX8s0LNQ4EzDWvvBHFt94XVXCDdkKKZzmezB22yT0n4Tme9B7tDeYhMG2LWQboDKLaWVUxGzwc6EsOBnpH/Va7OnAWHJ2cGOH3bT/AnlQgcesqbD/wu3gb8XqWlhhgUvdI9yU9tfSYsJTTCbV4CquEhCquJTlRXYzR3n79LYbxl5vsY8zuwjudtEzBpUXrgAZFBl2+3Jf9mkTosTqGEcAC+sc0r8l/b2n00SWEENlJgmpPCWOFgcHjRc4XNyvNj1YqUFnqP/W89EPlHDvsLXqyyh1phM+akld4kQz3Z6snfMOhd6BO0WlpZ6UQ== 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=wEaqHAtFNbzbSffeGrvACYzTZMNrQiHOw2ZiVs6GbLU=; b=e5XdRNFLrKm5laqngo8YqCwR9VDvO9rIP9m8mlq1+wUcNL6J1t+Ln5lXbsF3+fIpTiNIl8Pu+ty8WMTv4bSzLY2hGyuCcQPhXMMCV57oXMJ2ykDbFc48L2hG/sqDIMSIz4+xz61NC6j9wjReAKoXFlr6zS0yA2Qn0oouJM8zAXA= Received: from DM5PR07CA0117.namprd07.prod.outlook.com (2603:10b6:4:ae::46) by BL3PR12MB6428.namprd12.prod.outlook.com (2603:10b6:208:3b7::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:10:22 +0000 Received: from CY4PEPF0000FCC0.namprd03.prod.outlook.com (2603:10b6:4:ae:cafe::5d) by DM5PR07CA0117.outlook.office365.com (2603:10b6:4:ae::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10: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 CY4PEPF0000FCC0.mail.protection.outlook.com (10.167.242.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:22 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:20 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello , Lyndon Sanche Subject: [PATCH v3 01/22] ACPI: platform-profile: Add a name member to handlers Date: Wed, 30 Oct 2024 23:09:31 -0500 Message-ID: <20241031040952.109057-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC0:EE_|BL3PR12MB6428:EE_ X-MS-Office365-Filtering-Correlation-Id: d010ef96-e0cb-49eb-03c8-08dcf961f0b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: swqYY3a1kIz4LR0qWlgP3g6/2VtiDGC1edqwCMkxuIunI7iIHOs/JAQFkulPC7F/rjYb3tXXtb/lbVguRB3ANGNgliN9o+WqJczCXe3+Mv+CSX/LYAagCQJ+bxZ+qB9lCXMMxfDpeA2O44HPP7OjhGWKTaFzl5vNzkkwMkrhWxVFG2mwcJAsv5jUUQk7gewv+7f9jwqcjBKHn3TBHUUGozJDoCXOh1saPeHLjEaDcznAZ6jhSUcmZOVJjlU+E16ZQoKAroXKpq0mBFelbUbHdUZp2CFBR4BylmrZruVA6aoTf+yKhcuqaT/Zjld/V2PmpS7CxeWaJetJX1Jb6h+lkF0tBko5xii01/xAWaHVJAUv5v4hu5CZ/1dB/tNs5pb32QRuN9aI8g0TSqtjWgr333Y9l1EYGmecDMVRSQMqUvD+5GjdjuTgLmj2bylem43VzrkXOTcpkpBKCf/7JATXveTBim3kR0+bk9ZjkthWJTiaGKea15/5NZaXohQ4ljwPKwOxg33aDir157+qzX72+RnHDa2hD1xwJoS1L0u27+4q4YRMbeIvZ2z9+mRweRizTFRTo2hQROpAyd4Podu+2itReBIGvcLIKiN8MPZqdizf2J6ySPqIjsyzB3ATZSLPq4grjES6Hhdif1+qx80MomBBoFEDByy+OLaPz8XKFPPn8uD4itoNkr47uizT5EaRXpegk1y5F2HzM/s0DCJVafZmlKO+so/hdrMws484GR5tluE+d38VJ2/Jags1KHHJouMLZZwD/uB5VKo+7e7c3NtI8BvRck98u0ufqyBKKGMc9dIJV/ADidArsaNFdlzczFjMFfSMU/ico4ytLIyLFL3wyG504AMAwk4ZYWmcQYLV2aWz5t8+spYAcUeLrn1Rb7u/WMk7gOniCsU2nmzYqhO0CwM9agY5VyHMJ5WHGF3I3iMF/BSN6nj9tC7JaL2P0xc4g8Fcj8OkqAGFHeCBwbh9Viq9dtjwRdcDqOmLyC5SptqF2r0TztrOkoUVf6I4uR5V5yTTaLOQszecUdYYyuImRjtlQZY3eLYMHVT+jGXavvepKp4TDqDAJFljmFX+TZr1kZPqEH1TaK+jzIXpVeyTKfoc5K3FiGQDVsWaC955kbivBkfu/gIUjFQ3HUpioKA4Nu3t+jR3rIbWg6KmcNMAi8owIoFStc2E0ykMLfL/Hcp7qMnyYK7Yx9l/GtiKwPp2I1pIr/Cf3teJu1pxN0m1x1hJ9ZU7+POT89OIk7y6nw6rljSkO1TIpu2zmaUQ9E5cYNyjYGui9gWWzh1bfeJIX+yFY9KtnszYXfMOoTE+/BVR6N8xV+fsnvAGa3BoxgLffDrF/EqPX9o4/i0kdPo+vJdBKqIWCiuGbZSoMdB+41/ltMdMNkLHEowTpGj1TYcHrwQyahBUJdR1Fvm20w== 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)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:22.2871 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d010ef96-e0cb-49eb-03c8-08dcf961f0b6 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: CY4PEPF0000FCC0.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6428 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 Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Reviewed-by: Maximilian Luz Reviewed-by: Lyndon Sanche Signed-off-by: Mario Limonciello --- 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 08db878f1d7d4..9d3e3f9458186 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -211,6 +211,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->sdev = sdev; + tpd->handler.name = "Surface Platform Profile"; tpd->handler.profile_get = ssam_platform_profile_get; tpd->handler.profile_set = ssam_platform_profile_set; diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 7169b84ccdb6e..13a97afe0112d 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1883,6 +1883,7 @@ static int acer_platform_profile_setup(void) if (quirks->predator_v4) { int err; + platform_profile_handler.name = "acer-wmi"; platform_profile_handler.profile_get = acer_predator_v4_platform_profile_get; platform_profile_handler.profile_set = diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 92f7fb22277dc..e2d0cc92c4396 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -405,6 +405,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) amd_pmf_set_sps_power_limits(dev); } + dev->pprof.name = "amd-pmf"; dev->pprof.profile_get = amd_pmf_profile_get; dev->pprof.profile_set = amd_pmf_profile_set; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index abdca3f05c5c1..6177fbee60573 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3920,6 +3920,7 @@ static int platform_profile_setup(struct asus_wmi *asus) dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); + asus->platform_profile_handler.name = "asus-wmi"; asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 972385ca1990b..3cf79e55e3129 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -247,6 +247,7 @@ static int thermal_init(void) thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL); if (!thermal_handler) return -ENOMEM; + thermal_handler->name = "dell-pc"; thermal_handler->profile_get = thermal_platform_profile_get; thermal_handler->profile_set = thermal_platform_profile_set; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 8c05e0dd2a218..10a853b6b0514 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1624,6 +1624,7 @@ static int thermal_profile_setup(void) set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); } + platform_profile_handler.name = "hp-wmi"; set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index c64dfc56651d3..6c72d1b6a2aff 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1102,6 +1102,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) mutex_init(&priv->dytc->mutex); + priv->dytc->pprof.name = "ideapad-laptop"; priv->dytc->priv = priv; priv->dytc->pprof.profile_get = dytc_profile_get; priv->dytc->pprof.profile_set = dytc_profile_set; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 8440defa67886..03da2c8cf6789 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -177,6 +177,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); + priv->handler.name = "inspur-wmi"; priv->handler.profile_get = inspur_platform_profile_get; priv->handler.profile_set = inspur_platform_profile_set; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 4c1b0553f8720..c8c316b8507a5 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10549,6 +10549,7 @@ static void dytc_profile_refresh(void) } static struct platform_profile_handler dytc_profile = { + .name = "thinkpad-acpi", .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index f5492ed413f36..6fa988e417428 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -27,6 +27,7 @@ enum platform_profile_option { }; struct platform_profile_handler { + const char *name; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); From patchwork Thu Oct 31 04:09:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857528 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2072.outbound.protection.outlook.com [40.107.95.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 059EB126BF2; Thu, 31 Oct 2024 04:10:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347831; cv=fail; b=LYNFi9VkKP9iELRy6xjLzR5oHPghcVpQmpd2K7DKfmUrIyLg5wdD160cGP+YrXIvZa/Fx4uCn9YlNNjnJ6Vif3+wTtfDMAbv/B31uUXo5AOtByyGWuVTvqLE0PrxPwbzXtp5fuoHaeDTVKC/iu7wXCOQ6tcpXGgzqtYNfSKk5CM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347831; c=relaxed/simple; bh=7Y1ye+dojnd83/ekD+XzCxFvj3T3Qdw+9hKUx108gN8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HAQu89wqgvAU5HNpYiDSXqDmSgt44ohUE2Rgxc/KIUhDIjYMYNWcq8bdBcTdsH4NyxZoHTe5Zr6bjEMw873/wIQFLosI0lZZH98oGg4PULdPIetmAFx+d9hsg/LW14XcjGUGSOiLHdLBSh22UfHqxYk4oC4PMkYJFnZh87UbuvI= 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=2KpgXbyk; arc=fail smtp.client-ip=40.107.95.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2KpgXbyk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dt4m3UGcNWsA9MCcZNvNmoecQwK2wvwOE+19L6WC/wi0Jl9IoZaXy7T2RzqBpSV1m+k7s1jLqSm91vjvKTcJdtxXxiNYFZ64jaMZir82A+9N1JG/4upDqERv6T+tCBtyz+8Z8NeIfi4VmJv3rlu3rZZYQT5ko0YjAU6C9f940yppRssqhlVFXtELlrO1xVKBMDNiL+iQ2k5Dic2mSbFQ4+DUkIL/ZK1XWfS2nQk8tOJZip7B+/7YZwYYrAEMesEMexVWwY2xcBDzjvbZVaBc3HieRCCqVUBiMl3uzLN9Lum5nxgbiSm6KSWmLZei8KalXga0lYfr9ekh/QHkpTs7EQ== 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=1mUyzhBT4vy03YoPp8fHD/o7qorvv1zgUumIXEtGe6k=; b=IhcSaG3SUgZDjQmnZ1H/8/gVIgpoOkCHKGX013AHy9Gt3bLIrL5jMZ4MoU0UAxWw3bCk/5dsfKRWgzff7kn3zv1a1Vb4DlbRFmoIK0r0ZehSHlJPZ4sLmo8Ws1gyfDGLM2AW4ZAEBs7dYMO3wiisz5zbg+kZERqfwxc7rpc8TMusj2PvM9C5PoK9pLaKvzW/Jp5tTchHFIX47ZA21xmZH9cOr7eyfYBrTLoRACavZ8xU+x3a/3SZQUXMzYhwQcB7I1negewnINUvyhDNlcLUmMdhKK7XYtcSucNNLq7770xTn4lLiiqZAb0pHbKLnGAjWGHSDyHgdD3Z9j6N3J/sGA== 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=1mUyzhBT4vy03YoPp8fHD/o7qorvv1zgUumIXEtGe6k=; b=2KpgXbykLWalcayZD6Cz8RCvQbwm5S4/H0qrkoXHbk/q5Gorr/STgFclU2ZqpdyeyT+elbTWvYKqJfLUJc9jDUOoKgVPN5Ct372I55zBzSmzpN42v5qO3TnTNRXI3a42/hLt5YS+cRPxts9j67Eypl7HdG8MpgyMWBIKU11t7p4= Received: from PH7P222CA0020.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::8) by BY5PR12MB4066.namprd12.prod.outlook.com (2603:10b6:a03:207::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22; Thu, 31 Oct 2024 04:10:25 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:510:33a:cafe::e) by PH7P222CA0020.outlook.office365.com (2603:10b6:510:33a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:25 +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 CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:22 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 02/22] platform/x86/dell: dell-pc: Create platform device Date: Wed, 30 Oct 2024 23:09:32 -0500 Message-ID: <20241031040952.109057-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|BY5PR12MB4066:EE_ X-MS-Office365-Filtering-Correlation-Id: df2096cc-1754-445b-ccbf-08dcf961f21d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: zjd8H5bjiA8ZaMseRZvunorrLZd/UuAHQaf0FxsNdNfx9IuhqdgKNn4sj7P5bTTlpaDFNKQfbA2kf1Ruchy8NgDlWbOX26NkYHkYq9s/YtWHCvc7ji09AG2LX6ccK73oJz9g4Iw+E/NatdMb+Y62840YRSwvQBe6C5NMP9rhOJOd7ip24zycRcn9PS3Kxn0Fg6SsQp48ZEptJ5jTepKUb540XlRhPV/AA5t/+j7CzKFQvteYMIImOS3eZ9U0oFA89E7LHs2ybnWXDdQXZj1o+AKGPR7j7MHs3QE/k9LZsrqbKUQXgqdQ+7FeGK+PfgC/7f2kL9RdEjnGpUfY2epjqvyahEKF5+p0Vf5U6Jy8oBZNajBrvYAgapf/P+1V4FlufMv6YrUG7QX42VF3XuEpZp3CYv5Dmp2Sgl+U9jnIq0JHnrhukw4300lrgoOvT6jpm4SW8MViBcCUqw+ug5HgliGwYFk7oJfuR6vVvA7PvKJYrfm49JnBEl2cz+PQEfn1dRlS/17kh6ocfdbQQIZmRpyXnqLGKsjaSdOfhVthGcPcda0LzOGpB7D4GCpUeAFsCCxaZEKKO60rzNQbXn/s842hk/WrArJbORp9nKTsB6yAbO1CcXCaplB4iKvarmR8yQgh0mNpyWg8GjEl16ZCCFUkDkBh/wd1p2aZZjd680XXwc/6l1zQv7r4C2P0G3NEyzSS8rb4KiTgJ/kazLGoEbOyJ7PErXIOUjyzjPvRxzoFg+wcZMXrfHyatVQksige05ntCR5zKezRSfi40EoRxH8g1dD5AqktATjDHnyEAMJ3lkJteUqrg2h0njld7RQCWYUKuvnGSWorj19Z9izriR4ds6GDiFLsOKMqYoesbChFi0HnbBGZdzg6WrQc20hr9Fu1UQrAM692VXCjjh3nkONSn82VGmP0FfLI/Rb6CHluhFKnglXDR1ipWZG2y6gd4sI2OiSNgvbNXAiGYLrlN9paQ04jjKmavoxcBRWTCkhVjxok3e40KEPcUYItXLBWc4B02FYoT3gYLX5OTWUNkBsBaqPeusOS5QPrkWnIgdIhRLmba8J0opMRkdH9OkxJW+0tNBudMKYfUROp9xwKRbDCGzkN3tu3j05mHJiMO1s84GPe05XEj2a2UIeT3P6/bgpSy3jzOZTwberDsUQRcyPSaXlTHxdnzwLrxJbRJgK1aarS27pLJRalWfcplsIRC2T4K2xd0OSk7QtA0EmBZWiQe4aLC5OvLMOvGn5ATA/B1kR+SHO8VzN40mZd7M8K4L6BwaD7gyX5Jmw7fdLK7j6aEQGI5HZAQZkIvI9iC+Nmtqwiz8C+p5NhEIW+iE6D0QL/PjLDhwYzorzyaFoXmGYgqYmz3zX+LpgjaI9RKMjI6ZrjXJYKQBg5Z0l7BUNgxh6WB452mM1QxA7wqnuIYQ== 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)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:24.7232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df2096cc-1754-445b-ccbf-08dcf961f21d 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: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4066 In order to have a device for the platform profile core to reference create a platform device for dell-pc. While doing this change the memory allocation for the thermal handler to be device managed to follow the lifecycle of that device. Signed-off-by: Mario Limonciello --- drivers/platform/x86/dell/dell-pc.c | 35 +++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 3cf79e55e3129..b145fedb6b710 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -18,10 +18,13 @@ #include #include #include +#include #include #include "dell-smbios.h" +static struct platform_device *platform_device; + static const struct dmi_system_id dell_device_table[] __initconst = { { .ident = "Dell Inc.", @@ -244,9 +247,18 @@ static int thermal_init(void) if (!supported_modes) return 0; - thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL); - if (!thermal_handler) + platform_device = platform_device_alloc("dell-pc", PLATFORM_DEVID_NONE); + if (!platform_device) return -ENOMEM; + ret = platform_device_add(platform_device); + if (ret) + goto cleanup_platform_device; + + thermal_handler = devm_kzalloc(&platform_device->dev, sizeof(*thermal_handler), GFP_KERNEL); + if (!thermal_handler) { + ret = -ENOMEM; + goto cleanup_platform_device; + } thermal_handler->name = "dell-pc"; thermal_handler->profile_get = thermal_platform_profile_get; thermal_handler->profile_set = thermal_platform_profile_set; @@ -262,20 +274,25 @@ static int thermal_init(void) /* Clean up if failed */ ret = platform_profile_register(thermal_handler); - if (ret) { - kfree(thermal_handler); - thermal_handler = NULL; - } + if (ret) + goto cleanup_thermal_handler; + + return 0; + +cleanup_thermal_handler: + thermal_handler = NULL; + +cleanup_platform_device: + platform_device_del(platform_device); return ret; } static void thermal_cleanup(void) { - if (thermal_handler) { + if (thermal_handler) platform_profile_remove(); - kfree(thermal_handler); - } + platform_device_unregister(platform_device); } static int __init dell_init(void) From patchwork Thu Oct 31 04:09:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857530 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2056.outbound.protection.outlook.com [40.107.95.56]) (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 CC54D13D502; Thu, 31 Oct 2024 04:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347835; cv=fail; b=m820QSpFtvYCSrKNMMHLY6ylDkBtAt4OvT0AxfTBi3LKtMqpBki/OugZpuIHIH85KGwTK66bt30pynT9n7tNAMeuoP5oK3NNJ+YoiDdhQf5GHjOcCPy7zdy90qRCjHEZDVSICs51hcskKVl7jf+7/Nj8/2AXC4Xam4Y8j5WAYa8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347835; c=relaxed/simple; bh=Pi8a/vJuw+WnaI/I+TEEffa4Bpy42bLAbqsc9USwYpM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Xkslp7+acPP/HPyX2ulp+DOLKrH3uYVoC+p7/8k2jLLOzkLeJ5mjddEjUAiTUGLaXOrecMdmUd4Wl1DZ7ZNR/NDQiChxYvrxFh5P0lZ6X4N074sLIk3tiltC/hK5K2EJdzlFt2w9MS+KZk3EsnpL90kWYGqtTmGwWTKC7sOB4sg= 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=LyEc4zuN; arc=fail smtp.client-ip=40.107.95.56 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="LyEc4zuN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YjA5xnGCkBg5Aegp1EmcgyHnk8qTorhXGMAhtxmimaornVk/67huZMi//44N27376qImjehd1YXsXiYz9mQnMYzcn4MK971Ea9WG2o4q2YNhqhAmr9K1kM1CoVG2TpFPZLxy9jCF7i8OinKpGySKGlETS1p4BwdrCS+yydc67q3KfAFyOZX4jHawfpHZhzck4mNTNPTtNhV60SXLYUWwBx6BdjN7BhNBa7Ad+3POuXlGxdzQh5I9U7z0pCWIyZAHjcdIP0qyrkqAlqeSutY25ihTkUP+ZBvYHJpL5Y9t4YzSAKboFm9bumGOlhb1J268hRMMcsIYeXqUYM0vs2folw== 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=OhvVpL5s8sr72BvRS6yZGodBn0fZHl5FV/9LqwVd0aE=; b=TMaDn27h66jtrBcGSrJZ203XbzChT/DGC7xxILB7Toya9ZdIWZFjVrTw5nDqMcaB+qe9L7LFRqJ2CEaIZ9FEhFhvZ3xjTSO/0rjX9gNJeIDCbu8R+BkhWhGwg28aTRmSLcg+O8qfWO8xQX2+PiMk/Pleuyx1Zc40HOBsezATUn1HhpjfKoDBjQrfk/f02m/bYB+KAbynQcWZ5ArCQEcHvSpsklwQIRfLs3urdHcxnNl4jzAe5s00RcrcFhT/sYBPvO3F4N3iKFzjWHqneaREGLx2HO+H+5FugqFd1aPubHcghclmtF9wdXySnA39m45KvQQKi3ROsYRhvy5ucCugSA== 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=OhvVpL5s8sr72BvRS6yZGodBn0fZHl5FV/9LqwVd0aE=; b=LyEc4zuN1CBUjIgu0efoOOMJApxvFcp3nbmJTE4j8Hs5AJnG0L+VuGkIGCRHxmLRu5+nyATEuxMCRQk1nffvVk9w/jCcllzVeodrspcFVgwLeLG9mU3FvMqhvwhqPNiki0CBr/p5rzdqwRMWWi7D79y6hZ7wY0/4BYEDYGdT+bk= Received: from PH7P220CA0083.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::19) by DM4PR12MB7765.namprd12.prod.outlook.com (2603:10b6:8:113::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:10:27 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::e4) by PH7P220CA0083.outlook.office365.com (2603:10b6:510:32c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 04:10: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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:26 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:24 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 03/22] ACPI: platform_profile: Add device pointer into platform profile handler Date: Wed, 30 Oct 2024 23:09:33 -0500 Message-ID: <20241031040952.109057-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|DM4PR12MB7765:EE_ X-MS-Office365-Filtering-Correlation-Id: 06dc93f0-af49-4773-8fce-08dcf961f395 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: DkCMAQL/9VT6TMqvWCpjL4QFYFcch7YJ/4o2s1du+cs3R8U11UonKaJsCphwevIuS9njMjRJJ/BgXPVRFhM25ya+eq79sz+pMwptsDwYI+TPhpqRCYSnVQoDa6afGE9ocQ2143G1XmlXe9OFtuVgUGUXbzDR8bcH+aRhDUQwKJFbxqyv4KG+/N4ujO7Wb6bgA/A/z4zRFDOahOc4PFLF+ug4kSo6WQhixi20k6jEIFsr1v1e0429lBI1196/X4bkgjBMXqN6uWtFbuz6qIV1iFyjzS/Y20T8QD6qsr2Yx6Fnq+RAOnWvqvCMGW5fArgR9SX4XzqvOFawbpw9wtTy1wk+KJNcbkS3CkceV7a2pDcRP0LG8AnT/7sg4vIPcjzFUEE2DXzBMczLeyKvOEjQNjqDChfLwa1rudpODbFNi0Chfd4hlV8XTP7xtc0D2FBv0jrQZoFKutB90FqgXXzeGY6HsZ35+0BnDRRowiQYzL+tW0w2QXkXSPjQ8yziu4alP7yaPiGDYlFG7l6/Q0fcyihqP8HfCjsa43wmVxD67AgFJi3HkOgw9kPsRb/AXWOhIZFRtrHZf5D/dbNfRgHppZMlYEfxw/g2t/qTQcrqsyQ5Fs/HzHlpSh9wEWQKXg/RBgokDb+4KIi2FIvqlQSWTI35f3XYda/6E/3njWTmut7jwqkxuqckqDiQnjufDVucVEkwbXbB3aomq6DEaKFvFozPIerkux3YW1QWe+DgAnOJ64ekyHaXIYKCt4h/CBEee0KPDv2vQfT8qaiV+mxySbLOv/VbHkfIkEhs0v/kALgRr2YXU+7knF/K0brZM0vKRFCTprsYINh11Sxm4wajoNTFxQV6RbvrekF2vmLkTblpItOkoL1GHaxFMQr5MOvIdxhJCzvepeOh/dakiuCoJYHanQBrLub/Aw4BUoLwREa8G20POQN6SoWi0t0rLBbuA3ibeD3pmc8tHhE7MfNbAzQZlcNy+dJL8EMabNf306YJ3sDP0SMnTXLZRFprZJYkDvfZGNhJDDyWPYTpIKGiJqeOGt7v/vZJ3iYj7QcYQAxZV9zU/mlzmPRYX1XVr1+413xaJwzbdoY0safS8tplL5R3hFy/+pulvxj7VcS84lARR6fiVNfUTUxoScW8Sq9HoxdJQorFq/XJelZ1k/+FdhsPkBnGqmqwLG8RaUJ8aU8fpOk6fW1Uic1sznFTYaHIIgEJI0T+AqArqLaZlN8foAOot7da7cTuDqpl9Gd3D9ZBl2GAysK2T1bHi2+orLRa8ruZwjD15yn9rfb0AJmDBVyqJDx6qUfkQ1g/6JW9cGmAaEaqgPLXLXKHW4w4KKqx9Y7HVSOdpqpI6BsZdQ3cGWJLOGQHyruy7tWTcdAiKeS56SJezhhfA1brEOtppIHmammRV3jEMC8w1yRv3Lj5VA== 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)(82310400026)(7416014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:26.6545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 06dc93f0-af49-4773-8fce-08dcf961f395 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7765 In order to let platform profile handlers manage platform profile for their driver the core code will need a pointer to the device. Add this to the structure and use it in the trivial driver cases. Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson Reviewed-by: Maximilian Luz --- drivers/acpi/platform_profile.c | 5 +++++ drivers/platform/surface/surface_platform_profile.c | 1 + drivers/platform/x86/acer-wmi.c | 5 +++-- 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 | 5 +++-- 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 + 11 files changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index d2f7fd7743a13..5d9f3f7ba71c5 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -179,6 +179,11 @@ int platform_profile_register(struct platform_profile_handler *pprof) { int err; + if (!pprof->dev) { + pr_err("platform_profile: handler device is not set\n"); + return -EINVAL; + } + mutex_lock(&profile_lock); /* We can only have one active profile */ if (cur_profile) { diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 9d3e3f9458186..b73cfdd920c66 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -212,6 +212,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->sdev = sdev; tpd->handler.name = "Surface Platform Profile"; + tpd->handler.dev = &sdev->dev; tpd->handler.profile_get = ssam_platform_profile_get; tpd->handler.profile_set = ssam_platform_profile_set; diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 13a97afe0112d..a5caa529351ea 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1878,12 +1878,13 @@ acer_predator_v4_platform_profile_set(struct platform_profile_handler *pprof, return 0; } -static int acer_platform_profile_setup(void) +static int acer_platform_profile_setup(struct platform_device *device) { if (quirks->predator_v4) { int err; platform_profile_handler.name = "acer-wmi"; + platform_profile_handler.dev = &device->dev; platform_profile_handler.profile_get = acer_predator_v4_platform_profile_get; platform_profile_handler.profile_set = @@ -2536,7 +2537,7 @@ static int acer_platform_probe(struct platform_device *device) goto error_rfkill; if (has_cap(ACER_CAP_PLATFORM_PROFILE)) { - err = acer_platform_profile_setup(); + err = acer_platform_profile_setup(device); if (err) goto error_platform_profile; } diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index e2d0cc92c4396..1b94af7c0e0c4 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -406,6 +406,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) } dev->pprof.name = "amd-pmf"; + dev->pprof.dev = dev->dev; dev->pprof.profile_get = amd_pmf_profile_get; dev->pprof.profile_set = amd_pmf_profile_set; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 6177fbee60573..1a8c29aafe892 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3921,6 +3921,7 @@ static int platform_profile_setup(struct asus_wmi *asus) dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); asus->platform_profile_handler.name = "asus-wmi"; + asus->platform_profile_handler.dev = dev; asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index b145fedb6b710..730f97aab70cd 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -260,6 +260,7 @@ static int thermal_init(void) goto cleanup_platform_device; } thermal_handler->name = "dell-pc"; + thermal_handler->dev = &platform_device->dev; thermal_handler->profile_get = thermal_platform_profile_get; thermal_handler->profile_set = thermal_platform_profile_set; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 10a853b6b0514..1b6677e176769 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1565,7 +1565,7 @@ static inline void omen_unregister_powersource_event_handler(void) unregister_acpi_notifier(&platform_power_source_nb); } -static int thermal_profile_setup(void) +static int thermal_profile_setup(struct platform_device *device) { int err, tp; @@ -1625,6 +1625,7 @@ static int thermal_profile_setup(void) } platform_profile_handler.name = "hp-wmi"; + platform_profile_handler.dev = &device->dev; set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); @@ -1664,7 +1665,7 @@ static int __init hp_wmi_bios_setup(struct platform_device *device) if (err < 0) return err; - thermal_profile_setup(); + thermal_profile_setup(device); return 0; } diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 6c72d1b6a2aff..feaf98819dc82 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1103,6 +1103,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) mutex_init(&priv->dytc->mutex); priv->dytc->pprof.name = "ideapad-laptop"; + priv->dytc->pprof.dev = &priv->platform_device->dev; priv->dytc->priv = priv; priv->dytc->pprof.profile_get = dytc_profile_get; priv->dytc->pprof.profile_set = dytc_profile_set; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 03da2c8cf6789..5a53949bbbf5f 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -178,6 +178,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) dev_set_drvdata(&wdev->dev, priv); priv->handler.name = "inspur-wmi"; + priv->handler.dev = &wdev->dev; priv->handler.profile_get = inspur_platform_profile_get; priv->handler.profile_set = inspur_platform_profile_set; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c8c316b8507a5..222fba97d79a7 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10616,6 +10616,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) dbg_printk(TPACPI_DBG_INIT, "DYTC version %d: thermal mode available\n", dytc_version); + dytc_profile.dev = &tpacpi_pdev->dev; /* Create platform_profile structure and register */ err = platform_profile_register(&dytc_profile); /* diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 6fa988e417428..daec6b9bad81f 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -28,6 +28,7 @@ enum platform_profile_option { struct platform_profile_handler { const char *name; + struct device *dev; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); From patchwork Thu Oct 31 04:09:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857531 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2086.outbound.protection.outlook.com [40.107.92.86]) (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 E1F2D1422A2; Thu, 31 Oct 2024 04:10:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; cv=fail; b=VQRFvKQEiF0RTiE6XeYUyXG+5GCB7Ymti0+5sqTpM2KJEbC+77cwDyAbCUwS2n9oc3XRaAVernHkw1D3J8M5I3xW2YoZlJoX/z4rcdcVRib7w8cX+j+74qT0PC+oZ8jFyDihgc3KQ1buK9y0W9zMCpv8QfowS/VMbsdpWey1hsY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; c=relaxed/simple; bh=dB/p5is31qIeG25xbZm/v3EQsv85jK4gOHnlTJJd0WU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F9vUkzC+sHQHvqHFk6Ci4CvLTStp3xXQfHJgrhq/0URFtAmjUJpgKExIw44U9rn2P4XrXWX9bwO61K87qlgNIP0d1H5f+ZsdKxiz4wm7+zEnWA/XRc78+KaLQoVY6ITOgeHevSYQSFLBnInkCBVzS4lcMkZLcYvdyzabt2YXAjU= 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=iqYU643J; arc=fail smtp.client-ip=40.107.92.86 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="iqYU643J" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gbc/aYnJUrexWB7TDvDwNTqputAw0iDn8eJ/x7G0AHF1D9nfV4JFZocqrbrBpptg0YkU4eGUsSVeLACOnZaTyckKqRNBbLVazB7qRD8oq64PburHgNu3ZI48fPwKcdwCDUtEILXrd7LyU02yE85Ih+hmuDXQ1KrdMDEg/mnS8mVY/etJXJk6ulbI/FiUkugaCk28neQHN/FKZEEkSQn/fZwCjoMv3zdQYq4rz5S/gFHRJBflAxl7nqWBZFtAGHO6+R3p5QLT3n8W/baW0zlzZUZ+x94mMMj8HGTgq9s1zPEm5Phwd8eGISxzM3+bxJ0cCOuTS6lE329SBsUBqCP4/Q== 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=KQav9+5aq1tZTigIRlc0h8HY9zHbD6WOzLNTqDVgPhU=; b=p3we7sFpFJe+MUR7i4Ijp+NMw4p0VC+8DezQMMU90SH5/SJ1IvOm7tADVKMmBW+IVQCss+ZCHuUiGIgoPCKVYDzirwFIF2mHk0ajFQGE2ONHl/nMjcmgoskHdMZysj4ZibENcvnxCm4Pka1G7G6RGf3Y5TWeccH2oKtlw4kTbQAtEL8aqLl1vhTPiA5h532H+FNoPkhkcbz34sNHNakg8EVOjkTp/Uh2GdyAKh32dp9oEO5anZYKEeKJlYvy53GzMOPYnQBSz3iEPxwQG0mrLZIsZCLXrOA//gAtxJwhIz5SR+I8y+PnD8ibFOXU8EVO/fPfSWCUXOD/zXCbmlPOoA== 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=KQav9+5aq1tZTigIRlc0h8HY9zHbD6WOzLNTqDVgPhU=; b=iqYU643J5fqXrvyrT73vvJ8o0P7m48Q8vacfu7/L64xzGAXMnHMXifXFC+o4Fg/QBauqVxJEiGHKBL1X+TUSd04xXw6VVmOvJSLVJtTymlMAX2bY1PVn4QN6OOamDcPz8jF8Ca82/ojCmFXsaaRA26hbtxwFFNrRBHyeF9v4mMc= Received: from PH7P220CA0075.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::11) by DS0PR12MB8415.namprd12.prod.outlook.com (2603:10b6:8:fc::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.34; Thu, 31 Oct 2024 04:10:30 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::6b) by PH7P220CA0075.outlook.office365.com (2603:10b6:510:32c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 04:10:30 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:29 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:25 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 04/22] ACPI: platform_profile: Add platform handler argument to platform_profile_remove() Date: Wed, 30 Oct 2024 23:09:34 -0500 Message-ID: <20241031040952.109057-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|DS0PR12MB8415:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c5e63ad-8741-4106-55af-08dcf961f521 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: xg+Fc5mTssk/06s/An3xrkZgsl8v6ksDhg1qC05ZloZv/7blD1kpDUF0DrsbX/O+K0sd+kqG13DBh/dxcxLCIILltu4n0wJl4bOawdjti0ZyWONDORUOPJ8suvDHSr37ahDuAwZDEKBuGRoHsauYEHlNeI1Y4YreLikKMWKpoMymXWGXcpoyX1ih63mmFy+ZO6z9jc2OmIAINqOdrMxMUFLY5k7+PJ7cOh0r+MZc2Ab6l8U4kJw2m5vq4JoTreJSv8uIO43+jEuvM8Sx39OtCy7F5oJ5wtSznbC2IHzDe+z+h15AxFxkwTB3xWRpyz6BfgGQy9mERFS7QjkSFsUwRjPDJYgg1NFUeW2U6Fbj8x6M9c1/PMVxCt4vOSAtnVqIcWmPpda2uabYzA6ajQNKogcXjnPMwJdIC+mGRrhYeYobX8tuJzwwvJmKFWDLqfENQnmB6LifYCmjfVW2B9xo2jDDHN6HiPzZ4eQJ5zUCUQ1FaWkNwbvCSyTBcCEOhhnxH+FvMIOslEXHl8RrUbFuSTy6HEgZEHBhEqvA80pUSn5zD8E0bMYjAXBuP+oCE97sQ5OkmiJKKQd3hVKOOGAYeuVKRll2g+GNJAPeMmTcxh1qMLa8Y9mjDaHpxNln1HGgPWoMDOEXgBHW71YoJxjWo6P8q+cFWAUFP2R6zgdyMNOiJ0ORYS/Z1IL8uI1MY06FeT68g/QzKKwfQIO/qZ1QSMg0jr5/tTmteIjh4akY4u28duV4eMJQc6XQwb7XN42bUJsPgZeQ+oUSJdGH6DGmD36h9yppL3KBXrTefD9DPYt5rII9Bh8R+E8SJ38vnAkl/eOTWK2O4iPY8bvekuqzZCEirvQUq80JskQu80aw6CNA6pyWiJLVdpHsBbDkWqh3HulRvfam0CuORbJaoucGEjxJrdbMnWZCQC5xwpoDH++pjTyW8cOUj7XGdmlQAqCFERc38Crae4YPUTSzZrOFdQLkwe1BgVgeAUIkPjC8vFnNLi0IKCQ0mXkdGOUOGntYtiI+hZy9Ls1CNzZ3YGQiw608P2R5IpEfeFHhQ6GNM4LeZZlhIw7avkFQ2VfwDWhVgupSFFrpmtFNpwmejc8Mxmz1aL57WdjDxlIYasWdDTUPTaTn0Ns2B5o3AUTDtZmjvoA/uM5Bv3YSaa+VR6p4CQWAgsBIp2krHTHMPDUlhjWx+1cVo8unfG+wmdU9nclqrWQXhCtTk3YPFyoo6zd9LKHcNU8Aukb6tV4wT5hKiEVIDPzGszPNrX/X76ZBvXHF089DCw+j35E4waEVFd72w7iSbl2I6jzrBgHaVKaUxB73MzEJ0pbTyKChMv7w+HMP93R8TKqdeYz+vWZRn6NKBFFryVlkYxLKJPKlTAZTKxE/Cc+yScddK1SIyr9eWZEo3bl+EgkTZvnHp1ZdAnMQMQ== 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)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:29.7014 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c5e63ad-8741-4106-55af-08dcf961f521 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8415 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 Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Reviewed-by: Maximilian Luz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 2 +- drivers/platform/surface/surface_platform_profile.c | 6 +++++- 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 | 5 ++++- drivers/platform/x86/thinkpad_acpi.c | 2 +- include/linux/platform_profile.h | 2 +- 11 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 5d9f3f7ba71c5..c76b8e3fdcde6 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -210,7 +210,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) } EXPORT_SYMBOL_GPL(platform_profile_register); -int platform_profile_remove(void) +int platform_profile_remove(struct platform_profile_handler *pprof) { sysfs_remove_group(acpi_kobj, &platform_profile_group); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index b73cfdd920c66..6c87e982bfc8f 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -210,6 +210,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) return -ENOMEM; tpd->sdev = sdev; + ssam_device_set_drvdata(sdev, tpd); tpd->handler.name = "Surface Platform Profile"; tpd->handler.dev = &sdev->dev; @@ -228,7 +229,10 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) static void surface_platform_profile_remove(struct ssam_device *sdev) { - platform_profile_remove(); + struct ssam_platform_profile_device *tpd; + + tpd = ssam_device_get_drvdata(sdev); + platform_profile_remove(&tpd->handler); } static const struct ssam_device_id ssam_platform_profile_match[] = { diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index a5caa529351ea..44992d5da4768 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2552,7 +2552,7 @@ static int acer_platform_probe(struct platform_device *device) error_hwmon: if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); error_platform_profile: acer_rfkill_exit(); error_rfkill: @@ -2575,7 +2575,7 @@ static void acer_platform_remove(struct platform_device *device) acer_rfkill_exit(); if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } #ifdef CONFIG_PM_SLEEP diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 1b94af7c0e0c4..bd2bd6cfc39a0 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -426,5 +426,5 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) void amd_pmf_deinit_sps(struct amd_pmf_dev *dev) { - platform_profile_remove(); + platform_profile_remove(&dev->pprof); } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 1a8c29aafe892..90c20d02e1638 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -4896,7 +4896,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); @@ -4923,7 +4923,7 @@ static void asus_wmi_remove(struct platform_device *device) asus_wmi_battery_exit(asus); if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); kfree(asus); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 730f97aab70cd..65989af2e4196 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -292,7 +292,7 @@ static int thermal_init(void) static void thermal_cleanup(void) { if (thermal_handler) - platform_profile_remove(); + platform_profile_remove(thermal_handler); platform_device_unregister(platform_device); } diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 1b6677e176769..22a7fc64d230a 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1693,7 +1693,7 @@ static void __exit hp_wmi_bios_remove(struct platform_device *device) } if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } static int hp_wmi_resume_handler(struct device *device) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index feaf98819dc82..73030dc6b579b 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1136,7 +1136,7 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv) if (!priv->dytc) return; - platform_profile_remove(); + platform_profile_remove(&priv->dytc->pprof); mutex_destroy(&priv->dytc->mutex); kfree(priv->dytc); diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 5a53949bbbf5f..53af73a7fbf7b 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -191,7 +191,10 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) static void inspur_wmi_remove(struct wmi_device *wdev) { - platform_profile_remove(); + struct inspur_wmi_priv *priv; + + priv = dev_get_drvdata(&wdev->dev); + platform_profile_remove(&priv->handler); } static const struct wmi_device_id inspur_wmi_id_table[] = { diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 222fba97d79a7..13798c6d5fcf3 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10638,7 +10638,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) static void dytc_profile_exit(void) { - platform_profile_remove(); + platform_profile_remove(&dytc_profile); } static struct ibm_struct dytc_profile_driver_data = { diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index daec6b9bad81f..bcaf3aa39160f 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -37,7 +37,7 @@ struct platform_profile_handler { }; int platform_profile_register(struct platform_profile_handler *pprof); -int platform_profile_remove(void); +int platform_profile_remove(struct platform_profile_handler *pprof); int platform_profile_cycle(void); void platform_profile_notify(void); From patchwork Thu Oct 31 04:09:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857532 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2083.outbound.protection.outlook.com [40.107.92.83]) (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 8E9081448E4; Thu, 31 Oct 2024 04:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; cv=fail; b=IMsuWruGYmpsus9uYgnPAenzNJ1ALGvcQAXIk0rO2QVag4UF/Ef76ndoYIaMDOpNYD/7gffU9c13/PCOg8URy0F4xtJtTGD8f7gpWwzyvxbz/k4D7pBogjSL/K1Kce9vzVnIeRZs5+eHxxM2uDLOhuSsZ8WWbB0EZEsgfhsalUY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; c=relaxed/simple; bh=3+yolz3CqVaVknInHwF6eh5BNFawW6KdLcAksK32EyM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MB+wFJOGoeNgDCvhiNLiUus97mtr4R1YSg4yWZezBsSsIFD5OYCW77kd224hF1YYJBH27ZvIZ3PtnPAHduRwfavWINkvqiAO9uzKtgldv9ukULFX7zBNPZG5tbEYZAB1ta/1Nh0jaQRheuOE0Bwg3LyFyvFu25+JnEBlYBTcV30= 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=pJZF0HYK; arc=fail smtp.client-ip=40.107.92.83 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="pJZF0HYK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B/yIbt3uN4O9Sq6UyrwEvLH+OBoN7w66Qj7coOfPGrmO6x2cvz/85cnx1ftqgA5h48kTd7n1tH6/wkByZFmWjC4iiXULTt+3mbPFjvx/UYxvu23pPcS9w+SJKBfZ9x5RfhsRy09hw8+mnpx5d2nscUv8Itxu6GzREeu5939l0Q7tUe0w8ikrpBOPY9Un+C82aM10ch7mR+sWhC7Jau00PCxF4NABWfqvn1ei8E/V7x8DzVsUtYeKmmDwPMSeWn17d2xMvL9QXRemR9HBPX4hXnwpoWyfI7WFV0b7UKDK/M8pnNlwvJvaRnk/KCvp4DvZbyiLchjfxMe9bz74X9N+Ew== 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=YEt3L4xHA0kK5K+bkOWuGumS5UXZV2HyiCh2P6m2MgM=; b=XSaTwDUeOjCk5qQzKLvQijCRI0nELpenAxi4uHLkgAOpwKB5g8T6hFy6wrxguhNaHBNnHkXXaken3kF4FUK2rvXPwPu57C52TGSYWjqxYNj3uNIfpbX9oL4CVObiAozLvMGmH0OX5B8hW7t1P0e+nBAItWXfs1UNDKRFzbD866nnO3hlQlZUnITu4o6SEHZc8d2duasfBs+x1zLgmui/eYPlPHdzSzEqOU4PcYJEhhjZzeLwfySEJ+nC7bQD7Vd9yWqzPNBwViSOgiGCpr53BsbIJFt7RGjKo+EEMd4rZDolrv8WF4HvAB14+w78imlC0PAUBJt1cJtycn0RlYj1wQ== 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=YEt3L4xHA0kK5K+bkOWuGumS5UXZV2HyiCh2P6m2MgM=; b=pJZF0HYKQs4C+HdJYoZSTIqrY5aDClZjTcJtUcsEhEyxvsfAxM0ARkjBoas0GKciwa5lmFcMHEOnXhRgLhhaKmA08NTtAQibWWY/u1UVylPzhVJT0asF/v7+fiapituddz/ekoFzx1Q2e05Tcn2lmd8gG2s1hLL9T356iA6S2z8= Received: from PH7P220CA0072.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::31) by CH3PR12MB8851.namprd12.prod.outlook.com (2603:10b6:610:180::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:10:31 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::1f) by PH7P220CA0072.outlook.office365.com (2603:10b6:510:32c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:31 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:30 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:27 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 05/22] ACPI: platform_profile: Add a list to platform profile handler Date: Wed, 30 Oct 2024 23:09:35 -0500 Message-ID: <20241031040952.109057-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|CH3PR12MB8851:EE_ X-MS-Office365-Filtering-Correlation-Id: 698754d6-39ac-4433-4d0e-08dcf961f5db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: hrkKcBUMQRtT6outp0szF9AL2iETAW7gYE2eN66HOzrbjym3qMr5flKVYLLTLd5U7h73LjWGH7PLb1caLTYVlAuib3mMIk2hc+XU21jJ4WgpcVoFqfep7sCshgMniL2SEBXEZHGXgTTXgAj+Er+dDX5H2YW0QcbvBMF7PK1C0MdqRO1Fv8iyAhwbJkiyelFk32iC6nJrVSj8GwqZc12a/R0VqVlrqtGEomidUihMNBHIe3vpYvjTWduBp+JQ9zLvLTAb24991NTBLN8zp74E1ZOUOcri0oIjwHnvOQlMkKW00rqjJnGhTLPl8z3nddO6NCzyViESYF6njmxqdGOlH92ZnxoZ9CvwHnkffqOwvdc6ILZfnF5JXOtKGVcukbaPrKqh8SF0fVp6QSFQbbIE/3+IjEs4UtJvVsNOS+9zX8TUitOvCamrzsARpDuCWQjKifd792nDUA9l5yo23EflOvJZWcUQdC3ZWGFH9ys/l490+oVibwX+sWtwgQ5P/zsWqSDpoivN9c2z9BgdQNZEcMRV0x9Tgw2PaDgO/1cSEUBRiSPRbpk7VISekoMAhEAIG3By5izVKhr/2GXzGzEPbTogRNN3z34GeOJgcsXedV10IX35rZxWJ92S1UyVPJNExFjIL4JnWhqUjy/GalNHcF7MTSV7JF925EHrgoHMMEDcoR9QexSxUk7GnVHnIYsaAQJrDZdNcOs19dCO4HnlkxNSZZnKDAYfxI+ydibYd0Duz5kJMWhmFeUKR8nUt4HV0wr31PBxW0NtZBsQ8uznDmr72Qm8/BdcmiYfhISci2RXqn2R2PjD49E0HP4JMAcW0+Im+n3c7QSMs1YNMVIVRaVPf6PGMIZkEaxPYCWRSkBIXf+RwwXPERRiEhmfTvnAWQpXk44DRmiA9kgkR62QYtoTaKp9rlePuwo2A2slXOQMZ7kTXXf+vSJaOw1hzxODb2+jIKOCfFa735nDVhAHiepVMP/9B9cuY0upQll8vsYIo7gZeOADpj/7w0t17D2jtXq34WIngIlZLXH0pvqu+5c4Hg2RN0tmtkjGtMtUtZiiv59aXti4mAbj/bv3hYsDb75CUQeuTpIrXlvwhceiLzOU2IO2GoWCW5FTgFK19z0gm2Q5iAUkEDoblrpKzGBbjqn/nee0cUFMRvmxdYr8a4TIaTUUAoCVDnBxXjSs6vGXMV7ozN3IZvADj9qFeUH7G2yJbVXwIfp1fRw+m/z8HejGgdtjMlEAG9MX3x6cgoR+WNvsdRmN1MbznDDR9NkbiZwFl0mHss/6GhGOCkXLdcdSaVmDJJeydnKnn6Za9uMnsCxqeIUNDAgABABEBBldCF3bqrwuXvBOCU+jqfgw9JWtYVV7LKas/BN6BPt6hxs2qsxXmz37k5c91kw8kfttUggXJxbu4Jewc38L4bDcgQ== 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)(36860700013)(376014)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:30.9983 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 698754d6-39ac-4433-4d0e-08dcf961f5db 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8851 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 Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 5 ++++- include/linux/platform_profile.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index c76b8e3fdcde6..d0198d2ccb551 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,6 +10,7 @@ #include static struct platform_profile_handler *cur_profile; +static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = { @@ -203,6 +204,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) mutex_unlock(&profile_lock); return err; } + list_add_tail(&pprof->list, &platform_profile_handler_list); cur_profile = pprof; mutex_unlock(&profile_lock); @@ -212,8 +214,9 @@ EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + list_del(&pprof->list); + sysfs_remove_group(acpi_kobj, &platform_profile_group); mutex_lock(&profile_lock); cur_profile = NULL; mutex_unlock(&profile_lock); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index bcaf3aa39160f..6aad98f4abaf4 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -30,6 +30,7 @@ struct platform_profile_handler { const char *name; struct device *dev; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; + struct list_head list; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); int (*profile_set)(struct platform_profile_handler *pprof, From patchwork Thu Oct 31 04:09:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857533 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2045.outbound.protection.outlook.com [40.107.244.45]) (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 F0FE3145A07; Thu, 31 Oct 2024 04:10:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; cv=fail; b=YX+WRON+t+LhMahN7axoT2uJ8Gb/Q9/ijUEgG3q3adKcozRPv6qF1RMviy87kvnBWeAmMkdcrYGXj9u9UbqAsQdsiY4EXSz1775aYoarixw+H/Nma/bj0m+59wnwbtdMCF+41U/C1539w3mtTM8TR1+4kzrfhcq4jMjbGEj/ARY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347837; c=relaxed/simple; bh=lITivSxWn7ZJIFuNDUnBiffU95HVkMnsOulfhflcTWo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E6XAdYAXUaiqPUsNjzChrGNNuPy6WhMJeQufKT16tmy4REf48n4Gfo+lXIcmn0DumnRZ73+3hh8DIgLg6Y7GR6UYXwIRBjqQ9j3ngEm+8unT1bDBuMsB2SdcN2qFMwj2VLiwdySOoK7cq2zGvcu76P1YmaHoX3OeLxPONYqqKHE= 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=PIpjrCoI; arc=fail smtp.client-ip=40.107.244.45 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="PIpjrCoI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WS3ShhxLyPD9w9da3mfGmLzNIwXfNw7d5pE7p6mtY25ue6oucefNpEJ/ZL7y0+HEISbfxcBFt2CAVU3CJRlHuD3wXvBBhUZw8EMHSqEDk/BYZiR/04o9XCN5lgv8H8Cim9KwACV/zLeeqGUlNLMeEHWGucVDVHQew/ytbHMPGEMgu/A4TERP+cPVfFBHv5rnTfFcr9f+UmMxCPUEQWYhEvn5oz9BpSjeScSCb3Syk6GDyKvzuhc35ahk+jSTmyAiS+d7xigFFqbhc5qM2FMb2lpp9mxUGk3niyP/nIjaqkHpsllVCFqWrzt6E5dXr/Q5GHkxQNz/fQvrshD8GKPkNg== 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=vhE5ZoBZMfpPu5FgwOwo7akoVYoJAzzRoSOpdj2fwyc=; b=avxHlnf7o7bFCuv6qwfqvgBnzrn4kwgbrJRmOLHXKA2UWAmmH6c2KesLb5eeUT8fDMG63yQTci7eri3Qs7/wwXuhveuEujdwVFWHs3e+wRJygSNSdK9Zt7+BO8cXDIVLi4z8QgKWI1has0jDA1pfPnllIZmef1oKRalb+lm28wjxwMyWsT93L8PjN4xoke5AyIAst6s1HnuUaSvTx1LNqlcmqMYyD0jUqrjEz2W+35RWB2fFdWzucSSE3fepn3UfBS2tq0ITEMYijqai/00GWG7Z1W6pBQintHDMkiI7fq4wmK/rk++r45HL9F4tb4bZTstXUo/J7EBRXTLGQfhetw== 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=vhE5ZoBZMfpPu5FgwOwo7akoVYoJAzzRoSOpdj2fwyc=; b=PIpjrCoITtWN8KQj2TVgQWuBU3ppydIB7UrxonPyUTx+eSpVVDmDuPUVT3nQHSWIN7T3BwHiTLruxTfsZEw43r5964ohefDlE+EsUcJSItVeIg3V7nlEZM50aE2Q/+y7aZanusS9pA1ddgRFzLlJ3agAMxUtjpNHkWeqRGvSMA4= Received: from PH7P220CA0072.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::31) by BY5PR12MB4275.namprd12.prod.outlook.com (2603:10b6:a03:20a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:10:32 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::1d) by PH7P220CA0072.outlook.office365.com (2603:10b6:510:32c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:32 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:32 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:29 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 06/22] ACPI: platform_profile: Move sanity check out of the mutex Date: Wed, 30 Oct 2024 23:09:36 -0500 Message-ID: <20241031040952.109057-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|BY5PR12MB4275:EE_ X-MS-Office365-Filtering-Correlation-Id: 1fad3cc9-6d33-4798-305c-08dcf961f6a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024|7416014; X-Microsoft-Antispam-Message-Info: f+vPwNnOU0BeVwvUil2u2doryU/luHtN6PAFO5+GUcX5P4qWpTuI41izdn/t7oHj5+jV6azQXILWbJVpqY6LNFOhwOjlUHqtsMDIMFGzHu2mTYaToAm/L0AknNhOxg7d/tgX3jcC4egoFT/qZVWRPtMhyvd072ghPNgqunrRD084buc4SoHB7Ers5G/abT2qRPQjbTRT+DsbGm67c3MOwKKsdmkPoR0oLqgnjfX9tgEsvPukpVnB4tHJm/U3BjUZAUrM5jsV3aDZAUwhYKhsAVq9VRTvs8LwwK3W9nrkE9PMoozuVjiaLcA6oz7NwHOTw2HdpBegt5I5xQlFilMkxOPg4YRFSLXOIOzP3zWsZhcPQ1apnM51cW3NQ+0S97+gbH2rIQPVgsdXtTT6NdNE/cubDLuv7Ufcmxv27bLaNhiGHlXl03Zp0gwvD1Dig1JULyp2/Eot5Qhq712GWbfNEGzLkDS/cSB3BelHCka264P5XECnytAMk09j9RHVBRduSYUU855MYYSPAbZawUfx3BZe6ciZTyrBqEz/27TPd/uz5ARpmC/xuCTf1NB6vrw6fvf7FgdfPCpOhUwPDbfrbsiGMzmDpfuUMEtuIn+MUgu4f0KrWhkf+xAjqDkTVCKBAdYrjyR1k5rEbIcm6Ywg4rPVcAZqOGw8G+3WjsRYnlHWgo3CzRrsQr0KwZ6HRPHEs4w7lnp4JVVbDkCeIEvbLdOL8vnYZfPFB0fDFMx8AmLR/wTsuw3ceTVrnw43j18K3MidXJE9B5SWhMummSTed6EhMn05opWeyix0cY+BbjMHTcKkDmFxeGFb4I4J+C9/amxW6iIof8Hv+C4mWjUUqG68BKhtqD5hWrT8UjaeKaatu553zpIKYka/aGkbIdRnn4celxDpftW6b5gQ3FOsLCZlEnijmwHBCuU5TOeyA2EkrReBzZpWM0nM4Dek/vj1DhBKRYKS2hmSsXQTo9Gt61DnjaMN/oLx0Y8QeXvYwj/PtBPnr7dYPECsIk+/i2Ho3BdRUWWuvpSoslNTHhdzmL6eIUqyFD5DA3+d8vkTX6qmym8Eb0SAbPw/1Syndt6ImPswoX1BbMkBvP/jGQC7ROSe6oKoe4LTtX7fbvo61+cLUJT4vy/MXvjL8C1dSRufw8aUnGRUoSksH0X4EKldtk43GvZnuPIwhvXcRFLPdHj0BOXp3yNclYrttiOxEc5Z0B1cKA5P90T6khW6rPe9+/6vJd6WgJ8C+dmsiCkANLhJDXNkxnm2vyT6YXgVMWcoHvSGUG89ryQ6ockrakr7++AuxEaEVV4JAmSgiGZmbCARJ2l5zuKIUWgug84XN9mu+WcdkhpHmQWK7cHtW6DalGHdaQ0aZrNsobWR3fKlQyCWT7eYY9HD68sGd87AONStAc3JhJy3MWKmGXncnVB4Vg== 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)(36860700013)(82310400026)(376014)(1800799024)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:32.2951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1fad3cc9-6d33-4798-305c-08dcf961f6a1 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4275 The sanity check that the platform handler had choices set doesn't need the mutex taken. Move it to earlier in the registration. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index d0198d2ccb551..f2f2274e4d83e 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -180,6 +180,12 @@ int platform_profile_register(struct platform_profile_handler *pprof) { int err; + /* Sanity check the profile handler */ + if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || + !pprof->profile_set || !pprof->profile_get) { + pr_err("platform_profile: handler is invalid\n"); + return -EINVAL; + } if (!pprof->dev) { pr_err("platform_profile: handler device is not set\n"); return -EINVAL; @@ -192,13 +198,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) return -EEXIST; } - /* Sanity check the profile handler field are set */ - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->profile_set || !pprof->profile_get) { - mutex_unlock(&profile_lock); - return -EINVAL; - } - err = sysfs_create_group(acpi_kobj, &platform_profile_group); if (err) { mutex_unlock(&profile_lock); From patchwork Thu Oct 31 04:09:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857535 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) (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 DA9081474A2; Thu, 31 Oct 2024 04:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347841; cv=fail; b=H02vKRFy9ySN+SrQKoraKLSnwj6APTn5AZkZ7/wAGwJOJ4JQUKgw18cBA0k+8NjONx/E2ee4DNCOcBZ7jjqh1rJm7LRNQYq1/XI2iVsOdVbc0AIldqkG8w5Ef3m+V6F8FTv76t77yWchSSzBZK/PMXZN+CCKC09/Vz/xLcvKcF4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347841; c=relaxed/simple; bh=E+hQchgdGdaS267kdYfzGBDNAUhOSX4W0c+LvWbVk64=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gFAOAkE+HbcUoUCX0NenBQUTJ9XaRdIsNMOF2oEZSBwWYF5sjI+Jd7bk/GtmQL/prulmDvUoiw25jLaxXtntQae0Vkst+llCJWcRH52WcVDeCQVm+4pw9SCRd8sEJVMurE1WHcMX1gSdLYJilKFnWkLoAicByWU29B1x9rHNBo0= 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=siY8e2xG; arc=fail smtp.client-ip=40.107.223.85 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="siY8e2xG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S9Jan57oOa/AYpr1J9NUyhLQTD+5WExy7Rpi5ehfA2TzIhfZFZzfvhtgKBEVzdEtbyYl8IHt0T/kwfyr8dWqu/PPpbv96zkEI6OoUzYu3lJj8V1/pw7Xj9e9j3/eUX4dxeM9Uue0ZgK4hqGDyBen5XXxAoquzO2i6h/2c4ag1KWJUK24OF2tdvymianLma2R3j5tTUofhrbCWS5Ja5YVM/gIydUamSInFQF9lvZJhT7gPAd3ddhwiGDNDzofFLtuJEJUrVFOAICEeH36kc9+n2dk/EmpFVD23neACnXCV3DYMMfQ6NgawA3jZsfeE0IDy0eARVZHpj6e3Zc4xoiY8A== 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=ru2E8mvU6PKJs63/fPnxqlo1YPE/bzu17chK5A3+i1Q=; b=VDfxg8c8POZHrp790t1jxufHcnhxQiWdT1MSDIG+UudzDavdbx93PtiXrKZA2tYkdIg9FPvYg4fpMEt+yhJR7kj0Oi16uYc2XasQVH+3r7wjT7O2tgGBYJpM0SKWakbIycp+PnwiBWAvZUjl2hhhIWEmdc2mnJYF1S3fRDjTCS5mLAyh65ZSQp3YhVrmfaiNN8pe+rJvIw6ejEGujEf7gPFj22t+2cea12pNTQFI/cDcJTcPtuH7fjC/8p0WMEUR0qq9Z5/95OgDrd2m5oD5gb7mjcQce5zkfw9iTBErSSOljKIwgOA5FcrmLrmebsPUANbyrvodVlsfMoBxDjOBlA== 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=ru2E8mvU6PKJs63/fPnxqlo1YPE/bzu17chK5A3+i1Q=; b=siY8e2xGLfwnFpsVb7BURVu5p+KXr2IMrJjqbMb5R5r6S2iYekj/+fHQUDfVkHBe1ywG47PgcsYevoq1RLu8Bw7ZkhfE1OiKlxJ+uaxg3sZkuYuf9cufpDTh9WtwVbNeSeltxzbe/l4arqiMLU7SjrrrupXfNVu5sdkTvhmNjqE= Received: from PH7P220CA0068.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::24) by SN7PR12MB8104.namprd12.prod.outlook.com (2603:10b6:806:35a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:10:34 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::3b) by PH7P220CA0068.outlook.office365.com (2603:10b6:510:32c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:33 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:33 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:30 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 07/22] ACPI: platform_profile: Use guard(mutex) for register/unregister Date: Wed, 30 Oct 2024 23:09:37 -0500 Message-ID: <20241031040952.109057-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|SN7PR12MB8104:EE_ X-MS-Office365-Filtering-Correlation-Id: 484dd568-93f5-4507-ec33-08dcf961f75f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|7416014|376014|82310400026; X-Microsoft-Antispam-Message-Info: e71TkawE/VVJhavUe2bn/BnDqzDmCLHHFVGbLw/cW3NYKLMqpAZVzEt4pyzYEeoc1+QMqMBfZBCyQsCI3uOLVzLq/wYHq92MaFfU41AfTiaUMp6v69E5/JyEE/lsnRVd0VAej4BUato2tE3aMAKI2ga+ioRP7dUozvjbiEcWvc2NKUUk/i/sREl6jxpGSPD3gwhLIp0BObYHrxjxhMJsTp7HMqdgg0rEPRfNmMwL+8DYBWZTgS5cNQy2MEoAibEwczyl6tPWbyvw4xRvq5ZM0H0hpKi+P4kBVR5A7EN+ibIsjpU6IFUxVHkdV+wIVwOhR1hUGXeOlsIS41yYWd6tbqeaPr9J3DkLqa6OSHroKH7I/XpYaEAPSLz1/T2moczezkVww0f9+PfuxQhnIVEJGtaEWNq/9WoWsp5AoLlqBzO5/6itXOdTLU9Kti3vviLVeL4w2Pcr6Bl/ERdsxfdc6ncofq3jURvJYA8Bq1aEWzpm2ih81j5drENqWbZnHsFWEIw0zXV4Mx9ZLqIVoV9wI+SNREj92DrheqQB5e+XN+4pWD67YJP7idrr6VxIcH6LYg24YlqR9Xj8EY0kaW08eKaJti0Lh+8iaSQ+4c6RP46vZjytk0ZjkOmwuN7H6TtKKoGAfM0yatQnxtVSNJM078OM22CyKIwyAA6UAqHrBE0SO1ngHp98zRTqEvCfh3CM/HOs13ycJA5jIXTOMmr4hStX5VkTj8xfGWI/nsw5td7+wrfPJv9ft6U/xlC21dbJ1EqQKJYmim3ikoHYWGbqOoMHei87ubOuxQ7sDNPnaRMJ1mEIKsh0UIX+mMtIIB7b9dkhtPULm6hIYntndSmJR473j58Z7rFuZvLCdz7o4qKJbnsfoqyhxQqi0hLtfkgnRdpZWBGpjXD7pThOcbFi85RKyoAiFDH/l4k5WFkwkG03O+e3Q2kuhHOL2uRPSy7WLOF58zhusrIPtAB7Q1sB0VhbBCrjJ+vxben8jURMyB0q/37083wx5BXy+/Bg3Fa5388X4VZRyZhRDVmQOVYQN4hiXAFTJTkgQ3xR76uEe+j7XU9jIxqK5W9WitManpPNf+vCU2p2AP1KVCBKUgMFjOJjw9iJ7O9/eWDptU7zgZHmkZ9KxsmixR3fbctD1sAKyG8Fd4K+/ehxd9OpWmvl8z6CovoWnouC9eUKJ4HsxaijH2Nc+z07TG+xtPkWqFwMHUGLKK5UtA6/CIeVzz/BF7lOUCFVCT0EDqec11NU8EoamBVajcL03nQwzFQsHuHl090A0fdQzD2nA01/R0Zr4Kmufpp7roxChJnLzQZZW+SOroZm5zTU+bYKFKKQvnWLTJptVL4PS/gSC9B4qNdyUhdcv7jlYkiSRPzvLmwzDeg760tcXKrU0Ud/kfMpG+2qcLAG/t14scfoocaT0Nvakw== 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)(36860700013)(1800799024)(7416014)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:33.4670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 484dd568-93f5-4507-ec33-08dcf961f75f 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8104 guard(mutex) can be used to automatically release mutexes when going out of scope. Tested-by: Matthew Schwartz Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Signed-off-by: Mario Limonciello Reviewed-by: Ilpo Järvinen --- drivers/acpi/platform_profile.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index f2f2274e4d83e..cc2037147c0fd 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -191,34 +191,29 @@ int platform_profile_register(struct platform_profile_handler *pprof) return -EINVAL; } - mutex_lock(&profile_lock); + guard(mutex)(&profile_lock); /* We can only have one active profile */ - if (cur_profile) { - mutex_unlock(&profile_lock); + if (cur_profile) return -EEXIST; - } err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) { - mutex_unlock(&profile_lock); + if (err) return err; - } list_add_tail(&pprof->list, &platform_profile_handler_list); cur_profile = pprof; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { + guard(mutex)(&profile_lock); + list_del(&pprof->list); sysfs_remove_group(acpi_kobj, &platform_profile_group); - mutex_lock(&profile_lock); cur_profile = NULL; - mutex_unlock(&profile_lock); return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); From patchwork Thu Oct 31 04:09:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857534 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2040.outbound.protection.outlook.com [40.107.237.40]) (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 DBA821474A9; Thu, 31 Oct 2024 04:10:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347840; cv=fail; b=PVzxD2/AfyQRpWrcoKNHfJ033RQu/fvI/MQeHKKsabrVg3I1lCgLBy5pC6RUfljqqnTeGJvNTRg0woypnarHhGip2xY8TRpKFhxL4VovFPZX98bQXLrCmE9PEij0SpGuWFtFRc6k29luZuZkV8S0kFXCAhJnBFIzuSupQbWCmDU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347840; c=relaxed/simple; bh=kHSWXmoYwTA7lWKf20voObXAqnC26/Pqba/tidTV9C4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dDXQs1DTz5qDLjkPY7jt0k89ykdgoU/jdd9geaLYwn64CvVtJJnr2z8k/EkG3/Yfff0iVN+jzc/Gy+jBMJRDmwU7vy/nPMvKqtEcUSSmMfNX/8oh8a3li6A1/A3+to0UMfD77xoI/KGZnLKs5lcynl/KT9B/vYDlwvSBXtWClgA= 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=00HJhEU8; arc=fail smtp.client-ip=40.107.237.40 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="00HJhEU8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KmIrnJuG0HYA8slndJMHB18BE4SBDvBK0VDPtiXf6ru2QdDdQu7kVSPJZ7+N5+5qglcb0ut7vkRzVDbOyqOY4/Fc1eOI7BUDD6OgrMHGxxRkWL0mlesjpBymgDlwxptgof19o9BxsBZUGz9QeY2B/cIT7kQKeu2ElF9NIWcPP21/Vi9HaFiA8wfvIhOZRWdvVh0697Spk0El45fnMwhWgGXwJ9TlmpnKXizusBA7vGlVvLjxdYO4OBni1Tc8iN14WpRhunLPra9K2sb4JLMyv9AO7caFITph00nTsX+XSQw9JDZS7o0P3FznI9kuxnG4OPri8lcQ1gGq3Asb6iwesg== 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=i9RBHR3gyJfqRzIdQq8UYU5tcO1bw9e9KrBG5YRN3FU=; b=SHnFKv6E4X5gOXXLGooC1YaSPwNsiGFYDvIs5RMI4x/AcnVJU8OAnYk6JrV6MfESWrlaf3cscjQPlzND1GN+g6CEDMkqYTiC6SMvm6AWlggBlYsau9G3VLRDFs5Rt2/8m8ATcMsTvvf8teeO87RWLQ9zGAxmrZido5AbM5Dx3FW2zu5dt4PvkFoc/XTSgc4Pak2s0Py4SerNLyWpbVucwVJ9VratD8B9a3LcJK4Fr9bHnUWk9PdG5gb9lYp7qOj9naF6W/Nb1508jqTS0ojDFySYbVK8EyStHdrINB+WEo2MqfK2OLQIxSDcX1CbkwgfVtS825NeXkEs8udwHdwFeA== 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=i9RBHR3gyJfqRzIdQq8UYU5tcO1bw9e9KrBG5YRN3FU=; b=00HJhEU8KrklNo54gQ14vGxKNYa4eKppr42J1I6YRjy1GFCHhP1aaW2299vBf5T4FDsYLn8/mq0PPdkPbdJEOxKMT8CKQ7cLzSRhQYvbjd+gowBtVmHpfdsF76dzKE90l8gLYBjT3NxSuUTny6rBoZbmg0bAemms1wLZEN/IsbI= Received: from PH7P220CA0089.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::14) by CYXPR12MB9337.namprd12.prod.outlook.com (2603:10b6:930:d8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:10:35 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::10) by PH7P220CA0089.outlook.office365.com (2603:10b6:510:32c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:34 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:34 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:32 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 08/22] ACPI: platform_profile: Use `scoped_cond_guard` for platform_profile_choices_show() Date: Wed, 30 Oct 2024 23:09:38 -0500 Message-ID: <20241031040952.109057-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|CYXPR12MB9337:EE_ X-MS-Office365-Filtering-Correlation-Id: c15bb5b4-4b8f-4709-34b2-08dcf961f7ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: ummZYh2LH5vJN3GrknABRToIXN67YQVin4AivSSbPTKuVx+rwVB3EiceRyonpZWCW0kJZnroRTYAF2fcJXPQRwWOBHrIdNSN1hdNSGGZsrz94tQWC4puPANOSBoWyvo3otR/FumO/4XETZikZ199JAsR/8PM6U4pMp3NM29LVfV9Hx4gu3RmI5ZBtPXZKIkZBdcKAmxA/HpeEpTTgg1jmycho26dEaZH06ZVZUQV91ym8N4Jp7kQCe1rYx16Iwa/X+ubrPDM3ncfkqUoC6LPrKd+7hAClUl5VF9edbMIVRTigvZNv52s6YTME5cQii9Ph4O54dxndVUeecUMW0qxoYNowPxxonYKpboRadBN66WFoZVySr5CsLNyO88YJnjXXDBnvG/AGt6UW31rq7lQW7MR3HQSsbWz0918iGAFUiZgoD2axmoD6mDWXm9o5LMWcn9A5goZf2hGUKt64WbYh6mMvAkhfh/FaT6WeZyrVGjL9jW2GFx1wi51juFIgbgEgbt3ACItGhWEgk4QPUpuOkWU8Pab/ry47nxQfrMvJzL5FxenA2viW5njN6kfH3t55rrCtRUQkw0CTteAN3OpO8nWMazPi5n8tKAO8XnqQ+zGTs+QPSWq80XOoiQi7GJZ2f9m7vDNKV1FbxlMzBon2+mXHQQFT56I7GjFmJavMivVg1E88GiY5XvAHTAoJyyIkgAnazn3DbQVkCqSApWkN2lBRkEcxtsvcDeC8Iy8wrTOVUrIzdFoMQA2k+lm39p4nUnk7/ILwQpW9XcVpsCR7D5XwzQrs+65TbLYYIUcdsJBIXLBQGZ1TCRNKVHo+5oiJyUojLo+8SgEUlLLLrSSOHVfA5CEnMgEeV8scge4BQDdnJcIeeRhR6gEcb/na+J7cktQdW1eFFdU80ktGs3vg002ms8y8k1yheFxzYi+LvTa7wzYTv/SyOa1frQ9klcuq38Kl5ZIKAMXMZFewcNdayQVWk7mGgfIntW9LAxAD340IF3h5ys3kOGQGP9hbOcNlyz9S4Iedq+HGceON0svx00sUye5xocoGsW0vG08qdvgAjZbZ1ni785sTCp7/yktEeq9DwB4zx6quXbNNLii+yhmNudN46nQx9UHWKZ/jelah0rIBMzRu57LtnmIqPBHsSeeBqGG/jCHoWt8ecXUx1W7/TNyBnvANqiAJX1ijkZV8XpxAHyKT+brF49rccF+zzEHzWAYaujgVZ8Tf5pg6igqrLAnf1zYBxipNzo3qEp7IbpYsvoL1GhqIOmc51fblIQhEmNd0XFTu6G0xyjaiB4//Gm0yr/zDwBhz9iG7E3VziBvusEN5FWbdoGbH3XxObSaDK+toLBW+k/STtdQPRZthnqoe45Hwa/eZWnxyuZe4vVbBqGUmIV+TqFAl89FzlFiUXZA8wlMNBOdcopD5w== 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)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:34.4514 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c15bb5b4-4b8f-4709-34b2-08dcf961f7ea 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9337 Migrate away from using an interruptible mutex to scoped_cond_guard. Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index cc2037147c0fd..79feb273c1def 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -28,25 +28,21 @@ static ssize_t platform_profile_choices_show(struct device *dev, char *buf) { int len = 0; - int err, i; - - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - - for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) { - if (len == 0) - len += sysfs_emit_at(buf, len, "%s", profile_names[i]); - else - len += sysfs_emit_at(buf, len, " %s", profile_names[i]); + int i; + + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!cur_profile) + return -ENODEV; + + for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) { + if (len == 0) + len += sysfs_emit_at(buf, len, "%s", profile_names[i]); + else + len += sysfs_emit_at(buf, len, " %s", profile_names[i]); + } } len += sysfs_emit_at(buf, len, "\n"); - mutex_unlock(&profile_lock); + return len; } From patchwork Thu Oct 31 04:09:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857536 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2055.outbound.protection.outlook.com [40.107.95.55]) (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 ECF941487C0; Thu, 31 Oct 2024 04:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347841; cv=fail; b=BmfIP0v3SFeMPrvpaH5wCGplyIqYBoe8s5QtjQhA8vE5TJehlHUc0Gg+EYD+S6lySC5HBRSXCnJoil9hcAbc8pEligHyAlPbw+9wDpN4y5/KMz98ij4qRPgmG1doH64vx2p7jvV3ylii4B+ejWK7jIqqgVsbQOTomtwBKTgmlTA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347841; c=relaxed/simple; bh=kZbx+5plx1y9L5bCopHfGpx/A+YaI2ZaYuLZ1EpbbYc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oYqk8npnMmB8+iUr7Y4+MYvs1hN0eedJZMyatScxvXJEgO5HQ8ScEZOEAfxqnp/JHdB69OzwfTtq+2wOUQWTgGy+PAInA39IivIHHuL51K9ocfuMdTDrwSR7BF8sQ30hQ5IjCmYBa4S3gflc2LXwELAvI2UE1sTnqTIslt7+qdI= 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=hX63oKhE; arc=fail smtp.client-ip=40.107.95.55 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="hX63oKhE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jEpfcGklEbmCl0hZT52wTOUPlOpjVkYbebwQ/PwBDuL3I/A++IPmRCFElNxGKuSunv0N9GNbKJdG55PX+2ZvEqjaK1C1vmiAbIMejraLVfKF4gzu5G86GB++rRoAwFyCNYjTc6REbkY4UO7fk76dbnbKfJQ1J7avKetvucEGr1jK3owNZBnvTnzghf/CzYP6CtP90iGpo+QtZZ5OmqYtWjyldCvMAoBSEQn4JUR2aLUdOIAbFpb3Xz4mqDH8PUp3uQ2w5r7MNA0O4NWRAfUiowsnvS5EgzMjuP7bx3nkPNf5rlSobG6lNISZCNxelmJZc/uA3iWwrzECyqZxGpYvBg== 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=ZsZ5aFimorcU3PbFA/8AHd8NCIp4H4npWyPb1dAAxI0=; b=GZZBBysaeoXbdb6yqHzqXvfM9l/C6JT9q9mqBC0TFDKUnYj2tFS2p3+U2wHkO7LfmSpy5WwqL9A4zNqMCXXpAXUtwxiD+5sKGfxEkOi2h8FBzftVdnZWCpYzL35bOXkkKDhDgFLtZllYHbUplDZstGDF/ooszsuMFQ82iTMfkjn1/TPU3SQcJnpfhC1wdzQs29K0RppYhN1HkQWott9+ljS2WlE3gb9IOXC6ifB34y8MH+sYojv0f1CXYTqLZlje4+TwUP+SwL9cL9uAyfW9xE8+xBVF2rnx1leYcJyyffimjYP6DUHbZO8pDcXBaeh7H4VqfHqLErMx2nRhLPeVpw== 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=ZsZ5aFimorcU3PbFA/8AHd8NCIp4H4npWyPb1dAAxI0=; b=hX63oKhEeCGkzTCAXJZb3CYMxw6S350DtUIMR3cgDhT3mSJeZohM9JjP33OkQTRSiEM1XV4ZDMadNeGLo4fBccqLQrx+pvnzMWWUOdnV+V0Ar6+By0AyFYQXhAV475l2aLgrIbeCeyRR7Cpwjt3j1m9ojggzHC/rdpOYkt0MANg= Received: from PH7P220CA0080.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::23) by MW4PR12MB6778.namprd12.prod.outlook.com (2603:10b6:303:1e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:10:37 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::7a) by PH7P220CA0080.outlook.office365.com (2603:10b6:510:32c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:10:36 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:36 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:33 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 09/22] ACPI: platform_profile: Use `scoped_cond_guard` for platform_profile_show() Date: Wed, 30 Oct 2024 23:09:39 -0500 Message-ID: <20241031040952.109057-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|MW4PR12MB6778:EE_ X-MS-Office365-Filtering-Correlation-Id: ffaf378b-a87c-452e-4bdc-08dcf961f946 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: hSiAMMF/HABaf6wLDcC3SI6gjdH37W61RhFmk8U76xTmc8prJLEDOBD9UD983APkkm+C2ix7weHmj/jDB8qrICX/TL8KKxu1NPQVau6z/X1SsRCOFP/7sszwrht91ug2NE8Ist/39hBhtMfpWatIe5I76ZH7ffsCaezWoNKIu1M8CQpNzdh6LkUKdDU24t+ieTrSOkk9sCEJXyyJjY4PUK79yhZR6ADaCyS1OltgzbVJ5SR0LH6/9/qBd0Kq+lX4OQBF/i0vy0nONlGI1ATwJxJ2LZsOL6XKL+DQnznJaZ2aw+TCB8TlRE0Y8/TVF/md01kyiCWSogmY12RvXDLp6kNTWdfG/aVHsvY1oJqGeMfv8vLdL+sywS8t02DfqXOPYZK0OEWOEt3MF/nHgbTgnz0OvQSAzvkbqQgMDJfrZO2s5dY9cG5Ygmh0ZWkx+dGFbsUdPacBvJbCDvr60C1XpWGpx3giocYylgxvDzgNiSdoGrtNgvKnkQ1vYKyzcAhoBzMQ7hsg5Ku1buP9kjBgK381oZnEhOBmrPNwidi1fOHpHCjK3hQhhXqtsHVQigCEPBRr/0V5e5wdeyjN/Fju3SEI+LRPngvSUWl9mEb7UKtEDiyOz1KTEQzGiG0SGRImXJ1r5JqWEA7HqSX5TO4eJtgv9GtESOQuaqyFHgYsxcGhxm+9hW/Q6a0ZLpCPp47+ziVfFwhDzQiCECqiTpXU+ust7QHx1Garh78kFhlSC7nB1OMd3rneXnjFRyJ9nGE5jiy+hjFDcnpdDMIRoGlpSZrGFjL3Qqe5TPPEzEVpWH1NAjMreR0+uKgIzbq2YozttB+nPt1LCv9gVwgxWfN79yVJ7quDqCEP3PSxYhIZq8EwodXYH+naBd7mUg7N/s/YTq5ZvzWBUdSkQoIEXZOHXvuuU168niGLL19PHod8BFhtK/1zJN70vRWStzP6sI8CbLix0fZea3LQbT+/RQVkoY2Fl9/1FztAMf9DToJJyYhzbknsQIv/ILh8s/Pc1vBLg5eplnpf6618sHb3urkTb1xD4jrCLftATk5Y0Bn7dzamYuxWvVNgRS73xYz4jzU8JBJUcJWx3HNk9rfkwRRcFLNj6ZcQ7oBa1rgHdS2sDMm4csqrm9ql05Ugpm3f+i4KW+mXYiTCuCOO/pVkUBZK5h85Ktn9BkFgycEMrFIH4Y3/cWg6c7PxWEcFt79MIP7Iwt+VpHvGrC+hE0hbro1MJ1NAzPtHIHZxTYL/m/w41KhLQgF4D8ZMXAV9TLmOEZ6ylFTC4AobF/uU38q2XSiuGlkVhSbOOf7jOezA+3brEN+Cpc8AxDNz2spK3YilhBwh/JKENYPMQ3+IEwLQb9FoLGM3AhtQRSbi9fItls0gjx9FnRb0oJ4Uq5YtIwDtyeDvaN3WM/RKecL0PAwzCYgZyg== 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)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:36.7326 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffaf378b-a87c-452e-4bdc-08dcf961f946 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6778 Use scoped_cond_guard for the interruptible mutex in platform_profile_show(). Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 79feb273c1def..b48dd34301f13 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -53,20 +53,15 @@ static ssize_t platform_profile_show(struct device *dev, enum platform_profile_option profile = PLATFORM_PROFILE_BALANCED; int err; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!cur_profile) + return -ENODEV; - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; + err = cur_profile->profile_get(cur_profile, &profile); + if (err) + return err; } - err = cur_profile->profile_get(cur_profile, &profile); - mutex_unlock(&profile_lock); - if (err) - return err; - /* Check that profile is valid index */ if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) return -EIO; From patchwork Thu Oct 31 04:09:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857537 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2076.outbound.protection.outlook.com [40.107.244.76]) (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 943AC1494CE; Thu, 31 Oct 2024 04:10:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.76 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347843; cv=fail; b=UVbU8Jsj72TmY0+Py3VlBP7ivpUEqgJbqEk1VVtw8Ho3rtkBRTp8mIjuq1Y9iQcm4bC3Oo90I1co4luQeRZhXfssrOPG4NuM2tj4h6xpda640MhsilH1jAdf6uPYX2/T9/Ym/gS6GXWUZ/3H0utFuKAcA20Ze8l+23c99xyqDu8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347843; c=relaxed/simple; bh=kssn2NDK6gU3O/WAz7m7+hTS3LctO64s30kaUthU5Nk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YAVeUiv1SmBv54v6pAHfHEV3fMMLXXwudhMk2d2votbgprUu1QfCMWzRB/6+QfwXgfzvPZzxXuZs5V3S0bFNV/oR09bZvdbSrZmC5fuaU3LvV4aVikbvz8yvQqjHLOC4NfUrgXgMPTLOs/hIMZeTrdrXwl/GB6+r3R4Tr32FIWk= 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=gawAFDzX; arc=fail smtp.client-ip=40.107.244.76 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="gawAFDzX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qLq9iZ1ztTiyz9ZAhnQMtS1Ba97VJNVPfTEq5PKP8OCMmCg+Hnk9hEj194w99hGrW2lSWAtAixxc6GC/osQkuzzuwp56mLwd8oNFZ5jFJg3i7shqAzsNzerBXoRzbuu2Grbzw5Vp2nQOubfOmrkhiLEuGDWEsUXLpip9/uO1ywaQsFA91FmO9jZE65Ehxjhsln3emXzy3dFd90WxQO7ISeBh7N2yuN4FiFbdoISrP2OBPk7shSYullOlEJB3smmdjvd3Jt9G7HxpIJKrCnHF/uN8kc4A4QeArCiQ9y1I7nJY2TUKAvRyimw/i125mNdnRs3Axq1o+aGIWCqLN10/mg== 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=wMe5H6/SASpOQUoahDlnuWpv0h9KbKCpZ1FiZ5ixcT8=; b=H1cZUaHDeI5MV4fA+rkE0qRDoZbuk+7YptYLLLFYpojeCb/Xcqr4757HfnqIYnN3OD1b67zEtQZqXF7eHK7BHobTocSEyQ5ucYfCCNaJ6zO+4up060xhsEdR94bvCZ59jppoMWy76SLzK3XlpdrLeThpITG7t6NHcuj3VBXQsgnC/yL2WCrFEY3TLJS7/G0TApSOgRvoNvNOwUvwvvoIe+e8xZNMxE20rMCIJ4ZeDR+lV9r7kML4TuJIzJlvi3Q9Vgyf1jM8FEHUFNXx958oDRU+lVK60l7O+MwPT2pUZCO0fy4/iWKFxkg7QdMrXbcRMCymZqP/lUrNIunu/CWC4Q== 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=wMe5H6/SASpOQUoahDlnuWpv0h9KbKCpZ1FiZ5ixcT8=; b=gawAFDzXoMTVngq6fcndr6WUhekB3/sfgKEb+ZJsHJQNUIBWuHcp9FVRyHqI09EhZOuj0il6AGL5j5iTD4SID+I5rBfhy+XpgksDfwBXn6C6refqjKdhzW4evFFD2Q/jByyDPQkteAQ37NxgBfXegODQfc4RwHzQCKQUeWBKBVE= Received: from PH7P220CA0079.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::27) by CH0PR12MB8579.namprd12.prod.outlook.com (2603:10b6:610:182::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Thu, 31 Oct 2024 04:10:38 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::d1) by PH7P220CA0079.outlook.office365.com (2603:10b6:510:32c::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 04:10:37 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:37 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:35 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 10/22] ACPI: platform_profile: Use `scoped_cond_guard` for platform_profile_show() Date: Wed, 30 Oct 2024 23:09:40 -0500 Message-ID: <20241031040952.109057-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|CH0PR12MB8579:EE_ X-MS-Office365-Filtering-Correlation-Id: 004dbde6-2708-4b27-cf8e-08dcf961f9cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: fuavviVrhzqIQovrKVQV/SOynpX0D09vdwiR3QQOY8wwqskQO5/sJoDrivB/ocor47GjYaCHGeNH2FfEq7CkluT7xU1y7JMZqurZ5rhwe4+R6KKRv4paJjngU/3rJDs5NxllMUNBMW3pgWhvp3fC0V+KQFlj+B5Gzu6EIqmzYDLOEHTDINyCR2YX+/87t2aSx7OhL/UV1nmtQHlslIx3ietjO2g49ENBxXOjd0VfzEdbDTHpBnGRD2rtTtFK+ootitQxnlzy+o9MkOiSxjUnaNixwpvtguDFKDIh/rhuLqhww1ZddRTz72MEUu/Y6mpSh1158GK5CapfQrEy021/AU9HRoFxG8YvgiiZAt3rdb6kIY9M3pDYRl0xrxE11gYaMiqkMwqqdbnskSI+U6IGO3L71PZUCUXMbpaXNFvB2QBHN9SYwD+sES2MhI0v+9n+aBHJGg6GkQZSN8lsdhp7CjMS8ysiXwdyd23ATpbXb9DwZDa2oJCb3Dft7VbnxphjfxJGbmfKSdTxAMIPWiwhklhZJucCJQfNPwrTvM0eX6rrVlT2Pju02CUPib9AkRUpDz4aFXxrlUMlhdS2hvO7Mj/0y/dYsDk3AXoZQOS8SMkLHuhx/BVQpkYZm556zRgB439q0ro4vNvfo6kSo94v53r2hdywLNeNy0PPxmnrMHkapFqoFQp9lLPph8YRw3c9VvLdjjbhYOHaJXveRAy+CYMs5tdGVGC0HzI/5U/CLyNWH/7/eXIXS8UlsG2gczI+64Z1GjgkGI9Qpb0bhOkBra7XjQVuid0Kr743Nx8dBIsC3GbYmgcywPBDmcbw0ImBPjDU9WAaxOLpgEX/L2iZi1uDRy0Q2roQjlptcJVVqiVKjFYs6JOUzy9m5xtuFGwsnGn+GVd5FVf0YuiVb/fmEDo1yu13n8l/IRZJkjndXoSyh85cWc6RZc9SLAcwTj1bV4v6zZC7TPjWDmWMG5VG+5HEimxYGhEVQ+Q9I03zUnDo5lYeabT4sgtXZosuSEb+XKAISOnwuFIwNlcudv/eLDEKo/mpSsP9d4AQzv5medH7zOl1wfqPtvzLLN+Z+E9qPFNE3Ijzz2ahmRfYE52V9s8O3/x3f3TKg4xan2XnZ9Gv8gfEvTmScRRR9mXWThkW+L/qowWnZaR25ccQg4tadgQ2q/JhblELBki6XqtinK/j1oheNOhLDP5h/dA5bVqryPDmlQu4bQovZYu1ITRsDibUMaf5rQSom55FydWT0zbJxVT4wWD4hIbqK/tHQxtGT8mYW+rH3sRIGBYB+vrq2ZuyzE3xvwrYEXRLvCzVQop/x4FR7imLsUd0E9DOY7OKc7l5xa0xC7p7NEKi9HTtkYwaurhIwAN1OpVDr6nmlifdwrbqWltiDFzf0M/zhg9RjatC94UklZoXGK2cTs+m3A== 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)(1800799024)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:37.6076 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 004dbde6-2708-4b27-cf8e-08dcf961f9cb 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8579 Migrate away from using an interruptible mutex to scoped_cond_guard. Also move the sysfs string match out of the mutex as it's not needed. Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 36 ++++++++++++--------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index b48dd34301f13..63a5f5ac33898 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -75,35 +75,25 @@ static ssize_t platform_profile_store(struct device *dev, { int err, i; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - /* Scan for a matching profile */ i = sysfs_match_string(profile_names, buf); - if (i < 0) { - mutex_unlock(&profile_lock); + if (i < 0) return -EINVAL; - } - /* Check that platform supports this profile choice */ - if (!test_bit(i, cur_profile->choices)) { - mutex_unlock(&profile_lock); - return -EOPNOTSUPP; - } + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!cur_profile) + return -ENODEV; - err = cur_profile->profile_set(cur_profile, i); - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + /* Check that platform supports this profile choice */ + if (!test_bit(i, cur_profile->choices)) + return -EOPNOTSUPP; - mutex_unlock(&profile_lock); - if (err) - return err; + err = cur_profile->profile_set(cur_profile, i); + if (err) + return err; + } + + sysfs_notify(acpi_kobj, NULL, "platform_profile"); return count; } From patchwork Thu Oct 31 04:09:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857538 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2066.outbound.protection.outlook.com [40.107.94.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 AF5EF14EC46; Thu, 31 Oct 2024 04:10:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347845; cv=fail; b=DGUUrb/v/Ei1PhIXuSu38mGKTaIPQOrCIRZTvzcOMJiCasVqpjpsaRr4Jub5u/1l3Rex/5TOz4vpRzaYRgAyjM/xG0dLzAdxEEsorwM1UKqQEQsujiH0Otd9WOmgaByhtKDLig1cPMc4OozKKgKatk4d4u9hpHwMgvvU2YESXO8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347845; c=relaxed/simple; bh=NA85YAzU5HGhnAyOn7Slgl06+COemEDtnALxY7uCu9E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kvSs545s75YOUAKIeJ/l/JTmwsiYYHT4r8tXRuPA24TaUIblkuQPUY2MycZU8Ilwrjfxg6Iqyq1a43G3fEgYIC6Kkh9lh0sAF06+S4nzMrRebd9C3Y4nHpU8MY+R1JsotkYb9nqT7RiyhO+cNqjEuEzShs7ouKOGproT+F0vFA4= 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=h04SUTy+; arc=fail smtp.client-ip=40.107.94.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="h04SUTy+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TXbbxQGsiFbf37vWu09V0+GYjZzRfr+5DvfTough3JXEVdogudM3dXjDE/HZwKVGz9Dyz29kqMZ1faYs3PY4lKQxYzU0IC3WkFzCk/acJmUHcft4d0BTLlaAfUuZx8dOHJJNXXvQeJGJPdyoboXjsZ7wkwHkaDYJlZeC011FNX5UKDhbdZDUBoL2X6R0k/S3TWB4GV2pY97HtTwB6cpI2weVoCt5ao+++zQipcCM+Ey0yi51U8oDtFJMBub6jkf7QyRFODeZXo2E+HRu1hYOcsr398edJvkJGkBIPelLHV6BratRq0XNgD9WowOB+RTDKmJ0rc4WnYOdQAyVHUyvkA== 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=3XyZCGQydisWB0aecSxy6A4iPT3N6k+B+VWHygPISz0=; b=fOf1O5sSaRHoPQ4nCqgVzwC+SgIPrhjuYDaCp/YKO42uKl0Pt9HhSaClC+74SqKWREXxwk+BozD4629iX/Oct0jdItOLlvAgtfw9Txk+z92GyMk1Lmp9ZcQvJ5kRpFldJmS/rWXWOoAnUcneoNgxQxfuHCqhmDshR/oY2U62SBgacZjovwmNcj5t3/jDImK+BirIcdu33fgF8bjyrJIsmbq6V2DuwPM8xNnArXScshZghvi+C+d5EqHg3+X5V/O92PihK0giwWrBQtgkPo2d11J0vMTrAXOWTnMJgJMN5latqa2ype5IUF1hbIVt6oNquJaJoFYGjnFc2qpSwivpVA== 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=3XyZCGQydisWB0aecSxy6A4iPT3N6k+B+VWHygPISz0=; b=h04SUTy+VT/blGEvKhtD/cF5tBCBesHMuI4UHd0i0lOgKky8vROuvYm/N12Qec6OklKVLy+VK1C6Uz+FdmY+l6HsZio1uP6Cg3tchbFNI/3RmafE/qkUy6uP628kcipuifFW4PAzYNKEV2BwT3tty9Q4I+pLe22atv4Sv9tt3ik= Received: from PH7P220CA0065.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::22) by LV2PR12MB5728.namprd12.prod.outlook.com (2603:10b6:408:17c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:10:39 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:510:32c:cafe::d0) by PH7P220CA0065.outlook.office365.com (2603:10b6:510:32c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.23 via Frontend Transport; Thu, 31 Oct 2024 04:10:39 +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 CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:38 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:36 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 11/22] ACPI: platform_profile: Use `scoped_cond_guard` for platform_profile_cycle() Date: Wed, 30 Oct 2024 23:09:41 -0500 Message-ID: <20241031040952.109057-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBF:EE_|LV2PR12MB5728:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c031ac0-a45d-4e1c-03c1-08dcf961fa62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|7416014|1800799024; X-Microsoft-Antispam-Message-Info: a3u0qQ6d5K0TEI5xulIlGRPm7Lpl7h15YvVYAALDjygJXDnP5Q7bW6zEIGM6zt9I9qMB3uUhjrp43PKQHuG6mturH7yNHLW05oKHLX0d0xySMAD6qKSEPZrdoVZI64rT2ELKhXwP50DwqAVgj63N9XBFlt1h5QZ1UUtkkEi8Z/kmA82vzmJW+AVC7RKAqggRAusmXsct9NdoZku+e99Ssq/nda+dGw58Gn77/2VI5pfhWb5wlQaPLmGDe8DFHhcwQkmjXpaxs1VAi2FutlTt6x2Z07x3CxdqMUF8KgQRsYSmjFCI5vYiAWUjeiAxF+kAv5sMc9rStU6oC6JyrWyb4bd3xeaPL8fcQghsUv1bCOFVufl4VJKVuyoqO7TzpZpFBToGJn6CzUoZ2cYY5oNPI/PvbV7oCPHU24VCyFjvn1Rcz0GPNCRzXIWfxIJH/Oqa6wVhwFH75mB+WMRyViDHR+i6i0O/Az+rX4fZCMry8RlgFyKeyNTQ90Qj+STxRfWMWPeo3TmWdo2QqcDO7QWFC/UXxhHm7lDu63Ykm3ULR1KbNl8Zo8s8z4xY5Yj1lMAQloHpSCdiibLvyGMWYuvcK1Mz1xMlu9uGhfdynm1qqSUU6dWYzwO6f7iJRDcvu9bJAkzXnv3SGjv7ng0tx8xvXalN6cBPyOri41f1rGn/cqthdkmdSdTKqTmrtMAFCyS8rJ3Xgy2aF6p2ydpiLROAo3ITAa25qF54SNmYUPM4QfboWb9ADCvy+4uuafph3hGozAPsFjD0C07r3mj2cAuzE5RnrxlIdG61NDvulOGS0ZpEHcoX9Ow9VbDBhNYB/4qATXGkVy3JyICrX0z0N3IspSpTvNQfIOtSFzg+FpxKT618Lf58yop7IL3EYxi2DvA5H63X0wdrT4LsktOsnAoreMO3dOs9VlJhT1dzDUq5QZivuxEF79V7gyxhqH9ogKb6ziS7zHNBD1j1qpf0kEofcbcc+QLaEY1JpiRImH5snK+tVHE+BtrFFHj3Fb2H/lGBWX+1QFQEoDBBTzlyTPUtLWW/p4jZr/qmkLZbxqFJMCoecp5sAp7nFzZR0351u3AUMpZZiMhymo80pk5RoT0eYcrTGgiY8bx8Tl8L7UF8YItuzg+rZIXk9pOHe9+zxw2ylSIL9qQEcJkBNuOYAKDn/YDWAHlr0Ri9xMix6BLQMP/mSjFKHagStAN1UzTad1TJJUoYa3B+XvwhnPsV5CPffj1mIJILKMb9BlSQbIDqywDquMsirfwCIP8lVplG9o0MuYGIXeg2bti0hEU0eZtLFLU1JpT6/ObGbpiMrXz0RYnGeILhHbtuIhhYoAONgH4qWMz3yaIRH3r+S6f+/27CPbdfMFywNDsGW+n5qb8Cb+5Yzy8XTb9I3S7AlUrAUvMQd51/AeLZSYRQGu0fPuonXw== 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)(36860700013)(376014)(82310400026)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:38.5920 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5c031ac0-a45d-4e1c-03c1-08dcf961fa62 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: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5728 Migrate away from using an interruptible mutex to scoped_cond_guard. Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 39 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 63a5f5ac33898..2d971dba2d917 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -124,36 +124,27 @@ int platform_profile_cycle(void) enum platform_profile_option next; int err; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!cur_profile) + return -ENODEV; - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } + err = cur_profile->profile_get(cur_profile, &profile); + if (err) + return err; - err = cur_profile->profile_get(cur_profile, &profile); - if (err) { - mutex_unlock(&profile_lock); - return err; - } + next = find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, + profile + 1); - next = find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, - profile + 1); + if (WARN_ON(next == PLATFORM_PROFILE_LAST)) + return -EINVAL; - if (WARN_ON(next == PLATFORM_PROFILE_LAST)) { - mutex_unlock(&profile_lock); - return -EINVAL; + err = cur_profile->profile_set(cur_profile, next); + if (err) + return err; } - err = cur_profile->profile_set(cur_profile, next); - mutex_unlock(&profile_lock); - - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); - - return err; + sysfs_notify(acpi_kobj, NULL, "platform_profile"); + return 0; } EXPORT_SYMBOL_GPL(platform_profile_cycle); From patchwork Thu Oct 31 04:09:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857540 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) (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 9D528155A53; Thu, 31 Oct 2024 04:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347850; cv=fail; b=tbbHbqc9jyActBBRdxfXHtGa0gRxeX69dMEITNcVghxnb3Sz1hNELuvp7p+ndKehsImFnrcNzlcVUl5gbn4McyTP1q8l/XGLJUhrzoWTVE97v2Y+pYA/K8q0J/aSZckn7vELH2WfM+1QkCiDM2PB4p8aTWip7C99UOnCQQASzdw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347850; c=relaxed/simple; bh=mWOy5GM5UEJggDyZTxNZzpYHTp+vSago3fuXq6E9D30=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HttnirmKDozYR6HIoOgnc1tvwp+Y6gqo9+8CjLcKPwGzPXxKY+irWlVO6phKPtQ0W1jqXkgVr1ALSJDNauwrm8yIzuiCzbtO/d68p3qeQ2oST9qlchhsHcETEByxigssZwcrGC5wWwem21mUer7A+Yv9qnUgWGe1RN1yDOEF9zU= 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=MzIuSfe5; arc=fail smtp.client-ip=40.107.100.74 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="MzIuSfe5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=d6X0UqIj8h7mGae1pK0C79dIxGYt/gyLyFiWDjN8KxjeTkGil2j/UTPgB5aPMUwqZSl+x0FufkwlFeLfpZpWNFmGDnz062gwbvDV6Gw2KwXv3Mk8pqbsjaSjIKMqbk57qftyis2vUvvudj7cFEpWsHpvGwCu8UInbdds/mZCLlQlI/PLEV2KdyyKUtG3a38091UeFVYRrPLv+/rbv10KDFTFmABz+Vt/ON6SDwI1yXMzlVYixLsAHB4YijqQdGaeQsQSaU7SNBMtTgeDUej3qIR4oEFSlQ7BI9myo9jPAbyWvjcHBP+HBH/fyn6SPOPsF8Dxzxtc/FQGbSlyvq997Q== 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=kJzYNeaKYSJpkQy8diwOKNYtzHPdojNbidqIUCme8uI=; b=qcj7DGmwTNHB5mmEsihFShcdIaTyIzhz2D8sQ7xxgST7SOcqwiZqJ1LEAVFNOBYHRTzXmf3xBJZBz7UHO7jhs/vekP9ZA8ysmPNOoemj/9DWpdmIZCxB3wImYpFTvPAIgxzLAb09L79rcr3EYIOfjiChnvGDP/ivNXOOHl3hVvHtejDOvNx37WQM1/m8HNYHE5MQPqX/HyH5NyFL4s0XbvT7k/xwI65E/HvtdwjHtOJcKp+7Z9+p2S36K3rl7JG2Qlxj/T3olk5Yn4ffslBtS753FTHTuKmEsnX9MmMaiuB0vzlPc/YBB8B26slR4QnMu7e+1ycBEgVDOPoFwF+S4A== 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=kJzYNeaKYSJpkQy8diwOKNYtzHPdojNbidqIUCme8uI=; b=MzIuSfe5+l+6GY3pdpdQE5iPxX4a8ABjm7H0Bs3iEOPN8MHl44izFtB2k1Erw6XmLmGTLLsQdd7sCVzwGL/k2agHfGwEZpuVQ03bbbrkTTrlmYsotT8ShzW1pNc5ki+w2bkoyV2IlyXl5CIO4t8zj3bI//ceeGJXUoFlxIXN45c= Received: from DS7PR03CA0345.namprd03.prod.outlook.com (2603:10b6:8:55::29) by MN2PR12MB4047.namprd12.prod.outlook.com (2603:10b6:208:1de::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:10:42 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:8:55:cafe::c5) by DS7PR03CA0345.outlook.office365.com (2603:10b6:8:55::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Thu, 31 Oct 2024 04:10:41 +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 CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:41 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:38 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 12/22] ACPI: platform_profile: Only remove group when no more handler registered Date: Wed, 30 Oct 2024 23:09:42 -0500 Message-ID: <20241031040952.109057-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|MN2PR12MB4047:EE_ X-MS-Office365-Filtering-Correlation-Id: de47a983-6d2e-42da-ec9b-08dcf961fc22 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: WzsDlELE6f7TinTUQ7C+SHBpAAs8EPw8dwACqIadmSgWoWhKpuKKi4bpyuiCPzl/8x7UA2HeM7fSRbQdCMfoog8H5B2m/aHe7HrOGPO6o+a9SJadNT3HNsxoDEjMyo/drKvZM4RQkZtNDDInGD+WGnYQxUbMVXvP053eW9J5zlEi6XDH/JqknaGGtmxtvsL95D9vr0beSWhcZ4RVFyqhmoqlUxOMmbqs+oouB7xp6J08npcmoAlnQeqEvmJW/wyYHv4SPaT23K3lIXCud7TYTsUz9I4V1O8oRwKIjI0xMC21X1V7TooPZ61BArpo2CGkSd0Dtvtpm6hV23N47PNYcQg1Dc6crrWjBgsVbOcqc+XqlaRLt3SjJd3KwiVboxvPxC2RZBWyjQNseMUdzs6H5CKLeL5Ht4oy81G9rF+kLt20nReHKjUiS6A5n6vHxqur9T7Tnt0NaPxvWUKWbla1vBS6lZJ9eeBXh1OJmH1tfRAJCrk1Cl9MxIbmKYb4Eqlhim3EaUcTXIZ5xpsQaY8Egt+kILAWM+pSopcqkenCFCbx+sKa2dziYGLZXSwxV7qIX/TNKERNlqSjsRqUe4IygyIxl6mQWrNzJVbyneD9lS76C5LWcsCNeYlBdwMOiefGQWmzzpDU6dl1xdQofvvBRSdYM548A537kaMq7ADoNXudfa6QXj93mLDRNoPpSPPUoHjB9mt1oOPa2qUT+W9F6gzGt6Js3S3W5WfdfwkR/r9gTcBwyv9LZJhuEvkC2oxK/VFcuHH+EwkxI8O5gs3tndndxNCYY+rtS7/r7TsAlFYgNPsrG4SACOlPhyN+z2IghbWnoobdZEeFsbhS7ckiaDZUoB7RyoZpxGNpQ8Hx+lP5N8i4MYXCcB1NGy56VbKac2WMAE0O8zOcrFw9Dz+KhIzQj3fC4s6dW4/WPh+OiL8R4TuQLIiYWXiMALG4cilZ6ybCzm1ey5ZvD3pCLyyXR4XW1ObuQ6c6osxnbcLF+ay8S+0Q9pGqLv7DhjxjG/VM/8HqnZlGAVkfyJXEPtvwSyUPU6+O4gg/HP+078vZvrGt8qoBCw5g+LtFLgeB82OpltgXFEYb7IeH9z34mOIx9U8VXbzzJssFMR13r+Tq288tJy/DjeqwlvKHtYfPDWu4Bi/VSZrJDD4qw7H+tG+pTux2w8ILanUExTcwL7+TFfZ2qM22EfwXTXgV61DbeqiQDk1awYcI9wq9IieFkRdApYTxf0TywBQudZUutQWSX8JASL4ttaswy/a7pwFLzC/uVkOUt3NQLDyH/HKsZIT1gn2kX660JguMo+bpt9FdJp9SOqZvxSwO4ED/32nzgEJcq1DeKOw7o/qhFWiwG7W8OoO3FuGRvrJ7ubw9UZ8kwtYhJj+C/W8yS4ig+Mb2/WdN8Fr1UfuMVNO8u5XiDQmyAw== 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)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:41.5340 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de47a983-6d2e-42da-ec9b-08dcf961fc22 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4047 As multiple handlers may register for ACPI platform profile handler, only remove the sysfs group when the last one unregisters. Tested-by: Matthew Schwartz Reviewed-by: Hans de Goede Reviewed-by: Mark Pearson Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 2d971dba2d917..b70ceb11947d0 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -23,6 +23,12 @@ static const char * const profile_names[] = { }; static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); +static bool platform_profile_is_registered(void) +{ + lockdep_assert_held(&profile_lock); + return !list_empty(&platform_profile_handler_list); +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -184,8 +190,10 @@ int platform_profile_remove(struct platform_profile_handler *pprof) list_del(&pprof->list); - sysfs_remove_group(acpi_kobj, &platform_profile_group); cur_profile = NULL; + if (!platform_profile_is_registered()) + sysfs_remove_group(acpi_kobj, &platform_profile_group); + return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); From patchwork Thu Oct 31 04:09:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857539 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2089.outbound.protection.outlook.com [40.107.244.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 6458715443D; Thu, 31 Oct 2024 04:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347847; cv=fail; b=N0LGCXAkTF1xSUJyrKJ5sr4IQivk37vrvUb4xDd5Uqp3x+9n4RXApDvx/8nHewy+IU0Mz4eHi4L0cnAeSa1NpKbnkiEyyVMBkHHLhzgSOYe/a5qK3T3Hi810kPM8vuiQMpSbfvIAOeDTJXWfHnU58PydNomEVMiw06DxVTW8IVc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347847; c=relaxed/simple; bh=iKLFe9FucDIr15NkiaQmVgbAANocew65IHkqIEp0gNc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MpHDeuTrrEIbJlOufDflHZyyDzc5c5kq+u+YLP8jLNdOTukcOjBfOx3v/ikuQH7AIYtqJH2zd09zR7rmB6l9yURbmCyb+DcOJulFT8UMSZ8fmqScmhQg6UU7TUFgsO0QhSpopZu13oq9pw8htAJfXVIVw0Ip/zMqxAzMvBezhcM= 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=AvfRTWAn; arc=fail smtp.client-ip=40.107.244.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="AvfRTWAn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KM7siR+jjimwybxdDbq1M5WCs5JVI8APEukNHmWofnUHplnVMPDjfhyFQ5CaklonGUUxxjphd+QUAB7c+jvB5B4LRal0Y30/SxfJq0RkvkqBfkfmI8wFYerBoNKIss/prOwj6+SlAVex3w/du9fZ33v7FQ2AyuDKFBzg8ZbmJtU7UdJNm48QqFsWDNXzb7Xp4YL+qERZsTAtNxtNu0P5FmrdOaIU3z0Gm9buIJJYNoztGScmLzX3OPbiJUGmcQA/6gFiBN+MkIsRqOUWBHHpwcxa4bdns/GcBI3A8NVqBdbx9KGxi7WxRyXS/+LI2sb+3GFI7xen8+O0Ctn8ngrPkA== 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=ISN2oysPyjxrEnFD4DuN9L23LJ7f9XkdxpR95o7X1xM=; b=whLmSnGcyYwVogbZLpLbN/MyP7JP/ghhLfTi0QuuUZBzLqWbLbJlyF/dT58AQk6l+ZjxzBBGyi2xL+L9XwC0YO6Hdfy5YE4yxgbibrPgl5qYsZB2gCydpeJwEn+RN7vN2Hrro33Nbvfg3ubHyZ9G8unMKytLgTtPkKQXcaWSPYAcQC1+wLQta6pjn8sHB/YpEuQZTX1ClnbdGLXnWo0It0yybhIgrJ+AcO4M5JwvEH1L1zr/R+kwJ9tYKYRIq4CsLxafEXMEaEz7rt6J2inc0WnpGgP+ZX8xTrjEVDbKgidkh9NmFdPA+4GrydwM8WORWGrgfh3pVJFRahgvqHJDKg== 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=ISN2oysPyjxrEnFD4DuN9L23LJ7f9XkdxpR95o7X1xM=; b=AvfRTWAnt7H6VTfMsrBMBJtjXG/LpNLBGOG1XWDbkJRdOJsX2QfQeN1O6+76xBbfr84LK6/DBH1ErZ30Y8wu1OuEWjhZSPXiNiwpebUe4UvKhE9stdBp1cefdUinWxJwFBI1+vCW/VEY4947fFSW2yLQ3KG8sCqfpSKllY/zzcw= Received: from DS7PR03CA0344.namprd03.prod.outlook.com (2603:10b6:8:55::28) by PH7PR12MB9253.namprd12.prod.outlook.com (2603:10b6:510:30d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:10:43 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:8:55:cafe::b1) by DS7PR03CA0344.outlook.office365.com (2603:10b6:8:55::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 04:10:42 +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 CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:10:42 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:39 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 13/22] ACPI: platform_profile: Require handlers to support balanced profile Date: Wed, 30 Oct 2024 23:09:43 -0500 Message-ID: <20241031040952.109057-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|PH7PR12MB9253:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d3b3f41-0eb3-47de-d1ea-08dcf961fcc9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|7416014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: A/1TFd2NHflb2IxWb7X6eZb5HT1hH6TFLCNKhZcme83fy7SxZins6bKuM4iXh4UGQr9atsp7bi5CSQ2IKSD/fkN4QqWVFaru1Cu+JOleQd727nSCvYK6zH/CONEo41AVWPqlhDKgnJXHqZzhCthBUa1VvsvGOR8xXChImwUDcPEj8Jw49Q00XpXAvTgbckTv/8qEgGGRVm60vK8iRBBlJH0UbYi21HMUUbmpSxT9sS/fMfOPim97VvE+ShN5ur7FGeW2sllbCt2Eev1OdwiF63ZIRdCp3iUxDpbQnRDBav83LwnbeNqqCIub6TzDfZZdzBCKLfHyOWF0c7FzWHuJOrLfePdp/B35oCWudQsFk/fX808J96dUTbSo1qMuY8NKBshyuZUIBkuhYnl05KHc6N5wA5uaSbPtvmhWw3poWHQrUyHCx0ActSLGiNMt0lsW86DGwAt+NbACm+GF87Kx+62A+tvfZmmCJv9kOPXVCBwB5BHQzfhSoW8cnZLPcYVz0ZWJ4AXXH91fbE7d7lP48TqZeev/wYzZxIjwwjeZesOTvSn7vfQKc8lqrkAxe1mbZPLFmAPuDDzacPzZ1WAzuc18iGLUlFtgU7DM59cVfjjf3mU6YaNZBJVThPvx66q/GbM1Nia4ceE8EXG3OYI3Snlf+slyFDqfXZprBZQJzzioW/onovCz6C+6hqbAI0Rjq+PtGYElfz20aqQkEUeNVeXj0Hsy6wUNxGX6Bt6X0TTk2F4+aeZzaGRGH+fjxKOIcnNFc0bB2cx3W9R3MkfYkENuiN81upGVJwpVu+O4Uo/2P1F9Qd6G7Iumnuem+qWkt69r1Azz9UH4qNghKD4ikFva/EzfztKz02kTQFkW/cArg84hqXuau+jEyn4D5ymySLqicEllKuUK986kyz1t7dIX+/trm81pKwJ6lLLmNmg7VddXcjDr+zHjVCQJ9XHAQoD0zlDU0iXFJ2nzhUKalLNx1/J7wEev+AMB970g4gYkrGKFdvxEpRz3bWkWRSFssJJ8pGkX51rPLtieMq70mLxix72V0Czg+hmPg9OLC5NjilqH1oV/NCDHbX+Gcdk3R1gHDHaRBQV3qv4X2H2aTEL9XEtrEq6RHZAnwBuRNp8AhRy9j0aWTnvMD3BIXAPQOkj/REXH8uEm4gMWtawuy0Hbc5QNY4T5HuepW0+4W5NSy7Ztpnl7RJ9fAxEBno8WlSitchhpNDDpTwPvv9sHRUwpYFmMgkmmt9IbFTuEIhjEHBHqb3e60guFyM2787+XgmBEWlYKTsN7ob3Ua+iHJ4YbqXyngVXSf7EpVijiB5JLHxqjxsSvzakzYiiVloMq/Egb1NwVWWxWkloKEa0pWM622yDPwyO/9tDZOA0ngqQvl48mvaor48z66wMDIJLxTj4nFUkOfcKleatpz/4+lQ== 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)(1800799024)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:10:42.6434 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d3b3f41-0eb3-47de-d1ea-08dcf961fcc9 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9253 As support for multiple simultaneous platform handers is introduced it's important they have at least the balanced profile in common. This will be used as a fallback in case setting the profile across one of the handlers happens to fail. Tested-by: Matthew Schwartz Suggested-by: Hans de Goede Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index b70ceb11947d0..57c66d7dbf827 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -164,6 +164,10 @@ int platform_profile_register(struct platform_profile_handler *pprof) pr_err("platform_profile: handler is invalid\n"); return -EINVAL; } + if (!test_bit(PLATFORM_PROFILE_BALANCED, pprof->choices)) { + pr_err("platform_profile: handler does not support balanced profile\n"); + return -EINVAL; + } if (!pprof->dev) { pr_err("platform_profile: handler device is not set\n"); return -EINVAL; From patchwork Thu Oct 31 04:09:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857541 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2071.outbound.protection.outlook.com [40.107.94.71]) (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 E2A3413D600; Thu, 31 Oct 2024 04:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347878; cv=fail; b=eureNWxfAEFzTxbI8e/7aNBemzV5pAZsyrNnMj6JZwQJPVCVAERdn9224G9aAVL1KrPT6OlQcQGuVzmgA1s2Th7AKKWu0G3vy2vqke9Y7Wda/J+NbwvsoaNlk5/2aEnmgn3uQcGVMtpWwThei5AU7PqZ9OrYq+22EKOkveF8U/M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347878; c=relaxed/simple; bh=aUECkS8rU1nY3fzqvmb1sAn3nx5yAPU6ohrRg++j6KE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RxDp4d7poL7WV69Xu75+rED2CFNkJvD/KQX6kBlAkXsy2Tjauvw3iNvyG4KhjbK+ffTaUVoqFnBo4YV3UUH/NudT+2nZB4JPK1PGxzKr1MzLOr8ZaHfbvqQ7+Ft6McVXqw1Qm3Spi3C5FyZ3RzyT9q+lpKhRihk1QjHiadU6YvA= 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=IVObesI1; arc=fail smtp.client-ip=40.107.94.71 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="IVObesI1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qAwqsGxft0ZMVznLkxaW87PcGfi0ZrGfzqZvBpfzn6XgULyfLCm1eZl2FWP0+KITjz0qMwqUF4Jucg3uXg3YxLweSacpY41e+rCEviBU8UTjrJy1M6UU6NefjKqxJE2vA0Q5aghBrU1IsDR+FjM+DhfBVhici0lXRDalpmsFfURY3XAaBV22sFtT7jVbZdi4kGT7rzgg+y2JPoC+KDkWMRkYfeTdD6x/CUhod404fC1g39exwOIAm1tJ3Vtw6DbF74I60sgvtS+zkHpsmKG0AGukuYi7KCJMYH70UybutHHXNVxGgEW2D6UaRslZlMzsNB3mqlqRDhaYUAmmdJy57A== 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=8EzwS4FBEC6WJMYqrXUBj/Gnio3mHsXYP9NCxxfe/YI=; b=nSVYXGaQokQrbBWJQPZPbBouZ2ZhuiYgTqyF40MDBFHs8cuBNEjGiMfzzKwhvkU5Yrd/B11b5nylkBwUm6T5qRKw3EjEVeHtCceGmhP2GfBt/RKldEb4wXM89fMFGOruDeZqAo6oeeLTZGWGgmzlH2TEY/+BV6LBAryo+5JHScW+mTWyRo+ohjOrsMFjXc6NuiUx7h3kwYfE0Sm1Aa19MOOnNA+b3B2RtBayc7e+ZB+dOojUia5nDZ3C7O/9PsH0DQb8GZtQ/dImUmbgZtRitYnPcHvfkAXKSrW0Jp3sxSfBChxYF9w2fgVmJRi4IYRLchzQTVWgLej4IZVqRiL7Yg== 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=8EzwS4FBEC6WJMYqrXUBj/Gnio3mHsXYP9NCxxfe/YI=; b=IVObesI1Gn5zTR1/e+ixQGRb03JyCU37J4bfYlychm0pKGPIU1H18ReD4xaBBKcN+6sXELKdBByixtN2+Trg9iRVRVziXXhyTT9KY44VkybskVCBDGCNZAWAxc8cC6599kBsI2HYOVLFv5D8DL4ECt8kYyeL2PBt5V3/gp2L8Lo= Received: from PH7PR10CA0005.namprd10.prod.outlook.com (2603:10b6:510:23d::11) by SJ2PR12MB9115.namprd12.prod.outlook.com (2603:10b6:a03:55c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.34; Thu, 31 Oct 2024 04:11:14 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:510:23d:cafe::13) by PH7PR10CA0005.outlook.office365.com (2603:10b6:510:23d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.23 via Frontend Transport; Thu, 31 Oct 2024 04:11:14 +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 CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:13 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:10:41 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 14/22] ACPI: platform_profile: Notify change events on register and unregister Date: Wed, 30 Oct 2024 23:09:44 -0500 Message-ID: <20241031040952.109057-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|SJ2PR12MB9115:EE_ X-MS-Office365-Filtering-Correlation-Id: 1acfafae-5512-442e-538d-08dcf9620f76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: 7iW/Zc6JwduaJx1C+t4CzYq+Qj78edATH94x7irk2Wwr2wG/Ob3rWTUW991We4uGHaPx7FSwk49hiEFXtKPZ2F/9a02/FCRwf7pVZk1yMJTwKuJW8I4bywtZZrFf7xW0vJgqBbGoxK2Rd/jQO/GLid7WD3aM41vB5cZmZ1iUxyE+yL3TFRarDupk2/ANaGFWF1y/m8nr3QedqZDhnMWzVorRi602SqRszYMTqi7gO5YqizwTZgbHc/UHEvXZUjZeYhER24wihhIJw+aTQpRkmBn/39qkuAGvFXhahKLGL6cfo+5GZR1XzKH7zOxi+nrQCPe0i7eG9WAjpDLI/ktGwXvyDWh9smNPI6q8sggJKy6gqenlmRjGhJXwoG5hpVqafP2wYN6i8Ym0jpMasBiOKg9Q8u/f8o69IVfo3HT24oTks/SD9+ckcT2goukOZca5VsqJToS58YKnUEzmtKd851nAoIinwtg9MGDhvod5JXlWlJEwewYFBEv5alBdwr8pD8lmdOF0f/xxlaxXALuMXJrRfoA1Md8lyWoop/5YbNMjiKp500oFqvNfwdEFXliuD8k3krbI3etGYbMdvh+OdJiIFxDhS6pdCDND8IwSwGVKped8T2f8hdKC/BtrAbqkdTli7RbXOLFPSLC012P9XmVkN0hvHgsJ6c1PgLw7XDpVblxtiDOUrFlK9AK6sHun7NCUYoueg8LHWfYmrxQ/v2u7jwUwaj4x/iVDP93RmMauyxGoMzA/HgohrEcHOGQl17WJ8T1/vgfNMk7CEN0xDIQqEK60teXqEO+bIzlskXJr01hS8flteHBEFt1A5+eNIpM6SaCBtIrcz28c0dm/xR/EYRnyIIjZY8n+jCTfoOeEaHYTanLtXGRkg4KpJnJ71wqSgpQkZFbY2Ns4yAqE2L/hDYk7RnA1hEFwNhP8ICWDhNfuCMDTIAPLNTm4u3TPfIeKi6hN3mgGbh7OQHDb/K+aAIyXMvIaNfy4YNBBYsJlFGWSXiCgJCyTgUGdNLcCXW04T9+eSvo5j9mpDLRndgqnCnmKx+RoAT2cdbcv+X49Y5uLSVXQl8QK0Pll6lzL4idJ0yuIoVC+93vryeVtUQcyoPuZ0YpZO2ZmKiVTBf4/3cGsgoepxALV1GEfPMi6xvpbOukF4cKMrGBWco+sAK52V30yWAyj5c87avVYa2U/RLbD4jwSsnDPxQCh7ZXXgxVBtLtmUGO4ROCO3eCDCJX3EFSSKdkr0E96jxM82u2dv72eM2ME+ot3mX3e05ZZAy18TUa+ZXPc5KXVOpbzpBjUJT4UXkjKdNHv8IMSRv4I3VHTTUv1zgYXZLIItZdd1Gi4clYtw5s3QWsnCKKmnS+G6O27k6+5vvpAnpC5MC4ifdcMkT7qkYKJelIWyeBMlRtPoy4pCnr9AxYZPv/0vw== 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)(36860700013)(82310400026)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:13.9573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1acfafae-5512-442e-538d-08dcf9620f76 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: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9115 As multiple platform profile handlers may come and go, send a notification to userspace each time that a platform profile handler is registered or unregistered. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 57c66d7dbf827..7bd32f1e8d834 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -182,6 +182,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) if (err) return err; list_add_tail(&pprof->list, &platform_profile_handler_list); + sysfs_notify(acpi_kobj, NULL, "platform_profile"); cur_profile = pprof; return 0; @@ -195,6 +196,8 @@ int platform_profile_remove(struct platform_profile_handler *pprof) list_del(&pprof->list); cur_profile = NULL; + + sysfs_notify(acpi_kobj, NULL, "platform_profile"); if (!platform_profile_is_registered()) sysfs_remove_group(acpi_kobj, &platform_profile_group); From patchwork Thu Oct 31 04:09:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857542 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2052.outbound.protection.outlook.com [40.107.92.52]) (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 B4626126BF2; Thu, 31 Oct 2024 04:11:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347880; cv=fail; b=Lj5C4NUy7WHItLsBfoMmztxZ2NXke5Kz81wUJPNPG1R2jAFNms1w2HVwKoPKGZvIDDsds57B/3Ump+ahF1jvAOeb1Y8uU8hNayk8xsPT8AIu9SDvDacCmI8uZ4Uej3jayBBhOFQchTZg8jQuZ/Gmd1eGSg8NXSvaJntfeJGr4Pg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347880; c=relaxed/simple; bh=OtCtHlpL5bk4vLAegdwWm3/Ky92bzSLwgrPBZOPM1rA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E/o0Yh62SB7uZfzZHYOGPOM40pPDzNDRYjEXOvPjBwpxx+g08Kl56+QIdGFiAnY58N8rWnhrM2qySmVNskhHaHtAF64uk5bFy0bfohoaP51ZxrClsbxmvLOa8yaFqEfqzAeMPSBXRaf4OqWEqYuDILIQi0wcI4vGXIpAEGWjC4I= 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=5KLz9Udy; arc=fail smtp.client-ip=40.107.92.52 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="5KLz9Udy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xrN0/Oz5XSxP0sR21Bp8KQAf6vKol6rXibbowHQ/mjHg+2M7dqCdR6Py0denpYSuYQQB5pz6yEG9YUm5D7/YSl7VUY1/pwQo6bJJ7Eju5VvQfDC26KVVZ5cAvgCSdRQZJgK0xUiSZx7AyMGzaQ3rHBTiMY5X6DSG5jleknxih3Aq1HlKToJuxsz9VtW3Ken6UGCuVFSv0AOhXuTR3u7mbEXzeeyBtFi7pn3BX7g41dEiWSx+zZ31WbRwlsZ9Wqit834aiYzGzIodg6R59/0kWfOP5tiXEBTIohH0UiEQjDFzHCkuCKqkk+YGr/+CjW2mz3Ez58Nf+fHuNdAsvrDGKA== 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=GTMgLG4xbIsY9gFb29ycOBwD5iLmIPptvlydkm4UJuM=; b=KWiAQGtVj2s1lxGN/r2e6w8Ch9o01W8ZHV23kLGFcXpe3YWGE69D08XuiIULSfV1TL0ZVMxD/nNXALqOKUBF2pUSficjSH2KNTS5NogfTD6EPl709AEaIShTa7SOj77Bu6x5ZN8QSaBbOiHLvrt5iiCBnTM64KAJbGys/D23PaRV+mwtOLXOcz7srTVIa+yZqB3R1LSy8hiPpQD/xXtB8D2kl33Wt2QQXnXMK7xg2Ri+n5C544oDlRtIdoXGjgHwSYKkf+i9miFuzI434JohfPG6IAp5ya1IxfaFcEIuL84kywXSVbWwxN/ZwaFbJ32EsRrfe+opg82kY7/Qf6t1zw== 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=GTMgLG4xbIsY9gFb29ycOBwD5iLmIPptvlydkm4UJuM=; b=5KLz9UdyVZH8KcqD4FMIea1rR1advafVoeDMWD5V5CsFKJmCXN4InDiYgHrGBQ6+/9BR4QF731jejIJJ7iBs+dhsy71p9pnFhBoRV2w16HcHELirkZzWMLqFTfyYpD3dQfSJNEMos4/4X27J5iHfBbFoHPriNIiH3xy32wZJW48= Received: from PH7PR10CA0007.namprd10.prod.outlook.com (2603:10b6:510:23d::7) by SN7PR12MB7854.namprd12.prod.outlook.com (2603:10b6:806:32b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Thu, 31 Oct 2024 04:11:15 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:510:23d:cafe::ff) by PH7PR10CA0007.outlook.office365.com (2603:10b6:510:23d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:11: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 CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:14 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:13 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 15/22] ACPI: platform_profile: Only show profiles common for all handlers Date: Wed, 30 Oct 2024 23:09:45 -0500 Message-ID: <20241031040952.109057-16-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|SN7PR12MB7854:EE_ X-MS-Office365-Filtering-Correlation-Id: bad308c9-efbb-4e67-c297-08dcf9621007 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|376014|36860700013|7416014; X-Microsoft-Antispam-Message-Info: 0htAXIwqA//U5U8PKOmOfACotYNVuT/ckP7MsWqy/e3f3fkCCmApYlFpqtHPvvjfTEa2GIhafbp1Oq7mA5aRJj7br+hqtPJZKT9ZIomFDKWNnEugDOPWEbENKzJjt9+D03rQyhNzZ1JzfxvYxbtcX4bP6aVrm0dU50TaJQNnZAbOA5SD9SNnNJWmMqja/yp1sItJyHghqa+a73ytXy39ZMIcobB9/EF9v0Z3s1uh1KeMHR23jliEGmUKcYfLyycvVR+UBsJGR1qy2ptciY3+sDNa44g2MQOchkYRNtXOjHPrTj8cpoNB2vgrUxxlfqhw2QneMy29SM3sBzLAqHuYxhA/2ldJQBZxZHr5tflsY/AdHmI9IFQ9RC79OqOd6IEDr9ewOLPFx9yvApL8PAZUvH4pm8ADpxrNL9MoYbu7FCzfrHq1bdVU/Gjg3k9aKUuHZu8RQLyqUpM228hWQJRArwEHPQaoMUw7gSG18pGBZZ9ZNWU/iM2aFHiH3KxUnbw2danbMSba+wahMTd0AZNawmtqQw3yNDUVxIPfbvDaesB4CyhtNy1IFtiAotBjVxV91ohLW83xsZERXIO02fZSdnvs5NesWf2aQrHj9XoC9z3QiJXVrKAm+r7wg8BAZIl8NZlk2KFscS+3gseeh1ezzNLTx1QVw1lVDTEOkFbpf6KEPxGApwE9g3zvAKcKeil6U71EVru/G1SgLD4eyP25J1nZnCBSnEjogCudNgSImbgTprHlJBFW/ceNA+IDYqjM2H7F7K1Tpj3m+l3zRQP/5JLNRtHhmDOO7LcEldESk7McCU4Q7mznvAeI/j//fLwx17auEAT3VJx3vMnTduRuBiQ53PLNaSgPoEPol7UJU28NUyOGBrbQuMlIM7pIDThRmSNoV15rgehSNUM8iiO4VMq2vr3HFqarmlNCDB43KSQ5sE9ovYj6Q8xAqodngN9QCu2PT0PA8/mWbGMbeMZg0ktjo1Ztq8i3aUy/s0+wzeZsmqR6G2VNEf8CewBpJ/n72TpHL4Uh/xmnnvfwRu70ouqG1dIXs6FCo+h4Ar8EdAABV4QmrmdAbtra2AbKfKHZVuSovDg0cNYt9rJcSFxM3NYAUEYapERmLs+bM7Zx2u8ElxpSW8vo3zeag06qaehqW3F/dOAyXRSMBCTzo6Hee9kLGo7s4ioiwtPtHsP/quEg+xikl15JoYLdg6OqC+R3Dam38u3EFpWcwncIBlh+paL5ak73BiSG+oC8Auj+F8unK8IJCtEi39k8zT+PePowUuzP6r1YT+uCsr5jt/uZbJ9v82Rzp4szH6AiO5V0gRBbzxi7on8guQdxcYA/huSum3Vhd4mc4oWJh7yoN4PO+dIor820az3mWX5+0m1V6LehwYOh4lzKk5hycRoCLVrR+hIWw7sEOZjBh8n2qs7VBQ== 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)(82310400026)(1800799024)(376014)(36860700013)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:14.9104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bad308c9-efbb-4e67-c297-08dcf9621007 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: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7854 If multiple platform profile handlers have been registered, don't allow switching to profiles unique to only one handler. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 38 +++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 7bd32f1e8d834..90cbc0de4d5bc 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -29,23 +29,43 @@ static bool platform_profile_is_registered(void) return !list_empty(&platform_profile_handler_list); } +static unsigned long platform_profile_get_choices(void) +{ + struct platform_profile_handler *handler; + unsigned long aggregate = 0; + int i; + + lockdep_assert_held(&profile_lock); + list_for_each_entry(handler, &platform_profile_handler_list, list) { + unsigned long individual = 0; + + for_each_set_bit(i, handler->choices, PLATFORM_PROFILE_LAST) + individual |= BIT(i); + if (!aggregate) + aggregate = individual; + else + aggregate &= individual; + } + + return aggregate; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) { + unsigned long choices; int len = 0; int i; - scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - if (!cur_profile) - return -ENODEV; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) + choices = platform_profile_get_choices(); - for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) { - if (len == 0) - len += sysfs_emit_at(buf, len, "%s", profile_names[i]); - else - len += sysfs_emit_at(buf, len, " %s", profile_names[i]); - } + for_each_set_bit(i, &choices, PLATFORM_PROFILE_LAST) { + if (len == 0) + len += sysfs_emit_at(buf, len, "%s", profile_names[i]); + else + len += sysfs_emit_at(buf, len, " %s", profile_names[i]); } len += sysfs_emit_at(buf, len, "\n"); From patchwork Thu Oct 31 04:09:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857544 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2048.outbound.protection.outlook.com [40.107.96.48]) (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 7DD191428E3; Thu, 31 Oct 2024 04:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347883; cv=fail; b=CAIPn84+oBa1qgXU3J5R7o8cDEmtjF7RxdnvOJezbzsyIEy/BJXlGdJ0yrH5C5qFIZcyp0sHVzx5Nsx4mQaMNF13r33Fhy5lX25DukkC4tFeVfzXu6g6rvO9dV4Ni6IHlx6xXpN5jMf/XxQ7ammD8I8feYf6Y0Jr7LQr6WYycTU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347883; c=relaxed/simple; bh=qrb4y8DNgSCrDBbHhO0W2f8rcPdti6swkaWXkEoVYR8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VwNVIQr9MyVd2/+YYY5x8RUuVQHx6imDVJbwogS6DFyaitM7GydHs8gJfpn5T6SG+AoG+roURJzbKnz9CL406pr9jrX6w9x2x64tl/UTNTvZHnxnZTJ5EfNRgcLzBvsqDjLHZLx9XxSbUga78k8GScQO6okyMK4F1d81dlbZ/A0= 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=Wt4Hl+5S; arc=fail smtp.client-ip=40.107.96.48 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="Wt4Hl+5S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xfQUiQcrQwbEFddmke7tX/PYCu4uSo7pQq0YTqJmY6MqKWDeFLIhSLa5oWirBzz2htB5nrnXoeK9JVkFQyGcQX4beJG0d/Yru2H0HnIYvJ12Ydisy9I72koXeDylQ8paJwZywOiyyhik6KJxz2nXxFsAS0UCJisFCzzfc+R7fxfyPU5NfzXG8pGSGGO+23fYqvHsRzdoAzBNl2I0r4UIcbIpMvgrbadQ/q6ARsBnHkZXpQvCj68jpWgR6Dh8bUOdndSPhnE5dSQ4A3vwZ+YG0IDjZCIhbUsUBz9CAMq7wC1H4lryB7i/XjKGXD2uzjLn1gD8Tqc+V7Zi3xIt3RVYrw== 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=xZRw0PnuGSquX6w1fAZagDnZwh1ox+3Ian7/NRON/FU=; b=BQZzFcKIwo9fU0jgbKL/yHtPkAtop+lBbf5wi8OPPU7UlKqh3JPtape0yjZV0T8Ul+y/qb7f3W/QlRYQO+GrlvGEWtn1PZV0QT6xSuCHJQArwg/+FeyBhWG/SaPlON49Uhalg2uX7fDDJnVPS5uQRqWSFvKlTJh8iNy3QcvlAt3UthV//or5sD77dxsv7xN+mMqM4EZZJSU6/1b1370Y+FVTQ8PZ11nlYGa9I4spckruNfrs4fWeMn+WpZhio+94xWPEdKknYJaZp1HAidalcD/YeNznumSvTqHLpMZMeTt+J1o+M2JwZw/7JvTcKxvjRLpwmKjRnYRWuYw2TMczpw== 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=xZRw0PnuGSquX6w1fAZagDnZwh1ox+3Ian7/NRON/FU=; b=Wt4Hl+5SEQUqrz2fQb4kj7usagNfB9AdefWIInI4w017FuX3p2//ZVgf2IaJSqc1Xr2i/B+9l0Wz6k+k0sRQAC5XSYoW3HfWpGNbb25BRbBDV6JCqZXTP9ugl/3sCnfnCNYWKMlsVS7sypVzUP+0JFWY4BcuaPjf8w/INd8lLQg= Received: from DS7PR03CA0354.namprd03.prod.outlook.com (2603:10b6:8:55::12) by SJ1PR12MB6147.namprd12.prod.outlook.com (2603:10b6:a03:45a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:11:17 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:8:55:cafe::c9) by DS7PR03CA0354.outlook.office365.com (2603:10b6:8:55::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Thu, 31 Oct 2024 04:11:17 +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 CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:17 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:14 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 16/22] ACPI: platform_profile: Set profile for all registered handlers Date: Wed, 30 Oct 2024 23:09:46 -0500 Message-ID: <20241031040952.109057-17-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|SJ1PR12MB6147:EE_ X-MS-Office365-Filtering-Correlation-Id: 057f5614-3275-4f45-3ce5-08dcf962114e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|7416014|36860700013; X-Microsoft-Antispam-Message-Info: 5liTDJdmhzzYsbqhI+MUeBuYt2ZVHrk3wB2+yGRmZNJ7SdQ3bsvDRBzodW9i0oC+1UuKH9+Vr6QIIHXK3xlat+2HDzHHmALi9lRT/d8zzpHaBqvXETI6ZIzfS64alTDHr5yd0oLftcgaZWb0ETksorSWtinvoj2F5mJmfaUSFQC//BPRGhlZYAdrgdONnXxkjCnAfuEH3jCSfjxy24YRdpqPky7tBA7WRVhliJRL8z1y7nTPRjBbKf03rn4+UJXdT5UIt+fnqY9k2RALvzIAzxaF0cbn8xQgaPcTcQZ4pa3yfoIL4jf9eu45v3oQYjPiRgCUdw4cLbxJJSArmWvX9cjxvJjzImQXBEc27FSdXyX9tugFYUppEwd5p8KMBdYuUDIVuFwNP1yteMUvbeCiu/FmD5E3kZXiL/wkk0zNvTq3ES752kEGwXI4QrOzup7vzBlUO1o9iTVxUFmf+YReh2ZKT8QCHQEX0DRq9wdIOXBLdtqmcpOSpEGlj9wU7MrpRTevTkSxH5bfAgQFZrS7NzZcm+dOprr/sNAgq0SIHdTouKYWt2k/GAGe4BBSsFq4/s6StGNCeze5ecLmeYodcLw7OTipKmRSnBdCA2NcvVLUWELMIqm8JQC4fmEk8wrhVJLS1jq7mjjN+WcCUM1Bj5kslP/0r/EoeILYnOnRg1nj4uAyzNjbkl14VF/miXN/TyC42aAXFFSXcHrZZPIBK3xGJa5Yv91n/wyOwMOX7G7Z/elC/B1Z+LkqxpWsFcOORvonckJH8Fl9djfaR+NQBsrxejE3nWClxHbA3UjPb4sGM+BlfEWNqbRde+edKgDapVe+4A8dcqe6kYY2J1d4lHlRrA4W/45molS8Hot9VLFp3UxuyAgyE+VbwltbSdK4iRe8oL+/XvOPDp7Q64zm6jnZDsTPHV5PP+ZJKo1uib1jz4Z+QXJsH/mi64mfBtnUCxnFIdliP7wr7xBf0UoyVIGir1dW6QklydEq0vur8sVfHGWODQXkPm9TiEEWIWGJy1OMC/JLaifhODtaa83yCK2jaQdmaZgAvv75qu9oYp9S2C55Is30YmV1D+Nfa3uS8s/jNYCS7wIr5pRJbr5XKN2jw4m3XorZe5v9DvB+uKXiVf207RlvgNwzBl3tiqEAXWOjC4C65NEI+B9oNmOl+mNjWLq3KpG+PdtY3IiXvtJ74zKOkGmxf49gj9Gj5ysLB9w7jUDlCML+oYl4W63UaMCJf4nSn7xSTlrUxvzZchOoaiNn3j1CvHf1L+x2LjGRerszrQkVl63/HmCBQuhWrcfzM3IQo3zOvdO0tEX79gze/FbyEp3j4fUvbkApQ8LotwmcroWk6YLSdazAX5eWCJNX/fDoSrs1cvgkkEGCz49LJb0CK7ZRb8vUXOI3m7IY1HXzeA5EO/yF33lOIGHK8A== 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)(82310400026)(1800799024)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:17.0656 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 057f5614-3275-4f45-3ce5-08dcf962114e 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6147 If multiple platform profile handlers have been registered then when setting a profile verify that all profile handlers support the requested profile and set it to each handler. If this fails for any given handler, revert all profile handlers back to balanced and log an error into the kernel ring buffer. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 90cbc0de4d5bc..c2bb325ba531c 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -99,6 +99,8 @@ static ssize_t platform_profile_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { + struct platform_profile_handler *handler; + unsigned long choices; int err, i; /* Scan for a matching profile */ @@ -107,16 +109,29 @@ static ssize_t platform_profile_store(struct device *dev, return -EINVAL; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - if (!cur_profile) + if (!platform_profile_is_registered()) return -ENODEV; - /* Check that platform supports this profile choice */ - if (!test_bit(i, cur_profile->choices)) + /* Check that all handlers support this profile choice */ + choices = platform_profile_get_choices(); + if (!test_bit(i, &choices)) return -EOPNOTSUPP; - err = cur_profile->profile_set(cur_profile, i); - if (err) + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, i); + if (err) { + pr_err("Failed to set profile for handler %s\n", handler->name); + break; + } + } + if (err) { + list_for_each_entry_continue_reverse(handler, &platform_profile_handler_list, list) { + if (handler->profile_set(handler, PLATFORM_PROFILE_BALANCED)) + pr_err("Failed to revert profile for handler %s\n", + handler->name); + } return err; + } } sysfs_notify(acpi_kobj, NULL, "platform_profile"); From patchwork Thu Oct 31 04:09:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857543 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) (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 7FDD413E03A; Thu, 31 Oct 2024 04:11:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347882; cv=fail; b=HixHh113DsFrptCPOU3zZb4BsMbN6yu9FRYWZUraer/sDYFXtCMx/4fufGF67DQ9UjIkxzwmbKUK5jss9bRswGrWrLreYt7uURUNT656emPq9hZJKTxh6Cc/2MHlAvSWYWiiktOrywKmTGp3HvwqMtouS3bHWxEFFfurXlNAotM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347882; c=relaxed/simple; bh=FGMZ2R/7poj/mINnOz6nbRH87uy6ciuIa8LOGQcLobs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bn672iiOd4LY6BoS35UvkkfU3/hwoaAf8fu2CT4VpUgjKQ0YERGZftGLLW9SjFoThqb2Aw3th5AD+MkIr/+lBQvEZ0mrhsn0lEahLGuxblVxsMe5VhSMncTZdlO/04pZ7hye+sRAQN5jWpttQWXABpq65xIOaqxE/n4l8tt2AAA= 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=ev1oKIih; arc=fail smtp.client-ip=40.107.243.86 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="ev1oKIih" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T2cAkzE7VP7OwFCw8cUBLDx1LqCqMqxvq9q69yq/7deHpHaaLYSmXGB4NA36rprkBXDeYVxtgkdlMRRkbKXgxpuuUYnlb8KKxhxdSq+rA2R7dj64MTouwxNVH1dRMOiHOgfdZ+N6MS6k9pfpRQQkpQe80Q86GIAg8zwdP1A6BqG1/5LTX45OnPG+5Ao0r1OlHiMDYbIH+otbafXxybHKUOPG/ZhBADYA1d2mmJAMpPduuHBRtEcZrBMCa0zCA6XWXrxq6pnEqwELix05F/ldDYsv7wZtbl9zaO5Kuw2R3gLaVPfIBzCX2n2l735oGph6MMPPPxEiorYpWRAcUFO0Qg== 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=KqhdUL5T+XIdKvYZ5ARQFgfkK5iJmpT73Z6Z8A1LXxY=; b=rmCkR+z9hy56W96XOla2GrGU77KCGahX3pyeAnLMv92fp89UgUYzPOkh5I/ZpDZM3Vd19i+WkfQYs3tbBst4vjh+dvd1yqT6IckFDINIeic5ldyVdQ6YT1YGXuGu4JgoRaVagKS/FnPN1M5yH9CgFIRvPa2m2LRYBte3SrhY8U5sH/6Bzno0LP+TuDDnLA/mOadnQ59k+fj2skId8f6Eu3098v1n9Q539GZG/qCv3fG/p+4JFDoPmrRrvntEAiJS09mrzkrTBa1zogc4S8+IC8L5Ap0iqfNwQqIA1hB/Lu+YzHMPX6gnMnI4CzZT+geYOScq5S65u+weE8OXNx814w== 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=KqhdUL5T+XIdKvYZ5ARQFgfkK5iJmpT73Z6Z8A1LXxY=; b=ev1oKIihS+4hFOkSw4f1ccWjxXD2E8uHpB6vgSaGTTtLG0IAOv7Y+Fe+tGWy8/QSTq3ChkVdawHifVsOn+aPXZyDNisG8t2WJO0g7RtdL6QWta6Q5r6werG7es8P+8Ncv5emufoRZfYX1MpF/Il0Vmv0q3B+TYMvpaL9TSbl/Jk= Received: from DS7PR03CA0344.namprd03.prod.outlook.com (2603:10b6:8:55::28) by DM4PR12MB5938.namprd12.prod.outlook.com (2603:10b6:8:69::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Thu, 31 Oct 2024 04:11:18 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:8:55:cafe::ff) by DS7PR03CA0344.outlook.office365.com (2603:10b6:8:55::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.22 via Frontend Transport; Thu, 31 Oct 2024 04:11: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 CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:18 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:16 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 17/22] ACPI: platform_profile: Add concept of a "custom" profile Date: Wed, 30 Oct 2024 23:09:47 -0500 Message-ID: <20241031040952.109057-18-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC4:EE_|DM4PR12MB5938:EE_ X-MS-Office365-Filtering-Correlation-Id: 197942c1-f4c6-43a7-5d60-08dcf96211f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: SIWPB7jZfpQ1t874sjVzkzvDIRr5A3PDvrRxZnx2rwhdExWCxmH/iSxnJg1Ot01CKPtDUVAKeqdpc/Rx/X4ZIDjLTDh2ZDMBpHmun2fAYKhKb5xhUZrRcErCVlspuPc/VEghEQlHPgdbX631fI7I4rINhJCfPHp5L6/jejobRwfAdHb9IeuSnqEoMjKLi4//yrXhxzE6Od5iR/3kZqTJho67ZWQKK9lj6128n6JBzRjie9x9aDmQaDdSGmc/mUlefeEQZ7G5VmteZBuDKU/7y3gyg7bOEGDHU2czuKIr06cpwVyaynWkyfXowV3jDtLzXK7G0tFwgf7vtsLHsuw0vQEl8jZyFHCll47U3AoRlpQ0lwKa4xwP4iVSxfFwzmlwCY8zaOBvo1tqz1irEKWQYGlL6IGfpfnn8+nkmgjrsRv+9r1HYPetEr0PmIN3+02TpM/g8rulMeFNfJ1FOLQO+a6Ox4qy9hkCdwGIs5KeTFrW9bpZJcQm1sjjodmEuxnLkP+xojx26cqpDeosMtW924HUW8CLzVk0yWWh433s4CN5FPgGLxb4jpQAxydoCWBHxSOlY/VDfWlPMJ8zjMtBRbPK+Ed9VoLibDjWwtF2/Q5TfOPDDiVdQnNN/3xR4z1onaUqHIY+5Iey7ubZMekizpv0ivtofKvAN7GqkRGb/d7RpZTu9yUdzDp16Sh1cI5IlkKtXYvT3nMd5CPL2t2QRsIMsvBre8l0ExuL38c5k2+6LHYTEW9EdOHOmxiVrw/GktctglUNqqgqxLKiYq5yanRc/oZWJIS1RDq3OXJt5tMNfpWQ8qdNoNbp4jq91O6i9e3F2ROhVz0TcyOgp7TNTUqAxGmMYRbYmbvEhtprLMJfGi2YxdMtQmCp/4KidvLBJxjhzOB753UqaaPw5ngTUBLSbJvmrLUB0zG9rgS5keawfUBAQN7oouTrF+zzwFhDpGTJYmLVT0tYSaXo54LMFDFx1MX/p1XJyutSEVh6CZDpl6dT4JIVurhaR+OUHL4YPGN1/KPnYEhBoN4IoHVh8S1ah4mknCU7pMS5yXbWkP+USxG9w8iUJB8755GYjRvjd0jNqCClGOYefM0setrXIRMLFtC1gvlqqLM5G9jx1F1Gx2vzzVZUBjZEZyp3rPpTuywgcGg+xexjC9hmCtO4WgDy8tkO+aeRTo0p3x33SbeXEQKQiWOj285kWXFy61MRatBqk+fd5MffOker6Sa5LYyBRx+TmfBROleCOp6q/AFuVItvc985zOO0Gp47q4qOBRsxXDCPZPm+gIwxz502GXbtHCYEGgccUk7iaMMyGDBLS12JiEiK5+vdu7a3BPnrUKGpvHvPqAwkfAU6wZro4B3qMUAW+5O9CufKzR+D0LvmrWok24kDn9zgFxK1urUmGEcfPGeQ+LlbI8EIQRpdaQ== 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)(36860700013)(376014)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:18.1125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 197942c1-f4c6-43a7-5d60-08dcf96211f0 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5938 When two profile handlers don't agree on the current profile it's ambiguous what to show to the legacy sysfs interface. Add a "custom" profile string that userspace will be able to distinguish this situation when using the legacy sysfs interface. Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 1 + include/linux/platform_profile.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index c2bb325ba531c..3128bd16615b6 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -20,6 +20,7 @@ static const char * const profile_names[] = { [PLATFORM_PROFILE_BALANCED] = "balanced", [PLATFORM_PROFILE_BALANCED_PERFORMANCE] = "balanced-performance", [PLATFORM_PROFILE_PERFORMANCE] = "performance", + [PLATFORM_PROFILE_CUSTOM] = "custom", }; static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 6aad98f4abaf4..da009c8a402c9 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -23,6 +23,7 @@ enum platform_profile_option { PLATFORM_PROFILE_BALANCED, PLATFORM_PROFILE_BALANCED_PERFORMANCE, PLATFORM_PROFILE_PERFORMANCE, + PLATFORM_PROFILE_CUSTOM, PLATFORM_PROFILE_LAST, /*must always be last */ }; From patchwork Thu Oct 31 04:09:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857545 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2074.outbound.protection.outlook.com [40.107.237.74]) (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 155891465B4; Thu, 31 Oct 2024 04:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347891; cv=fail; b=RKDtR71MRKWj9vdoid5lKtUC5RCG3WiVzK6aTbfXn02JeTDq3ol89FMNQf79Epj0QmDjBkx6HXA1WmtA2lcIMJftmSaU5/FEQ6ZAixG9/FgBDMI8CjGLbl1qEKNIaxTPgSbJP8kNfjizWSeXikJBVjMEexNOx+HmXLKUFiPRoac= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347891; c=relaxed/simple; bh=6UK4KPOkTBXgHgJ757at4Kltmdl+cBgVmhDqbaSTfAA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kbsCvE15b/8mzr8NIl6mOHYhmBGXaiPRIe1QdKKuls0IU6o595YiCq6fopxGtDZgX/ivUk5YoE6b12YTpDQfVhS+fGC+gLm+tZAO9rIz7Rk7HfO6aLRoXw5UTNDK68BjvFRxNYj5IKUDSfiujc5mN+QSIPz5UoMeSTu9/str2SI= 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=VJw4xBId; arc=fail smtp.client-ip=40.107.237.74 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="VJw4xBId" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SIXEVH5xQ7CSs0V5Du2JP4uhbWWEuOEZaWEAOYEG4/+qhb0GKoEsfpOJlFSvQ8OTE14JZH+aEM3FMxdZmUnHzMJ4t5ojAXKJ/BjpDzzdpOK3K141/TXV2155DdGTpMs/IDuUb21qPYxcDCpWAXphlwGAO8+zeXaDpABLm27AKYd1QRBscgVv9NR46kNHAlL1Q8Al9EEaTzJ8cCI/NPFEpaiHTXRODBiNfCLT2V2Q5belW6xcR+hTTq/57Ng1rrsgGCNe/uThu4YvYRH7gfG04maauyppEl1czxsJdWVV8dZH87xgXMhzCWT/aEPXrxvyqpMxkmveLd7GYaknemxffg== 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=Tym0pi3XMzZvhS+YgNcghEe1i0+BdOuSCGVmlPuXgk4=; b=VLexYoeq50g6vU3QhgcNSifhvuSIJGIjXfcFfS2SE17714BqzUKD+6bbeYO7dZNeKeSXFundm5Yo1vJB8fA9MclZebqN0OVQb1gtfUt5waZpComDsfIKcMXzN4+ud358/DKrOCcuzi0mTy2lmrJFC0CdXlgdlkI9P7eoLu3Oi2EiWQlN81YwQTBBbbw8/+ulUPMhGOFrlPK4doLbbK1KV5CjmsL2EJjr612FG6NjF5Dv8PU+g+X8Fg66i0g7GthfUtxqCCr+fNh3rVNwVx8ql0Xj6otZE9Rgdu3lZmKFbhfUiVzQerNURGHgr+ADe9uEScNcT02DhhPOcnI0eXEhyA== 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=Tym0pi3XMzZvhS+YgNcghEe1i0+BdOuSCGVmlPuXgk4=; b=VJw4xBIdpdZ4H61SJ64dpUAkNaejERKl5NskEEzo5WbGhI2FdMkuOm4+Fgyes5svRG/KCLUuBI610gGgjwmkRPyQJ47QgK1HTkeFNpSnSFsI4g2M9YsONFAA2xb1o0KzI1yds2cgqVIQT2gs5eK/ExzFwWXcSTRn7fLEQZa9Pw0= Received: from PH0PR07CA0047.namprd07.prod.outlook.com (2603:10b6:510:e::22) by MW4PR12MB6826.namprd12.prod.outlook.com (2603:10b6:303:20c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Thu, 31 Oct 2024 04:11:24 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::3b) by PH0PR07CA0047.outlook.office365.com (2603:10b6:510:e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:11: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 CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:23 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:17 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 18/22] ACPI: platform_profile: Make sure all profile handlers agree on profile Date: Wed, 30 Oct 2024 23:09:48 -0500 Message-ID: <20241031040952.109057-19-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBE:EE_|MW4PR12MB6826:EE_ X-MS-Office365-Filtering-Correlation-Id: 05034412-6068-40d1-f1cb-08dcf962154e 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: lhQ9T9EzHilgkvtcFne34U90eEKTfK8DAI280sPo+ARnFFMRFTOdoRqAyo5FJRmNXzOn72qS/8m7oUtIl1VOWqcFfiferIhIKBNxHxPwnaNy+TR1ttDtfrNxALqpogz31PEGUSBNZ9fpMrUlAWdJdBenL9AwkuD+4QM22p3v3EYjAh/lDXHrEz5oykXN04IeVjCBPbPE2jBdUUlybFRdmFeXE55QNBdLR8IryVw7YbArrIKs7BA5FqvboTXeAKb3pd3rf4xXJWfxzEVL7p1vlKVlFPCFKiy1NJfebh59n3/rkDqtuadDS/6ovTN0a1ptDy0KHi7BXz0GHyXeJajUnh5lME8BAplcrM2CEiVz1a++xsXbnOlqK/DE5A4Z4I8801pmS83s227VCZDQXLUOoPit1cpF0FgqL/3Sm9u3/Q9b/X/D1qj9fMvRY/kn++rWSjZ3oeR4j5ZuzP9kCzJPOMK3FytxGQy0G2Ldo5utD2x91UeKY+6x9VRB1MPMUnBz4XncnPaRYWVeNXW1UCd9VbNbSUpqRfnmpyEz05VV4e0OJXkxISFJeG9TInWJXY+uxsY1ZrUJYZmgEqWCKpe1UvrfKrjfkw6qowZmWKwOa74DgwkJauOoZwjC6FIO07pX/lpHle6GrBpIgUAzmxSspLbMyiQ+BQ/qtH6NS+d0JyrFDLo99HqyXR1FvUew0jbZhWmDW7kmNWRKqkNpxkFUGVQNDAxSBl0+p0u9tfMjCro2ln1sveThmDsCMX1gR4cfjlcfovhXzqGewIcbIhfPhBINzhGe3hJdnPK8rGZ/2bCOEPYJViAZK9NOxjFS4xrcY64XIAjrha1zvxc93YvSXsehjUGtGlVekB+QnGxT4WWzON24R2vhe+sQbi9ODPE161jys4VJaVo8Tdh+MhAj95Im0gr+I7KQ2zp0PqhAd9npOWzjzAtLFpa77HRNZezyeD3wXituh4avaE2RlXAHMTSOzbddQRighD6CEFxA71yYzGndndiermHFSdTFyBBEX8Cnz1c/PNhEQJuAMJ8NUNpZtcMdFmVsDXQEBV7RYlo9uRbycQkc3EGZsBFWqVDUU8vLwdtDhIenUFbqZ8y6tjb9HbH1BjwX/pDWu/uNNfvECDChyfGvQKkbDM5r5cOOtLUN1jv1Q0ItjKlav14lIVrrBDdCgYc0UyPytgbxDWFK0HQro53LOec5tVKYA4e1a91smb1xbvmF0W8rRsEcgQqxLBwF+l2hX3kXyiMD6EKD0yPoPsmC9fzF8YsDMl2EU5HehAkKSBvv5gYcYzmv+gDz0t+8CSIbCsYBJ5VJZjFO6coq/zzIUgzIo/JAgUnCxVc918wixGPLdEYnBII7n0B9cpUMwD15kDx7jwufmJhWby/PP5JLfnS4q+wp6gXkeRIMm6ho2MRNCL1Z/Q8TXA== 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: 31 Oct 2024 04:11:23.3124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05034412-6068-40d1-f1cb-08dcf962154e 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6826 If for any reason multiple profile handlers don't agree on the profile report the custom profile to userspace. Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 39 +++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 3128bd16615b6..5baac1f9a9c0e 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -51,6 +51,36 @@ static unsigned long platform_profile_get_choices(void) return aggregate; } +static int platform_profile_get_active(enum platform_profile_option *profile) +{ + struct platform_profile_handler *handler; + enum platform_profile_option active = PLATFORM_PROFILE_LAST; + enum platform_profile_option val; + int err; + + lockdep_assert_held(&profile_lock); + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_get(handler, &val); + if (err) { + pr_err("Failed to get profile for handler %s\n", handler->name); + return err; + } + + if (WARN_ON(val >= PLATFORM_PROFILE_LAST)) + return -EINVAL; + + if (active != val && active != PLATFORM_PROFILE_LAST) { + *profile = PLATFORM_PROFILE_CUSTOM; + return 0; + } + active = val; + } + + *profile = active; + + return 0; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -81,18 +111,13 @@ static ssize_t platform_profile_show(struct device *dev, int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - if (!cur_profile) + if (!platform_profile_is_registered()) return -ENODEV; - - err = cur_profile->profile_get(cur_profile, &profile); + err = platform_profile_get_active(&profile); if (err) return err; } - /* Check that profile is valid index */ - if (WARN_ON((profile < 0) || (profile >= ARRAY_SIZE(profile_names)))) - return -EIO; - return sysfs_emit(buf, "%s\n", profile_names[profile]); } From patchwork Thu Oct 31 04:09:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857546 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2059.outbound.protection.outlook.com [40.107.212.59]) (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 C223513B2B4; Thu, 31 Oct 2024 04:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347891; cv=fail; b=ffjS2nycfOg4wwmeZ/zG4ifmJT19KGM+q+3lvsn/rkBMAab0RFS5li2UTa2DflWmcDGj0g/gJ5XQ7EE1ANGKO0YsLPsAj6b+W/LCGYs5Fr0bILh71Qr7eYWiWJfKDcBo2If1zQjJbdNW2k0OIXnVMS3P+jSvsKG9ylMopHz1W7A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347891; c=relaxed/simple; bh=OYjck0t5lChXtVOi739FYh2KJY2cGMLR7AjODyNcx9U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QnvWLrpdqH/DtUUulIKvOGugftTt8bG9J04Pu+/zOAzMZGTGwwBkA76qg8Rc+alxYnj6+6YkOXVHhuF1RHPUHz4quZcWEje6FGfnTpQcKuG2fhrfVaDrGljI6UMt0g65I/ikcboGwfXLChy9cTqZQc+jCf9e7mhQGEqBB0WXH1E= 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=fXNUWLTG; arc=fail smtp.client-ip=40.107.212.59 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="fXNUWLTG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=x4TJ7N+H5Db0SZQnQ7Un9YMq1rARJtv299QC3+sbN6oQWI7hovboKbqXjaGKM6g/eKMFDr2qMx+X/BBVI37W5tNf+nMgrYa+/5k6KzsWXgikrCRAJs57QO2m4j/2N4SCKDxrIl4McY9g2r0uQDJ4NLbhqxkjXNtEn2vvb3WkMGbe2KpX9GJlhSI7p1kV2Opso2Gp2verXtjP8MtT3PMbFsSq201ef3OQjrewS5uaqyZ66pGONGBT7/IgJbyx1njlEnkX5ERzgCY0jYrEu6FZKkIaHExumycrXjjjoTRxi56n9vp8hqfJywXPGZfCRtYim8d6cI2pkloCfaouhslYrQ== 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=1BHOmBpCMLd2UWhz8UzPz+xuXGm5140wW5a7FSkKKrk=; b=QMvCMgnxxsSPZ/51IUsp+xWtJjrgbaVXKIZ/StQJvVva2hHn7tcsRHK7BUFNWC73JGqVbZvmn4QqZiLKWf8UHyOm2EuS+jFcp+vz1bRvpUIVii8iw2Hc1nGQM00NoNFAscM9NlcPvEYeuYI+zI/02+hbiFYCwTzvKyiH+EsSHM4a8m793GSHCY/VDKtFhg1peiqbB3H/vhjDmTNE4nlN/ucGhM/yYR9y1iEMNNpYn5hIX8Lgxrqn7psZl0qUsyga/eZiq/iPzEC83dFhRePQ0Vcs6b/j4HiwpF1HzY6xB8STs41glbwxedKPUrNnXKgSw7ftrTRonlf7d4igR74eqw== 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=1BHOmBpCMLd2UWhz8UzPz+xuXGm5140wW5a7FSkKKrk=; b=fXNUWLTGYpHTXAz1bs6gnYa3h+OBwuuUUiNTwewmoxPOBspDXvfeaEGcMcG7CeOY7j8yIpagWXegnRJxWhGrj5dYIKgWBZeakDvimTyYqdrNp8LNkNVAjT855J3Y465ZLdCXAzbDLzWWa0Zz95trpixuTwj7+rknhaid6slxOx0= Received: from PH0PR07CA0058.namprd07.prod.outlook.com (2603:10b6:510:e::33) by DS7PR12MB6069.namprd12.prod.outlook.com (2603:10b6:8:9f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:11:25 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::fd) by PH0PR07CA0058.outlook.office365.com (2603:10b6:510:e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.31 via Frontend Transport; Thu, 31 Oct 2024 04:11:25 +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 CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:24 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:19 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 19/22] ACPI: platform_profile: Check all profile handler to calculate next Date: Wed, 30 Oct 2024 23:09:49 -0500 Message-ID: <20241031040952.109057-20-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBE:EE_|DS7PR12MB6069:EE_ X-MS-Office365-Filtering-Correlation-Id: 692e7e49-a65d-4145-83ed-08dcf9621644 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|7416014|1800799024; X-Microsoft-Antispam-Message-Info: anXxWTWYt72qvS/TR24MBR1AC+R5j/ILRfuCty15EAXxU3wUBrJfkaW7osTkGJAU85bNMp6zIfheS8hI1IFm5FWbd/4pYsmYLlUX30QyLCHCWHVVLPNVRgZ5BlCqQPTTxWd919+PgQFElSRuDK2U3nuGeuJq01jsqMdmedLrFjPXsJoqdh8XMU4s+UHxpqxjfWmPViR6UfRMfpRPaDvnEwk3cPtgKteS5Du2F0bIpNoLobXvfdpj0VAQMBZgPB/7IZwGdDcH2U336Gr3u/mOItPeeV9rPai1HwdasjEXVs23v+rt+YSO2vne7Zf16Dnd6fNq62a8gmDGr6Oe1Mhc4f/AGhHVJs0Oh62kOl7kNkRYaNvpKYRtAWHmUCCyc4+XYWASLbei+KDhzeDw+14ObB/q58FXxZvEwolXmE7iat67fhnRomRnJjraLExDnDMXOzevFd2ntYyz+yGtMUqK9RXJ7L//WvJDOJSB+EEstGUwbTW3LK8VEq7jDqfWgFiBaNJMqCO2T43jjmF1nQLzBfkOMlyXpSzh3PnJxkBtzdLugkX4sCjOWQkYOsRkWBCyKf6GGDJG0yrSn8Laqo/wj+O6tvegIK1hZug/fvusQQ37bLFFHNSpNNuFMzzHJds8SGIiK/2OSeRypqH3vEBp8yBJsTyrw4uaM9RnCss6H56c/pE7u62hhV4hBqjvn9LYUlCkiWc3UA3dJGbJ3z7GYeUrPPx2nyNHgl6fn1IjDXyCV8ZEO1jVkAUdNXEDBq2/9ODLMLldA2Qigk0hrFtQfSkf/Nqv3dJpO8wdlsnzJeUCDvIBlQ2IMWABCbA98f8nPaDJrYXtRWnEr6ksn0c6YuPDhyGpVPONyMev7Ja+QcKFC5F2EsEvP6W6iNly/sWaY9P3XoQ+Wz9WGepCxjTgCYyg12/UYeJr1ZI6RD3i9gWvZtEFrR9lIBdBlBtbGfMkg8O8EKYGTM2QBdB1vqLciecPdOlBD8p2NjJZrj0OtQr4/iL9W1hK4QaSP5OCy4QrDzveFdpXxlFyguVtVX4rDyD+FGw5QNjLI9fiGtEn9vWmyoedrtoZTUF6WDEolyjNxnKbGztpiLi2gecfBUTp2NmJNFP4FJ/271m+raJhi7BwsAm5zqWOc7BALKANdENJCWSSww2Xi7eurzG4y8C1a48jWIptYDkSSPoTY8gJtgCBU9uOTWhpYPfrOYCep87fUvf642+XfkEB+8Scnce+Yj54jbQQIo2E8urtemkv9TxlNmABJ472fBzThmp0scOIBlOTGU/6TOOtgLI8/i8PKs+r8WhUmlvHxk8el+0IOusu6EuIEy7RR09wJAiL7VL0QkCfK7hc+jXs4hhgsMELRf8JUK3zZgIrzmNmjfphkU7zgx4zZ/PVz+mRv+GcUq465HyfpsOUF24KG81a8JMUsA== 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)(36860700013)(376014)(82310400026)(7416014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:24.8592 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 692e7e49-a65d-4145-83ed-08dcf9621644 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6069 As multiple platform profile handlers might not all support the same profile, cycling to the next profile could have a different result depending on what handler are registered. Check what is active and supported by all handlers to decide what to do. Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 5baac1f9a9c0e..9b681884ae324 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -187,30 +187,41 @@ EXPORT_SYMBOL_GPL(platform_profile_notify); int platform_profile_cycle(void) { + enum platform_profile_option next = PLATFORM_PROFILE_LAST; + struct platform_profile_handler *handler; enum platform_profile_option profile; - enum platform_profile_option next; + unsigned long choices; int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - if (!cur_profile) - return -ENODEV; - - err = cur_profile->profile_get(cur_profile, &profile); + err = platform_profile_get_active(&profile); if (err) return err; - next = find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, - profile + 1); + choices = platform_profile_get_choices(); - if (WARN_ON(next == PLATFORM_PROFILE_LAST)) - return -EINVAL; + next = find_next_bit_wrap(&choices, + PLATFORM_PROFILE_LAST, + profile + 1); - err = cur_profile->profile_set(cur_profile, next); - if (err) - return err; + list_for_each_entry(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, next); + if (err) { + pr_err("Failed to set profile for handler %s\n", handler->name); + break; + } + } + if (err) { + list_for_each_entry_continue_reverse(handler, &platform_profile_handler_list, list) { + err = handler->profile_set(handler, PLATFORM_PROFILE_BALANCED); + if (err) + pr_err("Failed to revert profile for handler %s\n", handler->name); + } + } } sysfs_notify(acpi_kobj, NULL, "platform_profile"); + return 0; } EXPORT_SYMBOL_GPL(platform_profile_cycle); From patchwork Thu Oct 31 04:09:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857548 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2080.outbound.protection.outlook.com [40.107.236.80]) (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 33278146A6C; Thu, 31 Oct 2024 04:11:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347892; cv=fail; b=uwKHwpKi8ZtOb9yRBZlZe02ru+fqdsWdPdMiENsKUvyegfTaRg4gs9zzcc1lnbXpxI8WS7VramgOqpopeYxHd5wmAokLWli1jcXgDtBkZCPlIbk9lP7Na4qUOA5LZl04yDiGaUWlyq0nB5imD748e2OGXqwQg6K+l5ouVgHF4M8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347892; c=relaxed/simple; bh=ASgI2mf+wn+56shboFohC1GXeGNgqkK7PrRqtaLk6a8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kO4UT5TdM9By14SW2oyy3ZYqumARW5X05OcrZHCtpXPGAjJPDvuhAFfn77dMQ58cbduQILP+lyTL9fNNMWlC0ldF4nlUEZbmaOXNr0tpPjOEtHy6T030p+ZHaGIrgl/tSyAlr4FsS84UJaRch3w7Mlp7FeNCWds/UANXrtGTNUo= 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=spXwOoiJ; arc=fail smtp.client-ip=40.107.236.80 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="spXwOoiJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nUkwvJUVqtRbuGKookuuab3C5xfW0Ouefnp4/GnDQy0gNMLEEJDBfqcxekhJpVNlygYuulSUu6tErUPFQX2RT2g34Ps4XP5kGyjvaneWg6S5tWnq33NOVq4qN7lR5uEKCodfClgBM6D/eQ265KD86DNBUnn9YFOpguW7Hx1lWMNVEZxj9/yQZ2iKEtkSC1tKZLgjmXVC7HmvN6nzD+XgQmnLW1e/L0orEOFimKF7NWOAYIs9cO0taAqdro8n5HlCbiATy8cZ/pjP5cTvOm/pd1+9tSYIdDkwdSrJYJB3Uds1NDdMrz5SFj2ihtLtczZ3EhbUrz8WkEb+7O0rAnMSrA== 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=hQFE8Inguc1AFWBccMNoWw32J5ynjV70yDTo8C2otig=; b=TDcJuzWWzixnbVcxGkSmIz/BZfJ/hS/2tBLbU4JT4EQFWtuJsklUXBU+ZLd9LSOO0JsMbGRMoaokUusekl/B53siJI3wQUXQ3Rf+NcIdNCpGcAmdWChnfx7ufX4c2rUvmNQtD67zQjXh6sIuQKSE7TWYRzWx0YctE/4DVfWd42e1aKfiKtUDPF3mDQG3U0gTpnjVtHgYqbxrN6TvLR+gmHCtb6tlqx84HwOKl/8eZuCO41Nc1JZBa3EVGhefaCE7wlB4AZUG973iQVOjchCfaYiQf3P6aDtB3xvZMbAFVl03p68wXrukoqvEBbJJ42gUmxT4Y/jB2v9wll7YefeHPQ== 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=hQFE8Inguc1AFWBccMNoWw32J5ynjV70yDTo8C2otig=; b=spXwOoiJ2OHl/khhlODrsK82E+NhhFkce8Fp+qqv9Pl3lix2OFjZmU0gMwmh6XTEQCHQ46z9tpWQD4o5w49YQYWqegnc7yPDZXza+e4+tM1PVbfY+SqxYtcjO3Mn7ZK3afAQPAIVFdhyk3UzlNcAltz9zZRJUv1X3Tp30ipYozQ= Received: from PH0PR07CA0039.namprd07.prod.outlook.com (2603:10b6:510:e::14) by IA0PR12MB9012.namprd12.prod.outlook.com (2603:10b6:208:485::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.18; Thu, 31 Oct 2024 04:11:26 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::b3) by PH0PR07CA0039.outlook.office365.com (2603:10b6:510:e::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Thu, 31 Oct 2024 04:11:26 +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 CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:26 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:21 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 20/22] ACPI: platform_profile: Register class device for platform profile handlers Date: Wed, 30 Oct 2024 23:09:50 -0500 Message-ID: <20241031040952.109057-21-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBE:EE_|IA0PR12MB9012:EE_ X-MS-Office365-Filtering-Correlation-Id: bd320fb9-b846-4778-4169-08dcf96216e4 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: eo+Xlb0PN1ZjhfnJCPPiWgGFJ4GdfzX5oBOPMROEBnONYP7um9vTZ85BHUDch6cSuDJdVnAETjFuRVFDLo7Nh0krErYKzf8RILTM+DmHxaYjOn0d0Z1wXxgXxiAtPG7tdKM2xpmD2/isBrTp+iP9923ZImIG0jvQIooSkLs5AfSfjBLQc4IdnfY/dikKLpdSV191qjPaW5yWbhMSAu/PFOviUMbidZV0DpD1BZ3Fb8gMd+HyPzzxp8fEm0CiAJL4VhMVhZfLPudCkXxXAQUKV9XZGoQQHx0p+iS2T1LT0+8jjqdXy64rDoAIxYS6mOHsi/e/Tqn6JrAXsTmqfeL5AFTQX0fVffkCnEUp34zG/YMjegXQqZ37RjmfD/gt2FH/lXxIbPijwzMtgl9uPs/lsWm7uJrQXiTgSxDWhfFdk4htcnSoRLrKq0jtJtL3BkE7tYgk/95mNdUBmQtH2mUWf1hVS0FyuNnfGrb/n7fSKjiqOQ81pw6j0J72nlS1FUUJA8C0K7DLDUiZYZ8eRDBc0Ks5VHD5EyaLP+HB4W2xJSDqVDfmM2E9UhG7GrAr6OCM5nxPTneefAhe6ZJprIZXzbxIAhOkxepSsKW6/Wd/gX2qqvCAER7WfA3NyUZT9RTyctqgLc5iD1GYEAF6gQcAmZZCUzyn177ikfKfld7rCpNAcf9V5dvKlh5ZKv+jTUNRrUgBFeY2mN3sGmXoUP8AW3j7dkxxY5eBglJPQRmLhptxTfO+nqGzcbZyHmBSR1eWvYRM4J8mI1CH9La35XWXASCuYEUwi59/xWnvKXnox8f+dcUqBNZ90sm+viFyWVcx9pTa4B2GaWY3KigW+DBQRzJyGA/eaJNIZTu+CxBksuRBvBkHgQt4hEVts1e/dctVvpwKGjOAtgwqFecACS/MSZWyRNumVDu7toLMWkzbuslV8VrsJ4KajTJM1iHpZc0xxAd6F9Gsj/UqDZlOMh0L2QON25PUP9lYwKGnZyB9FlAoQx+wsci18ocEehpVljxb2oeKpvuJd/Xzo4yt+D/eF6pP8blmTqJQ4Y97Iwp1K56gGpm9q05k9LICpO0xlvcfU7hUK5eSIlvG7LfkitcXXq4T/AnOqV5U2Hao6gYutc9OyThgqyTOdl9CMFqie6jpeAvRaTnCGd51MhxTCaCQWdDLFa9k4HZkchvosNWJcZFxrtXk4T2ZI9zJTim5ehYxslOl0nx5UsyuY4nxKXITMScQKRPm0jRuMSbMqcpxe/dqW7Kh3aNJzDJFJjsAgGZDVhzeBdnQUPNhSBsNHfWdcqt9YiWlGQIDdUWhjn2+939Whb1LBry1GrtzYJM/gNaqWXdwhtpAmmPHf1qu+K7qamI6PEt9gkLAAdLR/hLSzhmSTNCKSUJEifAf9UgGFacU5faEotejGuAvWzgpcz9NGw== 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: 31 Oct 2024 04:11:26.2655 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bd320fb9-b846-4778-4169-08dcf96216e4 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB9012 The "platform_profile" class device has the exact same semantics as the platform profile files in /sys/firmware/acpi/ but it reflects values only present for a single platform profile handler. The expectation is that legacy userspace can change the profile for all handlers in /sys/firmware/acpi/platform_profile and can change it for individual handlers by /sys/class/platform_profile/*. Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 93 ++++++++++++++++++++++++++++---- include/linux/platform_profile.h | 2 + 2 files changed, 85 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 9b681884ae324..1cc8182930dde 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -24,13 +24,24 @@ static const char * const profile_names[] = { }; static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); +static DEFINE_IDR(platform_profile_minor_idr); + +static const struct class platform_profile_class = { + .name = "platform-profile", +}; + static bool platform_profile_is_registered(void) { lockdep_assert_held(&profile_lock); return !list_empty(&platform_profile_handler_list); } -static unsigned long platform_profile_get_choices(void) +static bool platform_profile_is_class_device(struct device *dev) +{ + return dev && dev->class == &platform_profile_class; +} + +static unsigned long platform_profile_get_choices(struct device *dev) { struct platform_profile_handler *handler; unsigned long aggregate = 0; @@ -40,6 +51,9 @@ static unsigned long platform_profile_get_choices(void) list_for_each_entry(handler, &platform_profile_handler_list, list) { unsigned long individual = 0; + /* if called from a class attribute then only match that one */ + if (platform_profile_is_class_device(dev) && handler->dev != dev->parent) + continue; for_each_set_bit(i, handler->choices, PLATFORM_PROFILE_LAST) individual |= BIT(i); if (!aggregate) @@ -51,7 +65,7 @@ static unsigned long platform_profile_get_choices(void) return aggregate; } -static int platform_profile_get_active(enum platform_profile_option *profile) +static int platform_profile_get_active(struct device *dev, enum platform_profile_option *profile) { struct platform_profile_handler *handler; enum platform_profile_option active = PLATFORM_PROFILE_LAST; @@ -60,6 +74,8 @@ static int platform_profile_get_active(enum platform_profile_option *profile) lockdep_assert_held(&profile_lock); list_for_each_entry(handler, &platform_profile_handler_list, list) { + if (platform_profile_is_class_device(dev) && handler->dev != dev->parent) + continue; err = handler->profile_get(handler, &val); if (err) { pr_err("Failed to get profile for handler %s\n", handler->name); @@ -69,6 +85,10 @@ static int platform_profile_get_active(enum platform_profile_option *profile) if (WARN_ON(val >= PLATFORM_PROFILE_LAST)) return -EINVAL; + /* + * If the profiles are different for class devices then this must + * show "custom" to legacy sysfs interface + */ if (active != val && active != PLATFORM_PROFILE_LAST) { *profile = PLATFORM_PROFILE_CUSTOM; return 0; @@ -90,7 +110,7 @@ static ssize_t platform_profile_choices_show(struct device *dev, int i; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) - choices = platform_profile_get_choices(); + choices = platform_profile_get_choices(dev); for_each_set_bit(i, &choices, PLATFORM_PROFILE_LAST) { if (len == 0) @@ -113,7 +133,7 @@ static ssize_t platform_profile_show(struct device *dev, scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { if (!platform_profile_is_registered()) return -ENODEV; - err = platform_profile_get_active(&profile); + err = platform_profile_get_active(dev, &profile); if (err) return err; } @@ -138,12 +158,22 @@ static ssize_t platform_profile_store(struct device *dev, if (!platform_profile_is_registered()) return -ENODEV; - /* Check that all handlers support this profile choice */ - choices = platform_profile_get_choices(); + /* don't allow setting custom to legacy sysfs interface */ + if (!platform_profile_is_class_device(dev) && + i == PLATFORM_PROFILE_CUSTOM) { + pr_warn("Custom profile not supported for legacy sysfs interface\n"); + return -EINVAL; + } + + /* Check that applicable handlers support this profile choice */ + choices = platform_profile_get_choices(dev); if (!test_bit(i, &choices)) return -EOPNOTSUPP; list_for_each_entry(handler, &platform_profile_handler_list, list) { + if (platform_profile_is_class_device(dev) && + handler->dev != dev->parent) + continue; err = handler->profile_set(handler, i); if (err) { pr_err("Failed to set profile for handler %s\n", handler->name); @@ -152,6 +182,9 @@ static ssize_t platform_profile_store(struct device *dev, } if (err) { list_for_each_entry_continue_reverse(handler, &platform_profile_handler_list, list) { + if (platform_profile_is_class_device(dev) && + handler->dev != dev->parent) + continue; if (handler->profile_set(handler, PLATFORM_PROFILE_BALANCED)) pr_err("Failed to revert profile for handler %s\n", handler->name); @@ -194,11 +227,11 @@ int platform_profile_cycle(void) int err; scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { - err = platform_profile_get_active(&profile); + err = platform_profile_get_active(NULL, &profile); if (err) return err; - choices = platform_profile_get_choices(); + choices = platform_profile_get_choices(NULL); next = find_next_bit_wrap(&choices, PLATFORM_PROFILE_LAST, @@ -228,6 +261,7 @@ EXPORT_SYMBOL_GPL(platform_profile_cycle); int platform_profile_register(struct platform_profile_handler *pprof) { + bool registered; int err; /* Sanity check the profile handler */ @@ -250,14 +284,49 @@ int platform_profile_register(struct platform_profile_handler *pprof) if (cur_profile) return -EEXIST; - err = sysfs_create_group(acpi_kobj, &platform_profile_group); + registered = platform_profile_is_registered(); + if (!registered) { + /* class for individual handlers */ + err = class_register(&platform_profile_class); + if (err) + return err; + /* legacy sysfs files */ + err = sysfs_create_group(acpi_kobj, &platform_profile_group); + if (err) + goto cleanup_class; + + } + + /* create class interface for individual handler */ + pprof->minor = idr_alloc(&platform_profile_minor_idr, pprof, 0, 0, GFP_KERNEL); + pprof->class_dev = device_create(&platform_profile_class, pprof->dev, + MKDEV(0, pprof->minor), NULL, "platform-profile-%s", + pprof->name); + if (IS_ERR(pprof->class_dev)) { + err = PTR_ERR(pprof->class_dev); + goto cleanup_legacy; + } + err = sysfs_create_group(&pprof->class_dev->kobj, &platform_profile_group); if (err) - return err; + goto cleanup_device; + list_add_tail(&pprof->list, &platform_profile_handler_list); sysfs_notify(acpi_kobj, NULL, "platform_profile"); cur_profile = pprof; return 0; + +cleanup_device: + device_destroy(&platform_profile_class, MKDEV(0, pprof->minor)); + +cleanup_legacy: + if (!registered) + sysfs_remove_group(acpi_kobj, &platform_profile_group); +cleanup_class: + if (!registered) + class_unregister(&platform_profile_class); + + return err; } EXPORT_SYMBOL_GPL(platform_profile_register); @@ -270,6 +339,10 @@ int platform_profile_remove(struct platform_profile_handler *pprof) cur_profile = NULL; sysfs_notify(acpi_kobj, NULL, "platform_profile"); + + sysfs_remove_group(&pprof->class_dev->kobj, &platform_profile_group); + device_destroy(&platform_profile_class, MKDEV(0, pprof->minor)); + if (!platform_profile_is_registered()) sysfs_remove_group(acpi_kobj, &platform_profile_group); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index da009c8a402c9..764c4812ef759 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -30,6 +30,8 @@ enum platform_profile_option { struct platform_profile_handler { const char *name; struct device *dev; + struct device *class_dev; + int minor; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; struct list_head list; int (*profile_get)(struct platform_profile_handler *pprof, From patchwork Thu Oct 31 04:09:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857547 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2042.outbound.protection.outlook.com [40.107.220.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 7AE4B146A87; Thu, 31 Oct 2024 04:11:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347892; cv=fail; b=pZ8N74wKwLSPL6CgCZZJxoIfRwCQUoti12xWmwtFZzvPRlpwvLFVvjFRYWlmUdI0qsrn5epox2WzyMHuKoiVJ1oQrp5rZy9npXv9PpQ+KL0U56oPFVW6UY/DX5HlkFVvNfrT2/xedX6eG5gUqeNwmmtV7qqGt6ue1eQHAGLHueA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347892; c=relaxed/simple; bh=2bgiz07RWtlQAlUkySyB1AoW7uwWWD3IthivNQhZaUE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t3JwtrLgzGPxNMA6PRxB87rlAE3zWH4Aodb0Sc6gvJbRwtCrzMXRonRGuP9FxaWd1B0+0ceKxH+RsbE3tsMEKEfUIo9txNVSNM8vJ0Qx5RnRAWnJSXIS7znBjccVNsIfgbZVmsbUJjE2bTwVk011Aei6HlSNyPf3w6lODfaOcJo= 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=EaTJi/JA; arc=fail smtp.client-ip=40.107.220.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="EaTJi/JA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QqKJhwgS4UnQPKgAaLZnxNVuH1U7uxrSmXwvFMmLbDiLtKJY6t3i/eJP+BZc20oO/avu7fPLONKSYyBU4nX1ybk4iKRDbIbHzV5LXfWwPRxQg8/+UOtdPFDBOpUOl+GSj0hW32MWLXGvDUDPDZZVcEa51waa8BtS7tOZtH8BHf4L0sihE8K1e3Ok9DBm48Ad26BqrLDbH49uSvDduHgCnZCiAIBNVLrc7HpreBIfY3SKUtytJMmidM06Z6JBVCqmR2v/S5Q9RXAnK5emAvcrgMZaIHPK/yNO7eaGDW69IbOKcLTZgGlyHKAErAzOVLyEKhucojWmYBxBC+7j6McEDw== 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=HrgXA5/hjgAqL0HSOmHsTShil3KJAlJa4+pswu/z1fk=; b=jYbhwvk1ydQMJql4cXGsuBzo+FKrh99SGC2w4bjxZCAbYV1ZOWRFj+Td8xq+rx2DFcIB7zaQmQrdEV+xnHFgyX2PbqZf8efY58aqq7e1GFJk1LOHLFBg2bPXgY1ObGjrhiv6UFGpWWylvaUcewe0NrJIQ7tFvADyVksu8HOjdVwRv4a6b1nixZaFpDt8L1NbJhflx7S3x5LiFY4f47yxifS5kVwdzgZ+wsSYKQ5WrZQtYE8g5l27RT/mD3PxgO6aMP1zjDa3jfSMg31IW6UtI9+b8Wa+PrMw3ZXVwI7xrWcDPUvy1yawLD3q78dMwoIiB/jd2or4sdLL7e1PvH25+Q== 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=HrgXA5/hjgAqL0HSOmHsTShil3KJAlJa4+pswu/z1fk=; b=EaTJi/JAddHUMkHyrrLTK4Uwz/aShNPTX5WQj1EmxuBRnVk6hgADb92msmGPwYp94UNHXLUTb4lbrxlp/kQuZH8CRk2cHGFInaLSJKuVV1n6ycYv1Cf37NLRX0N5ym+E7Cut5+eGqpsQPXMsko5qCR9QuTGowW+bYjjsFEa2tpk= Received: from PH0PR07CA0043.namprd07.prod.outlook.com (2603:10b6:510:e::18) by DM6PR12MB4202.namprd12.prod.outlook.com (2603:10b6:5:219::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Thu, 31 Oct 2024 04:11:28 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::73) by PH0PR07CA0043.outlook.office365.com (2603:10b6:510:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.33 via Frontend Transport; Thu, 31 Oct 2024 04:11: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 CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:27 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:22 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 21/22] ACPI: platform_profile: Allow multiple handlers Date: Wed, 30 Oct 2024 23:09:51 -0500 Message-ID: <20241031040952.109057-22-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBE:EE_|DM6PR12MB4202:EE_ X-MS-Office365-Filtering-Correlation-Id: 34c7a095-1f87-4885-b0d8-08dcf9621775 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: wzwOsD/Uhi10+N2MtYI3oMNUcYU9Vh5GXoUrE9gRjZ41aTs8EzL0MWw1RCV1PZvSQlBMUFmM+sJivmA9Wfb8kzhWaflJHx5GcpJ7THFq1m4aGfZUDWGbbpc2jRj1IRWU5Gk7NH6loM9abDb3WNm0G4aIu66R0R6LHXE+NYC2aZtAudKaIVx0+mYIwk5jXUnRev8P8yDBeSmVS3hrHl1N+W+mNhGO6bAU1oCUF7wyAnwsMI3lhvQhIAx20NnKSwe/EdAMfBL3HJMtnj5kKPQyNjRphAVzJE9da70+BwqdIH7+SsorPXO/4I/KcFJ3cb08Af0pngIeJz4W7skrd60IgZcwNWtdPWRrCBiA52eoR3hu68xXynYhzJsaCrXlrO+kSECNOimYXoeqCNpGqR505Ql19+CHT3vZy70laSu6rBnwu3xMYNscDBLfbVal8xneVeLKamd0Q2zhr6ImlWVwSkHNj7GV39UcyonON5R9Vt5bLtro44Mt4bWsQWLJu48wksaLn2oC9X3YHWptXkP/5pQN2pphVa133zuTloAnT6Y5hNneVul3RF6rmkmOy8okpTHJmbOxsBwsb5DzqjR893d6T/StLbPd+QnL0F6Ed03hAwdhshf54N/YvWX4fGrcUiZK2ihLHRK2cHm4SUq9SsVxQxdSXnnEmsmVXtwbLZNWozogvi+svI4aGxMXkDIyXSXBNfpWpsk7/1nCkmxiD4F5ZkHettY03howAPfFtlTgDBC8tH9ZhfIovo5/IME/tI4esj4CG6gad1YlFPNY/WLvxCFvCT20qdb4Jq4++bImM/N/b4sTXlGAzbujt9bQPe7xLN6LuMZPZ4Z7f4ioEUtvkWq5APfpVNZS+Vp2D7EKIDW2/RaHk1a13ukuJtw1Lf6SK5vOaNhTNYzKZOmnpQyLBUPvyOdf1dfcI3G9o1JwrzCHPEMSG8ml4ifdqrErk+VBx/xeskAOPHmCP1BaIhyNJDMT7BLHXYGqLco9XGkf/fX/Da1Z49mYKBF+a4acGEZse3VN5vctF8479z5uCR5ujsCo5nK4zxaEATfvyA00Gd4xWwM+XPlw5zLUv0gQxzb1JBARghaO5exY8MZG6GEGvMSaHr/VMD16RRhLRVbpzaSPjbaYKYxoc4mLfTkA341R4GU6cm55Sy9SXWGdyo+Xwi7cdJDgK3OEio2RPUjy0Ro9WEVil3TYPOcWPEFcYV4qiu06gnyhcrtqTtzmB1ZRzb/Kh+bB+ey0Xe/lOvAveW8fL5MWAqkf9udr6RKmQp6iYRpWIJ9hKnCTQPuOsxV6n2ib6TqAoIa4fLR8+JFAnwMmUxgSph03sciRFZTYm8RUoTsq22uEA4eOEzL6E1KuOFC5TDrlqI7vVkERxvaGpbQmRlSGXncONIiMfzDcumGNxuL5ij5e0Ay/b3JkbA== 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)(82310400026)(1800799024)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Oct 2024 04:11:27.3749 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34c7a095-1f87-4885-b0d8-08dcf9621775 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4202 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. To avoid undefined behaviors only offer profiles that are commonly advertised across multiple handlers. If any problems occur when changing profiles for any driver, then revert back to the balanced profile, which is now required. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Mark Pearson --- drivers/acpi/platform_profile.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 1cc8182930dde..a845524a248b9 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -9,7 +9,6 @@ #include #include -static struct platform_profile_handler *cur_profile; static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); @@ -212,7 +211,8 @@ static const struct attribute_group platform_profile_group = { void platform_profile_notify(void) { - if (!cur_profile) + guard(mutex)(&profile_lock); + if (!platform_profile_is_registered()) return; sysfs_notify(acpi_kobj, NULL, "platform_profile"); } @@ -280,9 +280,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) } guard(mutex)(&profile_lock); - /* We can only have one active profile */ - if (cur_profile) - return -EEXIST; registered = platform_profile_is_registered(); if (!registered) { @@ -313,7 +310,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) list_add_tail(&pprof->list, &platform_profile_handler_list); sysfs_notify(acpi_kobj, NULL, "platform_profile"); - cur_profile = pprof; return 0; cleanup_device: @@ -336,8 +332,6 @@ int platform_profile_remove(struct platform_profile_handler *pprof) list_del(&pprof->list); - cur_profile = NULL; - sysfs_notify(acpi_kobj, NULL, "platform_profile"); sysfs_remove_group(&pprof->class_dev->kobj, &platform_profile_group); From patchwork Thu Oct 31 04:09:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13857549 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) (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 7852D18FC7F; Thu, 31 Oct 2024 04:11:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347894; cv=fail; b=UuU++dQK2UzfM1RC3xm5a2e5GNdE3bLN96a/Bo2jqSpITJm0PKMAq15Q9D4p1QL8cRkbfssundCelv/7bb+FHjt1Vt180s6APWbnDAKC3VDbeecMU4WCiMxcllb87uY5hYPXh7+0MxVESGphxCw0jlvAXkYKqDjGqaAtjltqFIY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730347894; c=relaxed/simple; bh=5itRs+0Zj3QFTkypBZE0+Iy97f2zvJHrmQw71ikXEVM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aqm6ckY5GzMiw1IPpSxhTusmUSF1PGvdCz/ocUCYHmYCFXCzPEuIT6NNsEe6L39fP1sTUcqiSqt1le7ICqjRxdxgIefzjKXQJ4GYcOByJ97VTaoGzrr7YRMQvpX9GSTnK1Uz/rqK/pqjuzpkfc+TBkaC8ZMN4uq01d3EYTOEmu0= 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=v/+k21if; arc=fail smtp.client-ip=40.107.94.51 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="v/+k21if" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sX8WZr8dM5/OE8jDKkJTh7f1/SsFA85M6zLAiTJBQosQfMaXFpT9/KC88ORaX+q2tlFrRxNQBrdCI3Pxv22Eikbc8lkG3/H2rI1Olv85nrZZQ/CiXbdSdG5tThLjBsFkerQcqn0xbZ4qnUvVhF3aRq79y65I5adH4qgs9iH62ovSu0Io0LxbOXGLpPomXVMG24T1D8ZNZUzR7fm8bNwtDNLiZOPAlWYayZeNtipbsUZf0FhYXNWvc1La0gRrK6N+p74qj2j0sZMDuFfSr6NAByAJGD5mtMvevTeuO6I8FzXm03HxVq6D9k3JCDF/lFLry1db2+iLwp/XOcLbZ9gEwQ== 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=ZQ6Mds4UNrPu1FSi+YcGzN/5YmiE7gSWMRjCumN+XkY=; b=pXKUx5FJZg8PQYLJcRHk6v49hbtWyerFqbJZQ/DPOjCprc8oU9u81OAhewpw/3LFW0Qx2RbX+yo23GSJUDSLYJktzIINhjwdK1n0ZAppleGYfMHEC5ulusTPYR2J7lr1NnyyAGpJMoTx2wQFTtdk6g14siZ5f64vlqGGMOiaiPQkKJ6pFn4VBp0cxyGGiN5AntvcBQ9rHzsoaz7BH+/qh24yMpFknAIFHHnxwRe+gxfqS9pZinvplDvMjPTYeRn8Bv4nz0sryAxVdxbf6u3kvHRssUXchMt4voNWHFQb9kTyxdPmCPKGnP7twdr6r+vTEnFDTWnVnepdxZqW3ahi2g== 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=ZQ6Mds4UNrPu1FSi+YcGzN/5YmiE7gSWMRjCumN+XkY=; b=v/+k21ifIz/7bglHcqY3nihUX1pI4H2Ow604AZXGmaNAxxlhM+blP8pURZ5TAqHhsxZetPUlaIXFDmusSs0ym0StvDanjsvg+Z7+jSLBuIVerkTSJUJ3U1+nRLFCrGmApyE77CdMZWMczT78wVAmwBQBHuVJf7Cwnbff+wBZQUQ= Received: from PH0PR07CA0036.namprd07.prod.outlook.com (2603:10b6:510:e::11) by SN7PR12MB8025.namprd12.prod.outlook.com (2603:10b6:806:340::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Thu, 31 Oct 2024 04:11:29 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::d3) by PH0PR07CA0036.outlook.office365.com (2603:10b6:510:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.17 via Frontend Transport; Thu, 31 Oct 2024 04:11: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 CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Thu, 31 Oct 2024 04:11:28 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 30 Oct 2024 23:11:24 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v3 22/22] platform/x86/amd: pmf: Drop all quirks Date: Wed, 30 Oct 2024 23:09:52 -0500 Message-ID: <20241031040952.109057-23-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241031040952.109057-1-mario.limonciello@amd.com> References: <20241031040952.109057-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCBE:EE_|SN7PR12MB8025:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dc927cd-9d00-458e-6b9b-08dcf9621853 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: 0h93YJ2duLOsdai70cEdSt3bKVy0U8PysPcc407u8fAsYGi3NmHpTHUhCzRR0I4wtXCeo0UuWn9bJQ5dYhlqmTr+s7fq6EmNVzabcMBwX4XqxXSFHNJghqCKsU/Xs577ivsJD770VjruYMlsWYkQXBe8DZ02ClTU1sjLFiK5o69P9W+JMSEQqbDXQslq8uw7n/Fp9Pm2X4V7Q3tOhWhSFHv772DogsXt5FA5dkReOXYYodVpGIS8ANCpuGnBrwsOvFGvGFSqmgCWscKU7oUqaYtBMism3DfgiuCi6cfQR57iJudzCQsELQypty6hYry7z1PfHc3Q0V6dKt7S4jMhosqUnHW2b5g3bBLAgM+3eFmGxb67FNEa0PNKxu6xCBGZBZhvC7HbBQqrK8Q4VMoZi9P93buT2mx5Y+6WllI9jQPK5xJiPLo3QB29pcDt4nwzH0sKpKWUSd6AzpnqHflzNugNB/wKEKwwE4Lx2kk6oP+N8lwZMsn9Dn5Wq3soFuB7ak/Pl95niQ06w+OeCl8cUEl4MhLmakDmKvBJQzLk4RAk7fcucS7v5hL6P9y0VymAEjpecJzYhLeT4YbYi52ZXOVUeP9P9TioShaisDFLDswoCwFplwxy4KuSB8LyMXhnmQymoivtiIBnYd99jqatwExPwyETTc5QCutjX6y1o66ekmzslmyjgN6WfshsBYwkJqvdmrAGC5AC6Okd97/nvP2FfZSpgFG4N7nyYvzOd3RzkiPS6rs2zY8cNmjg1+6z1hUlG1sj3oGdsOWh81zI7LDajUVziJCLFqDC641QXJh+bINjcQRQaqQPr5RsjFN+CHxPuZ360EOdsJ2BrHFso0W9yntVXbmNaCVaDMQeZGJlBRRoRcVqsOdbURaPXRAVU+5UQY0NL1COTQ4SUyw/RhloWMIuVVEVoh6YK2TxzhzUj46r4BCjkb+tubZ+qIf05FzqaCDfNl+GJ/yHmdxrsMGX7b0J7KuY1f1sHYovnm8A68XM+pKq4xTsdmTUKeB7P0SJIFSWTU+B9PJVMc4Q7YYg8uHnQ9i1kDzHP5aluIGaoFaviTkeCVDy2pArL2V4JT1JhPpo0SSNK7hi58VaJ8Upr0XbFcRSLAESNgXGcUv9Ut17mRWDL1gN8V+y07cpGvrkocyCF6XFKby3pUP+n5/uQ9i8T6Jp8KhK+NSLbfUEwl6fDudngaqgofvPhQWO8KE5gtOOyoUSMAh9mLkwhutGZnLDCGKykR33JwSb8UF9YBPkSUv68XHHlyxf4f0MSNMOwSoPS/pChb12hJO3U2EvphdtQI2Du7ABu2eC1rzDB5ERBJDmrOEyoOPWOu4PUjiPkFWwWRRk0heJpY/CMHXxSzRb1yDMkRnx2bmcOKCR7MIiNawmHXVdkAnZEwMSwOjPvz/iXZzOz/n6l7GnTw== 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: 31 Oct 2024 04:11:28.4530 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7dc927cd-9d00-458e-6b9b-08dcf9621853 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8025 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 Acked-by: Shyam Sundar S K Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/pmf/Makefile | 2 +- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf-quirks.c | 66 ----------------------- drivers/platform/x86/amd/pmf/pmf.h | 3 -- 4 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 drivers/platform/x86/amd/pmf/pmf-quirks.c diff --git a/drivers/platform/x86/amd/pmf/Makefile b/drivers/platform/x86/amd/pmf/Makefile index 7d6079b02589c..6b26e48ce8ad2 100644 --- a/drivers/platform/x86/amd/pmf/Makefile +++ b/drivers/platform/x86/amd/pmf/Makefile @@ -7,4 +7,4 @@ obj-$(CONFIG_AMD_PMF) += amd-pmf.o amd-pmf-objs := core.o acpi.o sps.o \ auto-mode.o cnqf.o \ - tee-if.o spc.o pmf-quirks.o + tee-if.o spc.o diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index d6af0ca036f17..ffec0a64a82e9 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -455,7 +455,6 @@ static int amd_pmf_probe(struct platform_device *pdev) mutex_init(&dev->lock); mutex_init(&dev->update_mutex); - amd_pmf_quirks_init(dev); apmf_acpi_init(dev); platform_set_drvdata(pdev, dev); amd_pmf_dbgfs_register(dev); diff --git a/drivers/platform/x86/amd/pmf/pmf-quirks.c b/drivers/platform/x86/amd/pmf/pmf-quirks.c deleted file mode 100644 index 7cde5733b9cac..0000000000000 --- a/drivers/platform/x86/amd/pmf/pmf-quirks.c +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * AMD Platform Management Framework Driver Quirks - * - * Copyright (c) 2024, Advanced Micro Devices, Inc. - * All Rights Reserved. - * - * Author: Mario Limonciello - */ - -#include - -#include "pmf.h" - -struct quirk_entry { - u32 supported_func; -}; - -static struct quirk_entry quirk_no_sps_bug = { - .supported_func = 0x4003, -}; - -static const struct dmi_system_id fwbug_list[] = { - { - .ident = "ROG Zephyrus G14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GA403U"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ROG Ally X", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ASUS TUF Gaming A14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FA401W"), - }, - .driver_data = &quirk_no_sps_bug, - }, - {} -}; - -void amd_pmf_quirks_init(struct amd_pmf_dev *dev) -{ - const struct dmi_system_id *dmi_id; - struct quirk_entry *quirks; - - dmi_id = dmi_first_match(fwbug_list); - if (!dmi_id) - return; - - quirks = dmi_id->driver_data; - if (quirks->supported_func) { - dev->supported_func = quirks->supported_func; - pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n", - dmi_id->ident); - } -} diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 8ce8816da9c16..b89aa38434faa 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -795,7 +795,4 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); -/* Quirk infrastructure */ -void amd_pmf_quirks_init(struct amd_pmf_dev *dev); - #endif /* PMF_H */