From patchwork Mon Oct 28 02:01:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852792 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2069.outbound.protection.outlook.com [40.107.243.69]) (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 D9DB8174EF0; Mon, 28 Oct 2024 02:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080930; cv=fail; b=qOmCOh6fby/gUZRSwO+qmYdRDVl4FZyZoHl48F0XFJexufP55IBA6YAolzGAdp2b8Jc9V5fZ+yIRmbNw5/fVdbEhRuxXm5L3XXfff46dw7Tk+1wydt17MbTlVf1zKxNqqg72w1Bx5EMWLf2SurL2aUtGBfCJwIy/6vcfw8Zpp2o= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080930; c=relaxed/simple; bh=UKH3Cd3FdQ6hIy3Zj8VNJUSXixyrxzUlvgD4ttF988I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rfhopl8xf2yBG0f+mesnMMVBWAZefKr3l4kI7EZUX+cSLFmJUTuWP+Ak5NsQaiLsGy0XCp7J54jM51R3C0XxCzw+hXZsBc2Rg2DOm/sEmA9YCnU7y7pBuae+ajZkQM2XeiTjiqgHka9J5qJiTUbKJxinQCztMRkSk05YAfR4PKU= 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=PlGaKrnh; arc=fail smtp.client-ip=40.107.243.69 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="PlGaKrnh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=arj6b7CTnxuqfByEKBExUrPp1S2r14wWgh3Bf5ugRYZJrFVuoZEkMWQ56Qjd65YfYPlxRZlBeCN7HeGloR6DRFhVRB794qBTNfpHPDVHy1UVIowsViRUbEzXFLNriKCsOGNtJDsXIlwODvboQlfVBdvg0q6lKt4lrTDBaGWWjv2uQHRMzA/sRTdHXAxhVZStKHfEj/N3v6SbpS1JOm91MiTvoHXfVpiRO2Wq6//QGLl2/Ye0A20QmGkcdi0MpygZ163KAtKSOjrlToNP67fkdeYZ6JTX3ZrXtY0U+eQVwucHoqoM+4dSdu4qX+TOwvITpScfBIigbrJMAj1xwJ5OzA== 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=b5TXgnY2L7xAtUurtNfnvETk/PhaZ23e7WGCm1sQZ6Q=; b=pSvVYqNxEtz7puzUrr+BCAbq6RoTq7RVTYwrXK4fFXygvZjNBbRcBH2YcU0MV8mChffR6LSwynGXScry28I9+Csh1PfE+yaU3VODE0JtariQ77jW6nJvH/mG3WKbCM1JnMuT0dAAqL3OPX1wbzWkEen4lEKg7Q/cFSJFV7dI69vVlsnOsCzRYUPW5QhPQjaQly1CEYHpBZ3iqrUKKKxVqovXS4JZKs1NRM0DXssXTYS4DxEZz6QN/yz742/OebuUgKBZfe3sPD4UEi7IOecB4Bu680l+oN/k7bH7Nq0T0Rj5SZYviYAeol64gdMUfaatqotzvpj0JycZVtL6c0IKxw== 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=b5TXgnY2L7xAtUurtNfnvETk/PhaZ23e7WGCm1sQZ6Q=; b=PlGaKrnhOyrwZHlnY2yrSm9s74AFo4qGq5EMM1LcWbNy1uLpUigcaD2A9D5qjdp0xN//ZpL3BnrofsdhSHp8hNB2o11qd8BibbughLPXppa3b9pZHkUYemRl1RjhSpJNCfjeODn3dSgo6cmOO+RSPEPvhH0XzSfdVXu7xX5N/Ug= Received: from IA1P220CA0010.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:461::7) by DM4PR12MB7671.namprd12.prod.outlook.com (2603:10b6:8:104::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Mon, 28 Oct 2024 02:01:57 +0000 Received: from BL02EPF00021F68.namprd02.prod.outlook.com (2603:10b6:208:461:cafe::29) by IA1P220CA0010.outlook.office365.com (2603:10b6:208:461::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:01:57 +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 BL02EPF00021F68.mail.protection.outlook.com (10.167.249.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 02:01:57 +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; Sun, 27 Oct 2024 21:01:54 -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 v2 01/15] ACPI: platform-profile: Add a name member to handlers Date: Sun, 27 Oct 2024 21:01:17 -0500 Message-ID: <20241028020131.8031-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F68:EE_|DM4PR12MB7671:EE_ X-MS-Office365-Filtering-Correlation-Id: 91be84c9-bbe3-4ae6-f3c6-08dcf6f480f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: HHojgvmMPnzEbIm+mvSouv+IPQVSL3x/SHtb0S4hOYXWcK4qBCuzLkZIvSoYYjl4DTeMg61pvENDaMt9MbIj590EAZZuQR7RtWHY2dfV/9R+9n+uFHaToCmsx0AzHUxs1fZ3n5eijdJ6+1pWi6cT9CRyJfoI5TJBJicRFqiJHOYzez0to0agjway38hEHj/4bW2SjsxQzYFWJfgGY0rYcxPOb8qjjtqKXrJH1RJmf4fyeDQF9ihdmBiF7SOmxSkZIpl4c5WzLd4GyLLriEjHbrE9m/eiSlon1xkNJwtYuYfJR0K4BBfHXdbzykKJttFMRjoAIvFvFeF649wDI8S3ROAM0f/eNZgRLJJj2+cwQljctlTu1fm/RBOuNdSKnTVV57tnl5wnnTrbHbWaywweySI6hDGjvtOgFt4UawGvlF9OANGCMxnZ+3+pHk4imEbn3VbzzhCD58Ldazf/qu4PArtT8HV5vIP+XsRAG3gqJXB9mrwnSgGQvKEezySFupUz//kkvuJqUiws0lCqZYbuABYcOD+cdqNJxTDdBeG4gq0JJgPcDhsjbUCUf9PzqBLqtux+qFhcpVdRbf5fnL5Gm11Y+hAdeAohvlGTQFLah4vtq+KBuQubNjq4kBvlJ+9hgLC0fThzLBHWGzangiZM0I8WPquBJcxjWbXbNgYnOfypomgcn0KLk4BZ+7e4fJbtgQAGz2MDsmP1iQjRNT8u2+nmlo62ryDMoDYEEzRbnoD8gg/pj/UiFHh6BfdxH18LtyFtSel7HJG1FX+/sH62AMHb85RwxeF8fCzHxYoMm4KzFiuoXNK67dHl3jSpk2ne9ys/JFdGFPNaqqKQYkvtVY96KxscCTcVZN0wMJCnD62YW1Q6jjHEXA348nlZOptqJJon52bujzyKfL8eyOUAVM4IqqOfoNd4jydfYKe4NP+1dt9sFRbjyI/dCWUg+aPbwtGXDJupLnN9y05wDEQJuAp79kP5Xo5H9Qow+aP56rbT/zT2Hrq9JnzUHnMybrIa0jFnrn5us+P8ZseM+H/melOSJ8BmR59r/5X35vJqhY6Pp6NPz0E4IfktdsG8Pz9aIpebsloF/j5Dey/0Aplk1fDbWj7uiVAIE7WRqo+sUyIulw2w69Mqj6CyeobvRz6PIjHUi3emtv+n4FdJF0GXbIyKH8jugO56ln7Yn6hPo9Cj7dS1+hNOY+hnnpUAwFSVFFanhontPjPfMw5+awXkLqrGUCqZ6SqOI2vP3xw8YvN8uiX+UuuK7n5HCwxPM45VQByTYYMZRxQ91VKLzedc+sD3bCZbaBEVZ/84EcT3J73YMpUOqu2KAC8WYvVajko1a0OKBuVJd4Q8/HRxAniCpiaEi4N2VjvuIOWjqPEFCRyowOmC8JbUXUHR1xyjrfUei/bErJ6vzfBdxejBHH/EnQ== 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)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:01:57.5067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91be84c9-bbe3-4ae6-f3c6-08dcf6f480f3 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: BL02EPF00021F68.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7671 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 Signed-off-by: Mario Limonciello Reviewed-by: Maximilian Luz --- drivers/platform/surface/surface_platform_profile.c | 1 + drivers/platform/x86/acer-wmi.c | 1 + drivers/platform/x86/amd/pmf/sps.c | 1 + drivers/platform/x86/asus-wmi.c | 1 + drivers/platform/x86/dell/dell-pc.c | 1 + drivers/platform/x86/hp/hp-wmi.c | 1 + drivers/platform/x86/ideapad-laptop.c | 1 + drivers/platform/x86/inspur_platform_profile.c | 1 + drivers/platform/x86/thinkpad_acpi.c | 1 + include/linux/platform_profile.h | 1 + 10 files changed, 10 insertions(+) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 3de864bc66108..61aa488a80eb5 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -211,6 +211,7 @@ static int surface_platform_profile_probe(struct ssam_device *sdev) tpd->sdev = sdev; + tpd->handler.name = "Surface Platform Profile"; tpd->handler.profile_get = ssam_platform_profile_get; tpd->handler.profile_set = ssam_platform_profile_set; diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index d09baa3d3d902..53fbc9b4d3df7 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1878,6 +1878,7 @@ static int acer_platform_profile_setup(void) if (quirks->predator_v4) { int err; + platform_profile_handler.name = "acer-wmi"; platform_profile_handler.profile_get = acer_predator_v4_platform_profile_get; platform_profile_handler.profile_set = diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 92f7fb22277dc..e2d0cc92c4396 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -405,6 +405,7 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) amd_pmf_set_sps_power_limits(dev); } + dev->pprof.name = "amd-pmf"; dev->pprof.profile_get = amd_pmf_profile_get; dev->pprof.profile_set = amd_pmf_profile_set; diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 2ccc23b259d3e..c7c104c65a85a 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -3910,6 +3910,7 @@ static int platform_profile_setup(struct asus_wmi *asus) dev_info(dev, "Using throttle_thermal_policy for platform_profile support\n"); + asus->platform_profile_handler.name = "asus-wmi"; asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 972385ca1990b..3cf79e55e3129 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -247,6 +247,7 @@ static int thermal_init(void) thermal_handler = kzalloc(sizeof(*thermal_handler), GFP_KERNEL); if (!thermal_handler) return -ENOMEM; + thermal_handler->name = "dell-pc"; thermal_handler->profile_get = thermal_platform_profile_get; thermal_handler->profile_set = thermal_platform_profile_set; diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 81ccc96ffe40a..26cac73caf2b9 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1624,6 +1624,7 @@ static int thermal_profile_setup(void) set_bit(PLATFORM_PROFILE_COOL, platform_profile_handler.choices); } + platform_profile_handler.name = "hp-wmi"; set_bit(PLATFORM_PROFILE_BALANCED, platform_profile_handler.choices); set_bit(PLATFORM_PROFILE_PERFORMANCE, platform_profile_handler.choices); diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 9d8c3f064050e..1f94c14c3b832 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1102,6 +1102,7 @@ static int ideapad_dytc_profile_init(struct ideapad_private *priv) mutex_init(&priv->dytc->mutex); + priv->dytc->pprof.name = "ideapad-laptop"; priv->dytc->priv = priv; priv->dytc->pprof.profile_get = dytc_profile_get; priv->dytc->pprof.profile_set = dytc_profile_set; diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 8440defa67886..03da2c8cf6789 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -177,6 +177,7 @@ static int inspur_wmi_probe(struct wmi_device *wdev, const void *context) priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); + priv->handler.name = "inspur-wmi"; priv->handler.profile_get = inspur_platform_profile_get; priv->handler.profile_set = inspur_platform_profile_set; diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 4c1b0553f8720..c8c316b8507a5 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10549,6 +10549,7 @@ static void dytc_profile_refresh(void) } static struct platform_profile_handler dytc_profile = { + .name = "thinkpad-acpi", .profile_get = dytc_profile_get, .profile_set = dytc_profile_set, }; diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index f5492ed413f36..6fa988e417428 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -27,6 +27,7 @@ enum platform_profile_option { }; struct platform_profile_handler { + const char *name; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); From patchwork Mon Oct 28 02:01:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852791 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) (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 8454215C15E; Mon, 28 Oct 2024 02:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.68 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080925; cv=fail; b=bNUU/e4fATpjeb0Yp+F/OwShmlVnA6Pgava1D+gNbMV8g9Isvl+IBezQ2tIgTsHarr0YUy1Fnc74tKomUlRDts9A5b01Ttd5pOIsO/rpZDuwgX6H9cDo0t5pErnslNmQNtdTlT30KLRNAMTVECOwmffRjj/dECWrnHzBdGpq1L8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080925; c=relaxed/simple; bh=de3AWWNWRwnOjI5JEhl2BogaBfwkYA0AMi6Mqnsngm4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=P4ct9xYJBxeWml/aPhwQOqD0dvoHjFxLVO+rEBkpF2imLXv/wOyj6Rfl2rtVMncRelqWNaZcVeno++kyFcaybDlJXpAb0eDtkFSPjR6j+VvifE/pUiPWBYafQOz0au6R7pIItZYq8iBE59hSxvMS07Du+WNHqDrN4zaA9I3UNw8= 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=HNmP2vXz; arc=fail smtp.client-ip=40.107.237.68 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="HNmP2vXz" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dBaeVcakPJDFqfggl7xNdKyNHoYNz16+Xv3RrqRtv2gCjoR4tWMU7SbWfn4BaTBBmgjwGKFBeQrz5MHqMy1qYQJ6bpDixJ+m4UADDL44kgcSS5CcG/63byVyZy64PNV26QtoGl1bYHWk3Zh55xnXUV29oXb9udKqvKEwa08DwH2EkZ5L2Uu/J5s1YauSnydaGciCoG9adOhhU9NDaVJc6ShwTecf//SDCws4484ChMizwLSJHrjpEz79DmqQ88BquwX7JBLlo+vHoYoWCO87hd661mI3r5eZUlj6D5F8f4m3WCdR4OZ2hEOrJg7Z0M3PwnTaYCN9Fqok46RnsXDwzA== 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=FYjUGZfEpH17UmDTCllqNcF3L/ekuBp4y7Uh9aUsliU=; b=a58qUMKnUEZCMeM2jZ1NRJZsiTWBWhaKuDog1N6IiD/xXVv/kzv3iJ/XRuPYvtfhkgejDQPa0IxR8KMLI0tlvYEyzSrZY7omansuIXwansTcjd5t89PTM7exDC1uk4MC15LIu9XM6AxWXo3f3OoDKqKhtN835cotwnXazs8kAKvOctqas+qfGniI1Fanf8r9ZzgUt0mxjHRHyNPcUfiVWh0MFBZjk3cJGdnic9b2bZIeNCJRIUcnkq9ylaGqwBVnU3EKd9PjDu1wfaSnoaRmCjyAM8QkwuJghhShCj2SshYk9FFeE6IF3rhyTsedc62lKTb7LPX1ZlOg0LVvaBNF9A== 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=FYjUGZfEpH17UmDTCllqNcF3L/ekuBp4y7Uh9aUsliU=; b=HNmP2vXzqB7F0WTG8+Eej6ZlcDdjoIecOYHDrOrHQ0GVAM+hkqV+efbTmdXp9XELXa5d55Ohwsd2rhscRPmZRxnu7ux33k77YV2+uhJjhst8VCoerR3rQ+9nKgWTONQBaFmHkrjKNvxDg6XdaOJM0wtBidkkAkWQ9XM48QtZ+Zo= Received: from BN8PR12CA0021.namprd12.prod.outlook.com (2603:10b6:408:60::34) by DS0PR12MB8443.namprd12.prod.outlook.com (2603:10b6:8:126::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:00 +0000 Received: from BL02EPF00021F6E.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::6) by BN8PR12CA0021.outlook.office365.com (2603:10b6:408:60::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:01:59 +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 BL02EPF00021F6E.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:01:59 +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; Sun, 27 Oct 2024 21:01:57 -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 v2 02/15] platform/surface: aggregator: Add platform handler pointer to device Date: Sun, 27 Oct 2024 21:01:18 -0500 Message-ID: <20241028020131.8031-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6E:EE_|DS0PR12MB8443:EE_ X-MS-Office365-Filtering-Correlation-Id: a7d75613-7e9c-46ad-cf26-08dcf6f48240 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: fob/NRHPivyvCHkYMcDYto/nhmQGbAwhpr1bFA54bT8A15CmHPnMuNbv4XORZMYAe/zoJ1tG2K9XQjJEkfhwpSE8wrnexnHZdrtsrLoPSkOTLauMIV1wDqSCMVhLJ2erW+vvJX4QSnNT+955q/r4joJsRi+5mYVMD7ywuKTXZ5zJfcS7QCAJ9LRqCjjFktJ0khVzenejRwX75lf6czaRqkj7NoUkl+Q3RHLiBiP57qSAadtUpjTWXKy3YUvZP3dNzpqRCt1s1fAC+zQ7XCytdJ/CEN9b4vAHqgozyU3FGkjE03F7dsWs7WZ0pTprTYK0rM2vN+mpV24nJxVmW0jgF4oRD826zpBWIwUvKzmn5XPRQOeSnC7gGXOadl25J9Vh2qoYyJmYbO1ms5vD6vhxBnKm91U5FwqXH16n6YTPOIZK2BMab5XpHh5I6Z/E+I+L55Z20ty+Q9GTs9cIxRuepniSNq/EsquR2ZRgiKAvckGr8SrbF4lLCjJq3SNqdGl4R0JQxkfgRbYn//Z5a7jDNdvqhVqxS40HGqd+2nfu+f4z1kY2F3K3KLdpb1Ppwm6PNeffTeACim4IZM/zjKU/6tXyy3Gs+eWadkAtgKirobAVDM5xdsGs2ZJb01sZ/RuwoCYLoeLiewMDin0q6HQdlkynhnoqqvH+vSXbvPRPT+coK3k29aYDTetWbjVsi56M0ngoQs7xInR/a1Lsccn0D9NKrMB2245GErXmVlLwPawadhTe3nTptOwX80/VczKRhND8jnW4jF20WbZ2OmJRS2P0fC4dk77CQZuNkk3qOJuN9TEK5T1k++OVkMp8KMfP80wy/RYHTFBEe64vLrzNqXy/gYnMlVagjmNK8P4qwTEiKCSFOqz12TkMQrArwS6mBfNJNJonT59K9M+pQPzsqU3k2l4B+EV5fgTjSlVwPQoIDailKODqREGzbXbzM7e47bLwAV0bYbyCrywDfKy8V3pWAFPBjZKRDoZdRgTdwHpAb8FWP89iVkBCFvGhCzicLurfmfAh3Oi+eoZ+g4f0yj2WUhwYseLrN50kxlL+qCVwoXs+h5DZkmbHPvQ9tG6qDXh+4SR5sYWJqBcG6EccLc3/Lnz9LQFA7fXo81lMce2RuxSCY+Xob/N8Sa92F08y34vk9EDtnC0xbf2t4oTtxeu0gbiP9tf8MnQx3NyoETRnp+YcW1o0lfrBhX/MGwLN1k6a+xDGMZJb9frpaL9SGCXmGGmRiqxrjO6qtL/0r9z6fAKYXu2IMwMVBEIAcr8lrIZz1M99cNw6FW8F5htgryqzuZ5+T4SuhYp2wEOgEE5nV6Kcn5w/cvP1qUwEij6Nt36Re6KldXR9gjt9NNznFvvRw5IA7C6m1IYKKx97EbC2/xpW4bt8yaAqptePa2cXa52Nyn1k9d0PlvZoYouxOA== 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)(1800799024)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:01:59.6881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7d75613-7e9c-46ad-cf26-08dcf6f48240 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: BL02EPF00021F6E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8443 To be able to reference the platform handler in remove, add a pointer to `struct ssam_device`. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Reviewed-by: Maximilian Luz --- v2: * Use ssam_device_set_drvdata() --- drivers/platform/surface/surface_platform_profile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index 61aa488a80eb5..a18eb93eebb92 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.profile_get = ssam_platform_profile_get; From patchwork Mon Oct 28 02:01:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852793 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2058.outbound.protection.outlook.com [40.107.236.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36D2D155312; Mon, 28 Oct 2024 02:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080932; cv=fail; b=FhTqYql5i7I0Z7mPVYrYIKHF7E/5uMESU8v6tijdIm7BGpSjh/J8wjY8DGWfcU0TYX4KwwpB/4OoFUQEzc/+qFrROhFP4E1NQBlrl5uNxLngO8U6k/igIOxNe6u1jejMNGysOcbSKY1SPUZG3sYDwGRkC2IS9xD41JIAMa8CG/Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080932; c=relaxed/simple; bh=OoN3eZlkyfm6Mz9FzMTcdXwyJfv+MypM39VX7yFnSao=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u+LTS1wQlFcvVoxc5feQN5kGq7YWHu0wyUHQWa+5IplzCOdIdQ+GK/4VRfeKGWr0XO69Z2uvPX7ViM6DmnF2wWXlTC650G+uIE1wgUsyEnSiWr8Gv7CGlklz0mYWNYn02flKjbuDHMOSqv8n3kFGVZ9buHnlAGxh+mN9cjFCxFo= 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=2oHv2Arn; arc=fail smtp.client-ip=40.107.236.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="2oHv2Arn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Bg3vjtEGPATcOjtCeFYNpyLSZaBD90TZSOHB8vIUlacX6oPgxk8/boNBnie9188SBlKAdM4UKaB2JyiI1qfuygu1yMGd+beyoQlm56uPlpe9dsw6SngzILAsvfrfnxLmPS5nDt22jJEsS27kazbwUWSlISpxuy5OltqHMDInFRxmPk+SyzNocGX0svcHXNCG8NQPPP2uErDiqD7zW/nIjLMZFKj+VtDY20u1YUn0l2K+rBIyob59mh82CWYmAYIN4E9tOkhgOsD+YLMmyFTytwuZlhNdpuytXRe9SppmZw9OXYXVByLZbPAta/PryarJ2i4LgSMkpv4IyyI25Zi7dg== 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=FYlgHKWAOl+hz7FzS0RcOZOUWbEVRZznOwckRkpt9+k=; b=MAIuji8XJPQNHYMAwDCPB3TxyBzOnCh/H+pq1AcaAQkHaYkoOogeM5DRYF3Baiz7AZSxySwc5O6UBZRDCxrhEPqEYWRnscsr3Ns8RUjofKs8tCFaqNtfOWRmAP67KTFMYnp6lNFo6BXn2ax6sS+LWdlN/FdPidWhPVBbrePgItRMQ8NlYU3Wp97NJGX1S56KChwQOTdMqrU0SW9IVD5vy0iEGd3sGof5ai3WRDnw1HXzn3/mnwD5LrLDaDdvsdsrtuhxRMNoFEuOp3fyOiMwGwDj1Ho7seZw+Fi7uQHnYgr5qz072rxL/7ctbSnqFE3H7OEuEUNODEd+RAEtbw2paQ== 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=FYlgHKWAOl+hz7FzS0RcOZOUWbEVRZznOwckRkpt9+k=; b=2oHv2Arnn1DOOBy9db90A2bKYKDeWeoCVrSiMcV5r5S5CyYovc40Rmo0T9yN7UOxzgIJVR96zdOWholdrIatCZzhr0fuKQm86lbAAzD6gWLMVJ5FXAu2w0n+arkAx0zMEEXRypczSpMpnekhJkfTyi0ZOgacbisthd/Tz9y5M6E= Received: from BN8PR12CA0001.namprd12.prod.outlook.com (2603:10b6:408:60::14) by MW4PR12MB7120.namprd12.prod.outlook.com (2603:10b6:303:222::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:02:02 +0000 Received: from BL02EPF00021F6E.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::b) by BN8PR12CA0001.outlook.office365.com (2603:10b6:408:60::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.26 via Frontend Transport; Mon, 28 Oct 2024 02:02:02 +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 BL02EPF00021F6E.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:02 +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; Sun, 27 Oct 2024 21:01:59 -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 v2 03/15] ACPI: platform_profile: Add platform handler argument to platform_profile_remove() Date: Sun, 27 Oct 2024 21:01:19 -0500 Message-ID: <20241028020131.8031-4-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6E:EE_|MW4PR12MB7120:EE_ X-MS-Office365-Filtering-Correlation-Id: e1104ca1-c746-4da8-9374-08dcf6f4840a 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: TVUDrWURJigaqhCpwizrjpWU4K8r2L/rtlrMOu7QUQ7mgKkMH9D52VrDNvRxc4crGC6m+wYFllVwtsgODFRWIG8u4Jv2qDpqsa85NZ7VvbbetKtQ1gkwmjz1V5wyNn4ArGdRQIGJeIg5gZT85SkEwQtwdO0RD8ue1iD/9mYyDpCAr4ZmxLRQ89nUqT5OlX+Py/ETmiXM+K5QgoKvUFC50j5O1j3Tu3BIb9nc620oWsdfSEqBNm9cbwtGAGAJ8LCjpBuBxG27mNkKwQef4ty9SwGeIChrqKKWK4zxXlCehSy3wEorHLm0DdYgajd7rJvp+/6jccpImz/h+6aCgdBN/zaoszNz4May9kHGjr520T11SyjPe/3iwJTp0hjWs69rkAsoqkOQodvlA90g0XiGiwzdZGyYV29Mi7Xekh8TNNRGbNhQ44gnq5ex8HYHJXmB03Z9za2k3jd//pxvlZYrIbKgaVlT9WJiLl+8/DzehpWu4yPTQqcgoBzY114UbB1yrzZeDNihqELlnhihWvF08YIQJ76o3upfTSFSm22csk2gLpwxoD4et+7db4gkzq9251DH8zWO7NZMFtQ+0P7G/2/epWOdZt1TEloZZRJNsTFbvL/WdhoUH13iiUIaMCH0nnBLj1iYolbh2E0/ij6FQZLXO+45WBzgql4wR4ZY1aHAmPQDETDZdfPqUI6szXueRfmMlIj8R3JYVaXi0s+d6PTIdjXSMhD/LzKNNc40eloJ7KIB8XzcpzI0JPty/ZNAX3c8Fynv6AXFGLbSr0ri9P8VIyEL8mp9Yo+jcvZijea7GOGh3xCOh45elGyWMbFRFCIr5lhhUDKES5/SyOOzLr0vuOTPNvdU+H1hnlCVvl0gLFZCFwE0+kBTp8NUAWbL0Re7D5FFoLOcjseS7M7JZGBX1v1XUNO4SwbUJK+TZb6Xi4pLMs8CF6Dg7tfJYqGW8Iq/dW2ehGT6NtCEMNbPorzwbB4lvjBlx0S63BYR79ta+6CvvMffh7JsrOvIAoLDPXZUIt1741hCKElccc5WfIMRGGMDO1PwNKfKUojVfQFksq/0mc/3CLLBHkICBy1eDwI66Sb0L/iB2vVypOI10l9ypUpdClqRe4A1Lx72qD6eumZAg09Ld+nXs4ywP9nsD5+7XBCfEcRBjGtkvsYW5CApSTlH3z/TEp9CZv9+gl+bZcPaRt6BmAvysDoi7NRITBW4iIsg8ndSeiaLfJpFXULDWFeq4jyrwseoBdeqZcJWqgX9bDDP67U9pLIE8WCAFXnAy4hh5nrL/sekKSh5/mtWg26Un94xkMj0qGmVmddO4QCfjKCnyTFhBCvYutXVhGBya0r1dWj4cTb3/+L6W8W/a4AoyUCPhxvc8T9uLd86RfSbRjiKKGx699LZ8XO9IfNOvgoO1VsAur8dS5icRQ== 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: 28 Oct 2024 02:02:02.6881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1104ca1-c746-4da8-9374-08dcf6f4840a 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: BL02EPF00021F6E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7120 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 Signed-off-by: Mario Limonciello Reviewed-by: Maximilian Luz --- v2: * Use ssam_device_get_drvdata() for surface --- drivers/acpi/platform_profile.c | 2 +- drivers/platform/surface/surface_platform_profile.c | 5 ++++- 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, 19 insertions(+), 13 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index d2f7fd7743a13..c24744da20916 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -205,7 +205,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) } EXPORT_SYMBOL_GPL(platform_profile_register); -int platform_profile_remove(void) +int platform_profile_remove(struct platform_profile_handler *pprof) { sysfs_remove_group(acpi_kobj, &platform_profile_group); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index a18eb93eebb92..1c9e37b1f4761 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -228,7 +228,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 53fbc9b4d3df7..71761d4220c26 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -2546,7 +2546,7 @@ static int acer_platform_probe(struct platform_device *device) error_hwmon: if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); error_platform_profile: acer_rfkill_exit(); error_rfkill: @@ -2569,7 +2569,7 @@ static void acer_platform_remove(struct platform_device *device) acer_rfkill_exit(); if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } #ifdef CONFIG_PM_SLEEP diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index e2d0cc92c4396..cfa88c0c9e594 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -425,5 +425,5 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) void amd_pmf_deinit_sps(struct amd_pmf_dev *dev) { - platform_profile_remove(); + platform_profile_remove(&dev->pprof); } diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c7c104c65a85a..f5f8cda7fd19c 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -4885,7 +4885,7 @@ static int asus_wmi_add(struct platform_device *pdev) fail_custom_fan_curve: fail_platform_profile_setup: if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); fail_fan_boost_mode: fail_platform: kfree(asus); @@ -4912,7 +4912,7 @@ static void asus_wmi_remove(struct platform_device *device) asus_wmi_battery_exit(asus); if (asus->platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&asus->platform_profile_handler); kfree(asus); } diff --git a/drivers/platform/x86/dell/dell-pc.c b/drivers/platform/x86/dell/dell-pc.c index 3cf79e55e3129..4196154cc37d9 100644 --- a/drivers/platform/x86/dell/dell-pc.c +++ b/drivers/platform/x86/dell/dell-pc.c @@ -273,7 +273,7 @@ static int thermal_init(void) static void thermal_cleanup(void) { if (thermal_handler) { - platform_profile_remove(); + platform_profile_remove(thermal_handler); kfree(thermal_handler); } } diff --git a/drivers/platform/x86/hp/hp-wmi.c b/drivers/platform/x86/hp/hp-wmi.c index 26cac73caf2b9..bb8771d8b5cd8 100644 --- a/drivers/platform/x86/hp/hp-wmi.c +++ b/drivers/platform/x86/hp/hp-wmi.c @@ -1692,7 +1692,7 @@ static void __exit hp_wmi_bios_remove(struct platform_device *device) } if (platform_profile_support) - platform_profile_remove(); + platform_profile_remove(&platform_profile_handler); } static int hp_wmi_resume_handler(struct device *device) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 1f94c14c3b832..50819ac919e87 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1135,7 +1135,7 @@ static void ideapad_dytc_profile_exit(struct ideapad_private *priv) if (!priv->dytc) return; - platform_profile_remove(); + platform_profile_remove(&priv->dytc->pprof); mutex_destroy(&priv->dytc->mutex); kfree(priv->dytc); diff --git a/drivers/platform/x86/inspur_platform_profile.c b/drivers/platform/x86/inspur_platform_profile.c index 03da2c8cf6789..d8fd59b826f3a 100644 --- a/drivers/platform/x86/inspur_platform_profile.c +++ b/drivers/platform/x86/inspur_platform_profile.c @@ -190,7 +190,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 c8c316b8507a5..619a4db74e5f3 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -10637,7 +10637,7 @@ static int tpacpi_dytc_profile_init(struct ibm_init_struct *iibm) static void dytc_profile_exit(void) { - platform_profile_remove(); + platform_profile_remove(&dytc_profile); } static struct ibm_struct dytc_profile_driver_data = { diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 6fa988e417428..58279b76d740e 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -36,7 +36,7 @@ struct platform_profile_handler { }; int platform_profile_register(struct platform_profile_handler *pprof); -int platform_profile_remove(void); +int platform_profile_remove(struct platform_profile_handler *pprof); int platform_profile_cycle(void); void platform_profile_notify(void); From patchwork Mon Oct 28 02:01:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852794 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) (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 2D631187862; Mon, 28 Oct 2024 02:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080933; cv=fail; b=TCvZKbagjdTA9HqhsIW3M3hirOOG6nHCMxM8E0HGu6/50caoJJAU+Wt2Gtij6WcUULCACdaPfSPn7r6O/CtPY3fxgqI8hahztL3ljc3u3PiUcYnx1ed87Tb8TqmbS3HDTYLxTgffPWb5/+D6/i9Jje+EQO2ZvT6nVzxIwD7hjTg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080933; c=relaxed/simple; bh=BemhE3FLBJt8TXb7tQ33+yfm7BmIFqxRNCRy01CsV3k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WgIx4mfbd6O3T6pWOmTGCZnd1oqEOCO8nc4M2H888qUA/fq/XWzRAaipYTmxzYtur/r/lYja6I0u4aMt8oRzQNISEWqEAT4/rDgV/vH33spY9uaQ4H3TexYjI4rIT/cugjSSVgj9u+mBPLKucB+YDRcBxjivkreTosMcX4+qshA= 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=N57rapsk; arc=fail smtp.client-ip=40.107.93.69 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="N57rapsk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=FGdr/3sZUK6h/9TneziCVV+ULRZPGbbvgfmFe7e47Abz6NBbj0mkKWsbvUw3A1xSzMw2TPn0y/pkZfEzV9h+7gtnNmHyy47Gl3R9HXRmQu2t947AbGmwCcpZAzkDukJeVOTgkaQTkIg+6symrnDrePbKkLLCGidL1w+5lz4RWnMToARHD5XRhW0ktE/EupGcMxz4uzGvb2dMtiTkFWXnDV1OqO/6edd40w0XZiyeyjvdDKvtgcIVjh0tnjDOCMuxIMddDZT0sDTnA4Lxwl8fS0DUsUsL7OVTvED+3nA6JpQwSJ5jkJX5IRXIXjdgtpQgS3BVCeww9FUGdtQgOoCB1A== 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=qpxkTbpsmel7PNy9hFdoS5mAlgzObBowHU7VZLZDO1k=; b=NYfgUVJJJkK8whGbxe+ZwK10K578WXp9mp4Q1IkJtI3ZYPom3Zc9Hl3yRFLNn0TKRslN3LmJxCtY+/DBm69M+yVONARQFBMRNh3l8byKoZseX6ZOxbmgplaW75j2/SF8CAAUpeV66ivv7HWM/NkctfLTf4935gR4x+lElsET+JhITEzL0jpK6pPqogt2ZfvMghf+YpdzAR8+aB8GtiRhPtsDOvjyLrj7UnL6lY/hTHgaN4IfhJgD21rtYcRxiLRMBucgWZA2Yk2c2Llr7i8oVji+HoSlxmgk8D1eIrenRDaVYqW8fkB5oyeAGf6pJ3IWpwfdZd/Tpq98ClIZQBwSxg== 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=qpxkTbpsmel7PNy9hFdoS5mAlgzObBowHU7VZLZDO1k=; b=N57rapskgyruY5CF4QDilAMXEVWicbUn7IOKYQxNYaY0VRCcXNfJ98mXhSKJjdspgM0ZeSIo3mZV38VH3X5NmJKUiSdbvY80BwlkqI6rYZpcNzP/qm9y7x+efNqZU00uOxxQcolJGSxETnTJpM5yYc3DkL46kMWI9y6YR5AcCyo= Received: from BLAPR03CA0074.namprd03.prod.outlook.com (2603:10b6:208:329::19) by MW4PR12MB7192.namprd12.prod.outlook.com (2603:10b6:303:22a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:07 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::7f) by BLAPR03CA0074.outlook.office365.com (2603:10b6:208:329::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Mon, 28 Oct 2024 02:02:07 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:07 +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; Sun, 27 Oct 2024 21:02:01 -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 v2 04/15] ACPI: platform_profile: Add a list to platform profile handler Date: Sun, 27 Oct 2024 21:01:20 -0500 Message-ID: <20241028020131.8031-5-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|MW4PR12MB7192:EE_ X-MS-Office365-Filtering-Correlation-Id: a83fc542-e641-46ae-0cc5-08dcf6f486e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: ybfkYNvnljLWX07BoGsajzBMrNX1f62noKmr5lXaABbghGytqoZqTFBcoQVZVoHwbDh5v9yUkddXbybdJZZbSE/QtpHW5e9J2kk13W9Oxtl5mMmDpQbXDq9nXNky0J97cymeZEu1fpxQHu2gvIhNWPBuPU5qi1zeLl0Uz9zUuZZVX/vLb4Iddcog1IbWVPlxxe9IUfHKblsmFl5Z1UDr+zxI5u0+Q/ZXbsZJN4FdB/ofjPUOyRMLZw/SRG7lGfJTZkLLSkbVLaNnVPlfCjKZcfn1yZJGAITmavKsnC76rONc7W8HJHrBXf9RNHQVrLW5tr0n9xJv7pvBcbe7GXytCR+jKFc86ssW/x/o6H5PEoZDvDltXANBdTSxnhHtZ0y6183gyOZelKGJrVOaDJhWc8XyN//jER30WPflOBCWe8pyZkg0XgdLwcFlS6s/Tr/1bOur1Ao1PNqG4iB7d25Nn1DaegXUb3Kar4yrAUOfzOk22umKiebXXYvDWM0D8ki8SBGG+Vjo01pFxlblrtT0qr6lpBd2R9PE1w85njL7yiAJFFPF3kLYcqdHylz7eb0VZW/MmmvNR24Q0gg06DKI42G/YzgZDBvwQ9RKYxo6p9r+cbusDF3o0FNU0GYCeGnkIgHwv5jJ1Rx1Dya6yH7aEgX1u4levoCs27N1W7GW9WlqAkneebj1oThb5qmktcaic9dIgMJyIEbqfvWhTKz+H8bQ+wZweKDeLojUPkJLBwqdzwFFu/1phfoSOyk7Mxv99vrwXGmZ9sj8rcnlNBNqIukuwfY2+P4nh3NqYZnki9HpdYzGa4II/+FMz1UHU3Ur2xTiZF+Ji+4CODohIe1E4zs+9Dy9qdU0fgM7JPNScXZWZss/AXBR6U4ifpD+jZDM2E8fyu7oIX23QUQHYA02RfDtqgLyiSn9KW1N1sQsZR6TDVWGPstNct66Tm+OkziV5Z3jTeXLTHOG36SK3ZjL3/vcIbljYTsmjWn2dF9vXJ13n+Au1PSHr1feOElY1zkR4rerCAJZyMLrR+gVooU+P9KIL/LJywSp/TLI5MyQ6RU2tMiCI4nC0osYLv106+LB6lO/FaUMqH0bN91rHA+c6uImpdCbYhb0R0XwH8prA5T6/VA+hvIaPDI+rrKJN9QcGDKrkypiYdG7l561yP+vU0Sajcfo5UOiBMgayzlGfDznfKD/m2XA4+hT0Rrz0DCiMWK+AjHUKjN2WYXLlVydekNfaNSs04EODZ0zppfcIMs/vy4ERfe0OqkCOeKoaKZlLBvy9jklzndnr/aurCmvmjQO5CtUafnsOc4kDC8w655Bj325nPrkn1bj8XN+yADQ9OLG7Xmy4uDHJoOvmkFn6ejTz1qkGvn8BHu2GzuxA43/lTQHmG0FkBaD/AjaVhRpcWVMm//peJEwbJHwvkhM+w== 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)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:07.4622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a83fc542-e641-46ae-0cc5-08dcf6f486e3 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7192 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 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 c24744da20916..0c60fc970b6e8 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -10,6 +10,7 @@ #include static struct platform_profile_handler *cur_profile; +static LIST_HEAD(platform_profile_handler_list); static DEFINE_MUTEX(profile_lock); static const char * const profile_names[] = { @@ -198,6 +199,7 @@ int platform_profile_register(struct platform_profile_handler *pprof) mutex_unlock(&profile_lock); return err; } + list_add_tail(&pprof->list, &platform_profile_handler_list); cur_profile = pprof; mutex_unlock(&profile_lock); @@ -207,8 +209,9 @@ EXPORT_SYMBOL_GPL(platform_profile_register); int platform_profile_remove(struct platform_profile_handler *pprof) { - sysfs_remove_group(acpi_kobj, &platform_profile_group); + list_del(&pprof->list); + sysfs_remove_group(acpi_kobj, &platform_profile_group); mutex_lock(&profile_lock); cur_profile = NULL; mutex_unlock(&profile_lock); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 58279b76d740e..9ded63a9ae6f1 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -29,6 +29,7 @@ enum platform_profile_option { struct platform_profile_handler { const char *name; unsigned long choices[BITS_TO_LONGS(PLATFORM_PROFILE_LAST)]; + struct list_head list; int (*profile_get)(struct platform_profile_handler *pprof, enum platform_profile_option *profile); int (*profile_set)(struct platform_profile_handler *pprof, From patchwork Mon Oct 28 02:01:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852795 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2059.outbound.protection.outlook.com [40.107.243.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 D3B061898EA; Mon, 28 Oct 2024 02:02:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080936; cv=fail; b=fHfZvppNZr9TPCVSYxIAax0UsgzboRyP3NuqPPJp0qUVzBkDFX3UtkONvffFBaBUB3yWu1YzDxt+XsUdiwu36okgz/z2iO4F5OuSMyVCh+3VkqGMotqTpzjWD+EYu/vM/9RDV47SMA4qoZdUfkExDN5+XmE2Lhr421U5T05dtsI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080936; c=relaxed/simple; bh=6UVvI/hrMc3Z4NlfM4Auvh1sdIFbuy7FXc5WqSu8H9o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HaOzPzD4AxCURdSlpCt2lha968vitsSvJ6VoQYPp+8ygbNi3+CMorrX5C4HTTCchDPH+ZC8DeuuwayvIgVvsDqxVlYrvoANbKIdtXo15gEg4rv9uHhy7H+WvC4tvXNdLqyPJlWdUycxWvJjQ5dIIqoPcq9Z+ySjunoFw7p5ITBs= 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=OvRrvyoa; arc=fail smtp.client-ip=40.107.243.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="OvRrvyoa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QpUExAF9X8dk72qHCwRDYZZrm2Qbf+upMU9CCMSFnVlJIhKBTPS4OpxHH7HBBlj63TSX85cq11tqgX/vXYmNIohqR5n8HlC/mlI3hhBCl32/yXx8iFcYbPRfmzq3EQ7a9lSF2BhLR474epbAio8njEjOZZ5MMYs3f7aCiW+yUcbZvRVHjueWL2rTsW1fUPqcwNFWQs8nj8wYBzVxQr7b68mbbV8wONvYWh3r5kwh7e03oyV3Xl7e3h5QmrjgZvWcXM9PHnvBhZwH8C6KBXl79y6kCN6O/Bnn7Al0mr/U4g3dKIADRSzn09PTJ4lrm4ORuCoMvdQUbIeYz6q3Y33nRw== 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=bufHmnAAIirCmlj+rLsSytIevQgXf8dVoG+S/PDP2Es=; b=YeTrwroWSzGAR/nsT/Rvqi/8NmPoD7z9cMd6KKGzTju84OluyV16M28hAdWt6mBS9K7Q/PsAWg5VCnqixRxK1ICrVMQD3UYWqt0AzHbOjpMOkMYTGsyAqGw4fVTzcA2Jmzbr+8vy6X2DOBE4tk8yilyLMSMG98U/1t1uFwlVyPABsA0BHIWd5pHpWyyP6YkElfuCMakGnUpM8kolbHTCJh8bc5vABdL7KfszdIdLnAURYYC/cZpfonhmX6CgPiMBgRm5agDtz+5iL/vttHBQv02k1RFhQwb74YajeRGudSD1wm42c2qwkfbpZY41QjBb8k2eDItTk0AQ+1+qyT0DgQ== 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=bufHmnAAIirCmlj+rLsSytIevQgXf8dVoG+S/PDP2Es=; b=OvRrvyoa2kAWUmZIfCuntXtezXrsihLHlVnaoTdU0Td7TjBT1XGXbtdURJ0cjr3UvFRz+9/uMo2l8PPRBmnFQX9uOwLNpHMV6H4VSYiiy1fDm8d5KdEeK6sudGmjncuI9aE93gEr2Hf5AKj7Gq0LHQPsZ99GD1a1bJnHrGD6+iY= Received: from BN8PR12CA0008.namprd12.prod.outlook.com (2603:10b6:408:60::21) by DM4PR12MB6133.namprd12.prod.outlook.com (2603:10b6:8:ae::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:10 +0000 Received: from BL02EPF00021F6E.namprd02.prod.outlook.com (2603:10b6:408:60:cafe::3c) by BN8PR12CA0008.outlook.office365.com (2603:10b6:408:60::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Mon, 28 Oct 2024 02:02:10 +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 BL02EPF00021F6E.mail.protection.outlook.com (10.167.249.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:10 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Sun, 27 Oct 2024 21:02:03 -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 v2 05/15] ACPI: platform_profile: Move sanity check out of the mutex Date: Sun, 27 Oct 2024 21:01:21 -0500 Message-ID: <20241028020131.8031-6-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6E:EE_|DM4PR12MB6133:EE_ X-MS-Office365-Filtering-Correlation-Id: fcb101b4-e6d0-4dc4-d58f-08dcf6f4889a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: l7216G/gmUFhoDYmJxZj2Q4wJRE0TOz6Zlb1VZ8wu5WCPE4LOOAwwjC9Ufl2fEf1dZGF02cn41BEDIhXhMxIYKqzO7tDR1GNTXl/EJVqk4mnxp5EcCV7REgldZqfXspWNzhjN6ZE/2hqcNYJuPHA9sKTpWwRV01uJvr1GHL6g2piEGfl2RBjNDWub/HpK1X2nHWtLQLrt09YFjUqLp0H1hQW0LlmWsO02LKDRnCQc6Lj4bDmOMSzShDjF3xcwHNW9nrDIjX3LLjYGoX8JqaJ78JMwjFfNOhQ8EtWXMJ5J1QtwFlGcAB1P0dnlOAG6C9wMGOZX9Yt+I2o1vfEJ/G2yYHwQ7gYlJu1GfUKP/SpIQbQSle/16DwEMDDL+HjVWvZQdONLbUtbWHn/xbT4bYvjl9eRynRmM9aiL7kRuqcmaqwx7qEQTYUx+wDMSsqlJcQsT6K70L0Kxjxzi4wEJHcUip3pOqNHQYuhiBK7L9PqlCy5iZ9rl8dfbo4w8zcqDD5/Eqd2c+3xo3o/UB8R6TB/3m2bgiykF6Jf8lhHfwGUu1er565+GEx8McG7lrrtt7xwERcTG6zW+c24O3UqXVytCsShnBboALAzu3kcastQn/dt1yM/8K6ktfEU40UVcb0S55PyVoRkm0Lm51EkpRJNMfrlQhWX2roIDino6wnFNw2ou+o+DwMmuwgWFIJvPd5OCO+9bNhTjWeFyR1+qWw6xPm9b0b1UJ/NtCz9z0Bc7+BYNHGraMUOXIEq6/Awwa4q9CJSxvjRJ15EC5CLuz+pjS/o/K8fRK+yKm4NGHZxlcZDsJGeepixaGTBbqpQGNPbCTO2Xl/z2sgp+/q0zdTxQVPeZ8EHTWMmAto1MFEzW4pJ9gDpaBfQ+0Y8hQ82Wd8jtLZr6w3fb3qj9rOGc3kuk1QTxt4rOcyI7xAdbMmuXwlAimFuyY3NPXUfsOouKJoIp8ZBqrr3POacwhMl9duyFct6MqyvN0d9Ml7BEvXeUDUwkR975l4qp9Oeu0dvUh3RRlEqxqkAN1l9ZWTgZpJMm830rkPzeqN3aPvTG6jbelmyvqfh+2l2UnnbuwDmRYJK9+GSaQixMp5l+Sj3OS8ud93tC1EN3gPLyqFA9lByqEL7tTqHqcwIj0VXDK4mUEiPMa7imh6IAHFcLKFjFTXvoX7gBakBu+SPfAZgCZ7WtlfYhDUWHQ3azpWHK96PmZggIHsJWuVK/9jIHLXVErc7XHiJWPRK8YEHoOlraRANdyEHFDR+y6YUkT5JdGeRSbiEqmXF5K2gR/VdnrL9/u/BX021yGQMgFQOa/XKLF2xMER6fwDGSPrQoacB4wFMKWxsoWLlQdzhkfV8HZVpl8MnBSFvY0rnVQIfm/rg0ggJoZrmPQr9OndWgwYx1LyYlsSU2o4b8xImby5iiEcsFFWQw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:10.3444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcb101b4-e6d0-4dc4-d58f-08dcf6f4889a 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: BL02EPF00021F6E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6133 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 --- 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 0c60fc970b6e8..c20256bb39579 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 field are set */ + if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || + !pprof->profile_set || !pprof->profile_get) { + return -EINVAL; + } + mutex_lock(&profile_lock); /* We can only have one active profile */ if (cur_profile) { @@ -187,13 +193,6 @@ int platform_profile_register(struct platform_profile_handler *pprof) return -EEXIST; } - /* Sanity check the profile handler field are set */ - if (!pprof || bitmap_empty(pprof->choices, PLATFORM_PROFILE_LAST) || - !pprof->profile_set || !pprof->profile_get) { - mutex_unlock(&profile_lock); - return -EINVAL; - } - err = sysfs_create_group(acpi_kobj, &platform_profile_group); if (err) { mutex_unlock(&profile_lock); From patchwork Mon Oct 28 02:01:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852797 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2065.outbound.protection.outlook.com [40.107.220.65]) (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 C1C4B17BEC5; Mon, 28 Oct 2024 02:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080940; cv=fail; b=Af5u8ltdov76qXe2jGNjjRqiN739Ooz/dTdTjqaKQftikVWG8AuRPM6Y4UL35Y/OK9Ld+Lvxqnbv9OKFXL32Df/DzuU0FezjQUzTFR3y1hueCsoeob8yOySCsAQPGq5d1vtVktUXjCSC3E0PylhduHEyHTEvN3KT38+y93XTQIk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080940; c=relaxed/simple; bh=gzG9evIvix7BJIIw6KKXk58iE199qvBV7N4bBkYhB5c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cVVnIh+DTofL58Y4d2K7F5w6TRyM6fED3ODkYaa3X2Ze9dqUjo3ZhxiNP1hAelvku1Uz538qcsNQovbGHOk0UAQGJN5X9GKQBOdQ3CXrUw/derYFdiTY74G6XxwjvtXPG1jR4EY8iSOi9JYRyfccKtphSdThPoTvlF4nXpcmme0= 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=SkQSzxZL; arc=fail smtp.client-ip=40.107.220.65 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="SkQSzxZL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KHolHMa4kQg+y+pO/oaRZHzKaC+M4Redu2HLYKqFBpLhVFHC20VnqpJwDkFB15s7pKYk+9f4+FxC7cksNcZG/tT36eanxDgmeiIA9J7Qq3Y/c9cVacuLJDwGhQoWt6i8RsoadPTe7EUfsd38ZQS6xAWzYZKdQ2LeFAkFjpCSciv3DsRWcGMt77yTuuwb/g1UWTfBfBvjT9S12+/Jpb2lf96ho62Bzf0zgumItGBIUhQ/GHNaXYP697oKFFLNV9dprCicNxR5f14ZivHbUz7Pr1+OsPMPFhwhjOwvbsOHULBu0PotEDM2mUXouCpRnANEnaxRKT8dnyaXnkAxBlvvmg== 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=Of+tWu8dno3uGfpHQBfXgzG+HIF2ayWDNCC63bi1cJc=; b=Dv1NDBfOq5WqDtPOsAaoexnqiPSBhCaZQGSgKNGgRdBcfTI70LmZyW6Y0g50OCSc0ohgDQsSN7A1KeVi6rj14VA3hO6tyiuNnk0lWDAg7Jx7nnoYO/wrqeJHyj8tRU43TpQKj7RXpLPn/j0rT9T+yOPk4VrTHZl9lVXX1mfEh2qN0AJJPMp2e0/D7zYACwy5o8YUIbCRwoWwykMONY51jeITee7NOghQfO2Oz/ptOukSl3oLWXXn2N28lXmT2SvpscW1agAI+NpCokKmerSDVOxPa8W4I+A6xK4OiC3GMC8jcSWONeC94JIuZGdlcvDY5afUE/JnsudTSZtCnKUaMQ== 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=Of+tWu8dno3uGfpHQBfXgzG+HIF2ayWDNCC63bi1cJc=; b=SkQSzxZLmEfhQSc1HBxEeq1yHvr2Nj+8nJhoSmjbWnfvwcEb6UvJA2L+IK+FHWGhzzh2zV9YwE8UgPq9Z/oC0ERh296f3GRSpQjY5fK22W6qIlB4OwCvV8kTdBuDB+//R43oILT6avREk8DglKJfAZGZIHVhX0DuVdzjdG3s67g= Received: from BLAPR03CA0089.namprd03.prod.outlook.com (2603:10b6:208:329::34) by PH7PR12MB9222.namprd12.prod.outlook.com (2603:10b6:510:2ef::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:13 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::4d) by BLAPR03CA0089.outlook.office365.com (2603:10b6:208:329::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Mon, 28 Oct 2024 02:02:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:12 +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; Sun, 27 Oct 2024 21:02:06 -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 v2 06/15] ACPI: platform_profile: Use guard(mutex) for register/unregister Date: Sun, 27 Oct 2024 21:01:22 -0500 Message-ID: <20241028020131.8031-7-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|PH7PR12MB9222:EE_ X-MS-Office365-Filtering-Correlation-Id: d28b285f-e8d7-42b8-48d7-08dcf6f48a2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: k+C6WZWTJyWlrrO4XDiVD23UzVuSQ/HrJEB1RYki+/v4cOuSA4MEIfnbu2tNWAomCOi1wNf0rbmgIfTT5OpeiQ65GwWUOc1axI9h0+JqhoXAZBcjLXbPrAzsULkKBSQ47qXlBSnqKctV3E9qOo62b5qGJbKTDONmmZLtFsk3aC7HxNJNKq4xpo9ZK91ZY7Q+Nw8BM9dUGTrGdNPJHU11jrr0qa6qZAAvsMCeivO5tN2SJBZy4El6SLOzZ9MXAJKGHMuMPoE6m5t2BlTj4VHarfEFpTCNwIWnZvDSBipdLkpDLeoSNFN6p2apZmzdB0nS3brkv+4YA0l5+1fGtJOnAvB/9JUS6JLdG5XrUt5xcc9n+yDBWFqHi02KZV711nlSkeyhp2SaGSCEZZRAw6Hswy89VLpK0tk5Tt32OzMBgvWyBFJyB5WSi6kATPF302U4GlQfR334PHS11P7grsj1HpSL6ewqaZq8tLnsfPV4EIfCU/ug0vmeCOPEPVKj6bpcGej4x+kdo874oeKrwui5q1Jev3+1Y0KvjZRBIQ895Zmop2a/NCjszP47W4baLFAtAU47e8/WOdtuh3sa0SVvUWnN8aYLzGcaNlC44sa4FpSEoEzmNEcHxU/5BuWhc6W9nBORvejmxoY0xMuRPQrH6vyruyHiNm7ZfGpSFsDOqFX35JcdLMRyxfOsyhbEOy31++V2GxvYB+IJOM1qKdVKQNomh+l+KoNdp0xsaho014PSn785sY7rGyNIsDbG0OMuiTPaHu1L9VKr8xhiy8NzYri+0KsiaYS1zmZ39cA30XoM/a77O4BjIoac8A8pDsM7uMqxP+XE0q/3b+dgdPxKyk5IjtUvFfRonFe8zFhrcMpLmhBXzEdGi35hKQ+qkLqFimkgif8+mnoFOnvU7X2SAWeaptgU03P0XZe/9Z5uH1CBDAa2ztodgGYUJsi78oz4E4HFox6f5s2/wEiGHWAgXyd1OO0bpPeaEvuLmry5VIYb1guENgCZ8s+eck/52q4u2XbT4IiX+1E4JcpwudHuieL8qawn90T1LSuA6sl39vSXY9ObyNEQAmhX8uwJnHdnJ7oxMIzh4nQpekmKOzoMaltqmmAyVezxUqcRy1+BBil2xtDxaPTz8zXKTkf5/zbxHcz07nDOrUanKVP2ITgEwMFmtEhPOhz8SRg11nEYIFfYrgtxSeAzvUF0Kq3yBSwsf+4x76l5VWx2S4zrUyD8LSljTlrnonYUH0ggdruomXnQB0pc1wY863qd8Os5NZcpIGE3m/ezedMb+KsWfip2OZzvAodSgx4EgkRPQJR+oY9sL8fbag8kkmzPDatuKFpxTUHjPY+/eiT+q70ikDtOwy0/4bJxWW0Bkv61a6rUi/dSk6PYIQWhej4sgmkzlzLNEVkbwxTpAGVHDoRWK4mXZQ== 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)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:12.9622 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d28b285f-e8d7-42b8-48d7-08dcf6f48a2a 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9222 guard(mutex) can be used to automatically release mutexes when going out of scope. Tested-by: Matthew Schwartz Reviewed-by: Hans de Goede Signed-off-by: Mario Limonciello --- 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 c20256bb39579..100d6ffb10cdb 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -186,34 +186,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 Mon Oct 28 02:01:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852796 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.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 2A2CF17BEAD; Mon, 28 Oct 2024 02:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080940; cv=fail; b=A5GgbD1m5FCe0/2mthCojb6/sv2zbqFzz6UsAn8DKywXjQWGgmIGMGwjo0bfs7L8skNdXflc8zWtQOmSd5LqwOhj52hpFYO7Ev/m1xVMMhGDOitP367cLce7xjcSKObA1gFB33ACdTEr2HFeTWhLn2YukZumQt4T51Gb7ddvHqc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080940; c=relaxed/simple; bh=ZU6BROkzA7zNj0KMLGX5e4LqRYTYQfMk4VlEv6kwjzQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MFTDgX0+wczk7T6thXc5cE+43GdR5PcauNPLesmqsf2DbqbnWY4FfU15zFSQCnBqfMq6EUwiNoZlBJG3CaJw98wJF5UI0ks+3c+rMUUrN/mbcobMxC7qvOEhAJNCuIasVZl5L6kLWngydz9A3czEA8oWmsugrP+3RpbEGqntzBI= 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=xl2vboDX; arc=fail smtp.client-ip=40.107.244.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="xl2vboDX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s4Lsw7zr9Am7eZ3LypcM9dO4uyg1ibBHjSbEfq8Rw+VWZW/yeFOjaDXk02/yh21AX7dTrJCnmNjKuFHs4Lzy7+iIjrTRIbwJ8pVLbdO2CEyRgumm3z8D2RudUmJVJKje2X75Z10pEWfET3lfREuutM1yJ7C54R1TvPDfwnGox0PTNw12QOv15bgAaALWmoQ02YOrPDLuCychmbT6zfZ8rdFJEpSRwaDl/C+6rCK3hTRvEL4L9TXEd8GkJJh4SOXnXG+2mjhlW0giJMOV+D4+wzqzNfT/KKx06OBMhQPJovI0C3riTbZg/6eRhPRiJXZKGD2mVtdEUIGzxI778TSSzg== 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=oupYGz8RlTP+v31HqWoK+xtYXtdkCJXiniT1MB2+KEs=; b=SxDzuGOQnRihzcOxtohDiTYZ3pJPKFNVaQupd4s45Tdzy2zxHeDNGKux/ebOx3caqDgmrLYoHA5LH6hUMEWDyMnMQv0npomDcAqh/kAUdeohjStuhQTg8A7/PWzhLRq8UnYUN3dZXS2N8TFQB5P+03KGyPRoLoKOk4N8gEXetUeVgunse3Reit36+VMNaQb/0ryTh6m+epxgkSpodyEw/F8qjhyIuu8CnHnXtlvi/mYgIriuolD8YP91wIXFEmn/OrjeqjEqtkfB8S6Jp9fikaqQcq8sr4NgC//KEnjdXxNryzZWXW3i0eV2z7OA9yydrzNphfRYtSB4RAPnsSyBrw== 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=oupYGz8RlTP+v31HqWoK+xtYXtdkCJXiniT1MB2+KEs=; b=xl2vboDXN4+ADxMGgVO4koAZqzg+WfuxNUY7hggsRTPE7Q+XnKOc4dSmVgFh7EuQgC5TO+nblM7kKbUus0+s/amxls852f0Ndom7C8ZUH5BvKsBAyBk1++NZuZC3Zbs+/vo1ZuWVCA9cUUeUzXOjtAB/hFUHlbwthoGN6rt1c6k= Received: from BLAPR03CA0084.namprd03.prod.outlook.com (2603:10b6:208:329::29) by SA1PR12MB8724.namprd12.prod.outlook.com (2603:10b6:806:38b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.20; Mon, 28 Oct 2024 02:02:14 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::6a) by BLAPR03CA0084.outlook.office365.com (2603:10b6:208:329::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23 via Frontend Transport; Mon, 28 Oct 2024 02:02: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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02:08 -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 v2 07/15] ACPI: platform_profile: Only remove group when no more handler registered Date: Sun, 27 Oct 2024 21:01:23 -0500 Message-ID: <20241028020131.8031-8-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|SA1PR12MB8724:EE_ X-MS-Office365-Filtering-Correlation-Id: c176e1da-4c67-4e16-41ac-08dcf6f48ac5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026; X-Microsoft-Antispam-Message-Info: 3aC2GAVC/pyVbVORenrMU6p0+go0orczLiVSngAVrvDrMAejzThWiWMZvNTGGTkyaCCghVQP3m8szQJmnREZ41d8gpnQZn3494FbhQlVDEawBCZ8CpSOcZDhdnDTlqtxrglLlhE1CUx0WyGdrRtopX3QfLsp/wfovEjkawUAl86sMPBmXTQhNfvfCEmwFS4cpAyYb2UKvL9hZ6FTCRqrdm0iezNwQHTwSLy40XBmh/LsiS5duZJYxYKRV54e09NKdvE3Fg4uPbnq9SPL4iTr7nQ5icUxL/dO3gYRi3oiqRbq/8zYGDSSFz/vzbInaPtOUiXrFKKdDr9p2KJ2YQGdYm4uLb1+uj1udPoEQiVjKzzV0uMW3quBE7xTv4veioV5kfCG3C9dD+J0er1jH9Adyow+JzMpHF5AxVGKGNv0rpvYmZUHbuml4wpJiNfXbWm5bHSj+tSYl2TDeKyTf54LWkivynfWFfUma9y1GjAWWAempSAYKsUN6PSGAATZo3wgQ1jDzBF2o3/mftzqZtPNVQZeDkRn7u/JDqOyhXW0s51xhiLx0kcNb1GD8QErtYsZmro2Me7A4rtMWp8C6LfcOt3Ry+z9421JJ4+jPPEzvJwRJfgYqZgxJv2XywnyTBAN6Eut7r9BuArbcKpAJs8FzVdyxB3ZyKsKu0g/6lt//pWKt7K1AxA2xueymWbV0ijajfTZnuPfyCdDO2P7qObT7Z0j3AfnK+rtjAwl0CM8i/Ql27TIBFwdfcOEioTmrrjiw7Yrxmoqa3LqLSE2YkL/gyXhXDWzQksKU3VggOLWGROrRDaeyd+6/OQUqE5MtlI3Vd+JmKYl2aIerru3Y99vxpATN8ajf/Zq7wyrgk+b0GVCxBjQhuUt3ze+02Wm/NfDueF1PkwtofzuCcX/++tAcf9wkIbr2xhMg8E2v98NY2JgJ+eywzbzentcBw6GnF0FLracPncCVVe02N3XGQFzXndTX1t/cEu/c0QPtZg7gEVe1JOdR/juZMPdcY4wVYELL6k4eePiBQ+VHYmloSRGubOLDfJyXq9BypqlIPciRGMY3A5d4bUpxdtOSSzeNaucjEwdqfywQHvsn0bpJN5+syzNGIkRoD4aW1cIKlWjQFW49CxhXVK07l5uG3abXrr8YxS1h8iYppEs+PDx9T58h3BhllK3t/dgEncx6ehp2f2Kq683NCkWcgOUBqkhZd0iwZYPDFY8UYo214rp6CF4UowMKaiWb7kSa0tPvr/47woqyDAhg3fEtfA5TwknlXRidssYvsNRvqcETEpZfoiZESA8rJhQExExSDrOc1KLwyi29eg71WtFbX3UjIF2gOx3NXNVUf4GYP8WLF4chqlc5Ynvj3VFPsXQzFNcda0Dh+RL2zLaBjDCBDZL+K28eOsTxEmguWEos6z094wA4pzGZw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:13.9623 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c176e1da-4c67-4e16-41ac-08dcf6f48ac5 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8724 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 Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 100d6ffb10cdb..ede1550170f1a 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -23,6 +23,16 @@ static const char * const profile_names[] = { }; static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST); +static bool platform_profile_is_registered(void) +{ + struct list_head *pos; + int count = 0; + + list_for_each(pos, &platform_profile_handler_list) + count++; + return count > 0; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -207,8 +217,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 Mon Oct 28 02:01:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852799 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2082.outbound.protection.outlook.com [40.107.212.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8004E17C7CA; Mon, 28 Oct 2024 02:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080943; cv=fail; b=atiYzyyZz3XbD3aGqwsxyCgT3XDKk0RzZ0kGCgDa3wgUsHA8d+5eZ1UZIGiMfJj+XL6cfybTiiInhBBojOHmVIVST0HJmwAfBZlVcjM9Flo0MuLhL2KFOuSjXKYQk7zkp2h0hYXR1WGORp19T3R7Zk2ZGBAThbw9JVJKMC4Z/Vg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080943; c=relaxed/simple; bh=XLPamADJLZfp+QRrnpgSyNvglDNODtTm97g6ac54/RI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FG+lbgPA/DT3Mlp5mhMVqRCyRGlCI2j7jyOqILwmIZuIw+NzPoqJRAFGz0HRg0AIhaDK+clpldVOi0PAs2+MzV4Wag5o7lBtM1CPOQdgLLxxsScr+2CFKguj+ENUiii0BQQBlfcTnvigCc+8+qifKWmOWT+fEOy/tC+fJJG2cgE= 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=1dH3byZW; arc=fail smtp.client-ip=40.107.212.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1dH3byZW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=G2TIHntpxidNf2J8oFxmAlQH1KQlqdnroqC+layPDlf4XvDENPVxnw5jeOP5gnYUtd3mNT17VSJkIIn7hCFJrVxrXaektthOlQGc2Rtabmmy7+EE9o2BARiDcoRczTvZ93l/fbaGVJNX7U4kuAUoRlmIJsO7dGuuuIWFsoAMKWQTcqtAKnwvrkvv7NrPQ3wfKO8eGYRv97LxYYvXSZftbfWUocM2st2PfuTsFcjTYgmBuUFeJ8+h3IiYmk9jm6Dv5XanKQrq++GvDOI/Dqef706YQ2Hp+P4khFP7P9TiafJXBUD9H5vStee2BVgoLSDZjKho3GfQCTH1+/vjaZrDsw== 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=V748tjTCdtkIRvVRuGKJfwfBGGpjQy/Ltv/OSoFcYZE=; b=EJWiLZ5YKxUekmoDi8zsLQMb42G2sZQCIklaoGcHRWXEfCHCw4lnhPBWIiIkWawYD4h9jKNWisVldg8WsQZGi2tfAgmk+649jMhdbsoYBVSB+0O7je7JcTikk7nlymTJTkv0iODG6+vX94xbH5ojdkFhpaOXMpJudblBetamitZlxGMxnp+9IajcG4JzLG98jBdIqMLUEqPJrueteOx5+tItQh6nfU92GJ4bE2bRmr5MBAHEUzrORyrme9nxqkM86mI8OehroApbzQyBExn30W78OwYHbZSewfifRoyOAL5+S0+UPk0x+JUU+nLBeuhFZqWHAdhEHX5pHmFFYWxdrQ== 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=V748tjTCdtkIRvVRuGKJfwfBGGpjQy/Ltv/OSoFcYZE=; b=1dH3byZWAy8mFk8reJ66Xcap3YROTKxoxKng6q6130zZqLXiVS6vMZgzDYcKBVNlUhLbB9QjzAok9fCt3qJ/ZeUxJvwyx2YJUStvWvIPlDoj8sz6HxvCjJg0JmWGaKtVhn/zMDr6YBPCDiADb4WGzLbMFPdfwnaEb56KJrALruE= Received: from BLAPR03CA0073.namprd03.prod.outlook.com (2603:10b6:208:329::18) by DM4PR12MB5889.namprd12.prod.outlook.com (2603:10b6:8:65::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21; Mon, 28 Oct 2024 02:02:15 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::a2) by BLAPR03CA0073.outlook.office365.com (2603:10b6:208:329::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:02: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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:15 +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; Sun, 27 Oct 2024 21:02:10 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v2 08/15] ACPI: platform_profile: Require handlers to support balanced profile Date: Sun, 27 Oct 2024 21:01:24 -0500 Message-ID: <20241028020131.8031-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|DM4PR12MB5889:EE_ X-MS-Office365-Filtering-Correlation-Id: ba9532b3-6ed7-4dc4-8774-08dcf6f48b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|7416014|82310400026; X-Microsoft-Antispam-Message-Info: UBmg31NCNpnfuO48sxGLwdoRLxwn6iRmSPvkGVckpQGlHFjvslfSffYDpfCDxkX+FwAOmnBoumgyofXBAwo3GldtqSlrxsVO+b/FNuq3lyOcH/WpLxROwffGF8+Bmiq4ld6sia8VymocB35q3S3ukNedy25NyykkLRtLmaS/hR+MdcbIE75O/Ff8dd0jQIru0jHDG5L+e/Emgqsv+N1QTUg64uLv0shDZXRxweQYqreudQPMPGNCslaulCrQb38dHI64MFvIO/4rQzIW3sVJKhc9htStudb5PumS4h6p8WE5Upkl9wbod9geNAfE2mqvt1tPL6mcDbGRywnElmybSfsHo7gnspIJE6KqS3s+grj841xVUySkLNkEpcdVArkF0qIsEWlH9aOOb8xy7urGaRBGZKRL2Mh3lnXOJhguQEC+FLqrp6ip5Trj1Cr2N0QcNkV2yOVTicZGQuxl41WYPLQyxd1kFMW9kUYYUmg5ce+d8vXCHylSfXlIszu8KS8iwKHGytH94WEqXxrMo3fN9jrtGadWz0BHV55Q/w30yubjEhd9Uy6VqQenDSlF0nqqegUoSzyvIF6FKavwHlFuHs9NnBta9gIEBEeqbGQjl69C/3N8ZBvxWxUANW2ZiHNvbJNcGmAOdBkXndasktXtrHLV3Y1fnoYOrmhZ+nurq4eRK6oslKV4OAeZL6bFvr1hUaRnzN4bnFEqZEFrQ43SBEpgtBoNnCtPNdHlBLM0WBSi+HmD54jcUVd4jO37hzpZ9IzFE1wnflvqXn2N5DmNOwGJrxdb+ubiw+PeKYtkFZE9DvP5CC96u4KVJOMAlQUV+womMavbPjiUrdzvbWdx3zBPuBP3LK94b9ofgtMpYv6x+10Xw7QLmER2+Z5GYodD/aBDh0slhsr1zVIJrIG7Edf3Ae+UXXkBEG0zvCV/lT9DuzbCXMBFMu0SdbNVY17aB2wPD75NBaHDdWVaYRlyGm+CNTl3SRX+jlNOmeZjOlmUMBm3tSZ8II0p321cPrn9JO9G0AQ8Q9mEcwqMjjSWtR5dzf4VzbgnWf0H/Lp1rtqjN5CN6DneikfEMiyGtox4De476SiY8ZO2cGHWsnaLmjXpbykBufEkAQpJKmSoSgocP9NVlJaEeR/Q4e1NBzlUi1sVJKTSVtVCKX8SBhDplDwsYp6K35b09ONOky5cO/iTPLCBWIIf+Lul4uNiyOfWNxND5pl25tn6cziuMMi2KWiT3O9l4GGg3ucCZM8eENqSBtzoInuysewEKY2MY153yFBTDijIX2QFAfY1QSBfOCFIBPnoo5dn3xX7E+hg2udr+06KW6fn5soq5JT5LteXDL6P/qgksjff1fFtviadtbGASuRB44NtUcmTv43MYdl4LLQ1C4wgOwydKalFobxqJbQ98mnoP3LD3pPiI0Aszw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(36860700013)(7416014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:15.2904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba9532b3-6ed7-4dc4-8774-08dcf6f48b8d 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5889 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index ede1550170f1a..c0d0775831214 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -190,9 +190,14 @@ int platform_profile_register(struct platform_profile_handler *pprof) { int err; - /* Sanity check the profile handler field are set */ + /* Sanity check the profile handler field are set and balanced is supported */ 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 (!test_bit(PLATFORM_PROFILE_BALANCED, pprof->choices)) { + pr_err("platform_profile: handler does not support balanced profile\n"); return -EINVAL; } From patchwork Mon Oct 28 02:01:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852798 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2054.outbound.protection.outlook.com [40.107.93.54]) (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 05F7617C7B6; Mon, 28 Oct 2024 02:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080942; cv=fail; b=q+VgNHS3X2+W4vJ407tPuILf4McuqxmpZiJAiQyoPztxXG2FmRW75FHWmFxjZva6E+y3TmI1/VGISiZueq9s8L2p/V/qc/mVaKvz+fFy9TBs5RmJUUJoRY8lIIl2Nmdvr7A/A9mcukSqzHPGY0z29QqvTeLXt+ziHoxXozGIOjM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080942; c=relaxed/simple; bh=peMEyDjMFmdHm7H88Ur6wcOkl8YlUwv14hgn+PXRF+I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DbUzl2/qYBUIsdpj8YXQUshyPEZVktui26Z3VagJYhlilzmMHmwkwjyo5ZT1O8olY37hNFPdCNJpp0Cn2CAmJjCzy8CcIid9+Kdh54MGbuaAFSsscQ3LhBd8noyHalZ+rlXw+FC92GP9Di7Zr4OY0RSMqEJO1DKDBn67DP3CUvA= 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=cIG/tNxY; arc=fail smtp.client-ip=40.107.93.54 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="cIG/tNxY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Um30/a44E8a+qEzDMsM5sFp4mANDSUmMMK8GTpohJVh1kWwJJc3+A9ouUhqxwqRtiZfKGYdPVrBrovw3NSp27NjonkjuTzJXtS3YgwaNhLbEzFmTI7pOkqtBTdsvO3A4iLn2ETedOaS8Ejiob/FNU4l4fFYk1jL3nLA0MhVokeUA1sZHsLlFRiVQLw8uSlVuVK9VQh2XwcDWF7hHkphovDXeCd2lR4veq/o7OdMSy8ZDKTJjYb9Y0/UT94FqPnhrwNqXsN4T5IH4XEDsVfuFfdnwMmNJ/BTY+dSM+gKYUCdjtTxi6QF7UTV2RuKobuie2e3ln9iC+bhRjAlWoNrs/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=eBZo9vCmFYLeayd4nVsafVPbyl/X4puzMIYHQcMpcF8=; b=dz0990ndHGSVAtUv+9wcQ0s7rtt/A7sPW7tRhP7Ql+hHDbqTdV4ix48tCdvWJSLFEVwUOHqVtUBehVX1g+uH8eV2gd5Mknbnu9VCfJZw9IVri3p0SJwzAMgbEQGI0oNLDktbhkJ0JodA9zOaxf/k3zUXarrH+8Xmtuv3qjKjxm8wGvZFykOzVTkBLbLtDk/kegDyF3xTEXiWTwclzBYTaFypVvtnROYbsZ/dM/7S+o+Urfr4InwGppplD68Cdbsck7Tc/a7Bp3qr2KSdm8LnJAxJKlEvOJ4DG6UzosLV3uk5hoSKKkHYmFlCZubsFNLao1Q3DY9AXxBxmTkyiFPaBA== 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=eBZo9vCmFYLeayd4nVsafVPbyl/X4puzMIYHQcMpcF8=; b=cIG/tNxYn05Bb/Toiu0oA2KxY4/lm7ITP5Hcinpo9NhwjbJHFuq2Mo+8vCnsUP31fuh89Mo+cpgCGukSawfQ/QWh9WmtdV7LiL+/rOhHlsgSrIYHA8bLWhvrBI6WU6GdqIWiAC845z1Sqn291zWKQw+GDG+Vk5A576BCXg+GGEc= Received: from BLAPR03CA0064.namprd03.prod.outlook.com (2603:10b6:208:329::9) by IA1PR12MB6089.namprd12.prod.outlook.com (2603:10b6:208:3ef::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:02:16 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::b3) by BLAPR03CA0064.outlook.office365.com (2603:10b6:208:329::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:02:16 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02:16 +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; Sun, 27 Oct 2024 21:02:12 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v2 09/15] ACPI: platform_profile: Notify change events on register and unregister Date: Sun, 27 Oct 2024 21:01:25 -0500 Message-ID: <20241028020131.8031-10-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|IA1PR12MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 945d3c06-6038-44ad-692b-08dcf6f48c72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: hzxKUqIOZUWoUYrEAabpfbatVCYBKg4zghGAtqqUjoc/n1hd815XZx/YqhY8FOPW9Q3qNtjiBFBJOa/vTj/UpJ7aUbhRplRxxYN212CL51ZHWKiwfG6jQOOXmCL3hULDSHCxgJnRyWcIb+bgRZU30T2NfnlrGWYIKG5yf/PxKfptsaXoedbs84gQI7LPnSDn2bMmU5RiAU6fYOoMhCyWyALlMnNfd//720DxmYN70rMYZuXBxfKXocqmesdDepYJzGFNAfEHbZ3IktT5sqxFc0SZp7IopvKdy3FMpo486/NNVCaIdnG1AulZ2XHzJ1Zoth/iz1DJmJGQdmRxmwrOcxV1EFxIPJ4lDwEFs0FQXu4MDzGCYG5o2gKAOSjQZd3pvPph/mI9fV9CKLqqN2iDd4cR8nVWvqDLkCKQ/1M2hBad9qZSeUmJAhRSmv66+hulgvzvJ7OcMAQ/+3b1y/jYEqKn9hbZLCoSX2DbQljg1LKHTqWwUuaSrKr1lK54ZHcAdNy73hzoa6z12/U2jEh0f8E4xrHoTtoaQt8QcpNcE6Zk1eYsqpe+b4jHqxEIWzwCjTtG2s4Xaq0KAiRSLlfonQTzY/PV+xhJULRVGJKYBQneAaFS938T36q3I/61O+eAvmCJIX+VKKq0LcXoRGm9KXqj+iJ7spVlhyRso/+JW99pDOJAHZD2P5v8sK6J7+sCt5uWC5He66LcyMTO7E1gataWiv9X4Mj9LkumWxbHuUJYGEVgPjH4hPFu+kqp7tuVn/sad/JDQmzwpGWF8wMGnpZaQQs1uFIcCHfOHq9WruD3DnO/zs6GBbvnHr2xU2uI7HP03/KB+FtDHI3g9Ou1+kr5uww9RZ/JmGYqe/2DxnCpji/VSDZfA0R8zlX9bnLAnJP22fw54zpYtJ1+M1Zod8AY40VcsUCfEp57Qx2d7qiqPZ5W9L/LT3Utxoj2dYdCgCJw8dLyN64MTlDewciWg3Dz8rhQGllysSVG1uCCoW8IZHMZN3b2qIzUeN4vHjGm5FRvODBtZ5E9rTRY+qCE2bqYqthfKEkJu4N97UKEEjx9m9q2yaaojU6S+8N8gsm8E+ZoBohZXrqpguu6UHSoDMiGwWtIhm0WJ6xXoo12huvFTEgejerNiqM7rMNj0EK74XFe/LlkMwLdCHoli/RH5skEmc4N+lDigULZJvAHqaNMOgOyE+XkmQj452EawcdShm68K62GWfv+6uke8Hh+yP448Q9/4U7ZuTuBFAFxbvwljhX8W3SChxh8GdeQyLbFZ6PaaaVkDjvRFALrebyw2m6sjWr6xsPveWwDhTypRM8LHBt2P/CTT+koOQgKMIpqPJYcAuosdEdgAkOPrTd5rfOAI6aYPcuLk8QX/27aKRgGVxRFtqedLBPrrF6q2kvJMFcmxYL9bWw8Nm+sre0mjQ== 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)(82310400026)(36860700013)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:16.7747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 945d3c06-6038-44ad-692b-08dcf6f48c72 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6089 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 --- 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 c0d0775831214..5fee467614eac 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -210,6 +210,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; @@ -223,6 +224,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 Mon Oct 28 02:01:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) (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 8009E18B475; Mon, 28 Oct 2024 02:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080943; cv=fail; b=V7Wx2GNe3CAFLuJkizO5zlpQlktJnmin7TpFD1qf5MtTUftTL9Nr3EK9UKBV6AEGkRbijMOGueQODAhHkWb5qUDAGY2oVXkfr6ddLEuTIKMZ02FRlZ6L0QvF7FRQGj4DD2L8ttmcIVJPqQhRkxQXfl5ro7KNsff66RocWYgjrt0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080943; c=relaxed/simple; bh=2QWvixAlAOe4y3rfwVCRHvrO11PnTziEQIsgrr0+79o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jdPDEWid8vJQhskP5nD6HFj2gAnaE2S+nddYSD0gVk0PS5NnWzFxjnn6LiscqR9DsrdWQfzFW0KX8kOjKUMqNzjhkEK1iHdz17kK/OtwqFBFqR0WpN230ja95P4qJymzRyDC+s9rQgPRMFtn/Xt4XiOW/vovfVVAjphhheBm2MI= 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=x2L9dHY4; arc=fail smtp.client-ip=40.107.237.57 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="x2L9dHY4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pMH61BkrcHXJKGnsJ6WqkunhqbEXDo5EM9Q3+ziAOvpwJshEislzEoi0kO0Y1DXFj3JfDZpXcnWEt5wWZzY8iL9+BLMkiot4FDwpekQm7rdzVQRX2fUpvAesUp4El0TUYke32cw6DbEd0rf12or8LjlHRaYG/A2a99WsFjyK7oCJDf50FE2tJ+hCsfGXn8+6Xqb5ANo3qkAlXsDHSVkMWuLoLyNLz6pbjt612npSKygl/25WMbu4H8pVS79ymp14TXcnI61QyFCXyd/r0Hh+wng08e0UVStrqOHHQBGVZTiBD72j9P3q3T9dOmTSm25OlFvnGlGwJh9fB1QeMNL+wA== 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=S2vb0lbHs0eiBbQV/g463nhHMqsys4ERBQOYpqJcx6A=; b=LB3y4W2Gli3vbCR9FLYxH3y93DtZ8GHKGLy7sEEZ3L5rkWoz+l+UCkZclwFUldBC+0Rf62tcvwJPG1CRKsCtpLbcfuzeeKQDw05ghKnQDmr6kM4wYM1PJIH4lbZsnsJLOtU1gu2BCM9/G4SsfI6BaX2ghjkvqy2gw7k/yEex+hWLH4p/pHIW7eDNI8lOHlXkyiFugkEKXCz9jqgh/onVzl+H9vgCdzbUo4JLpGW9vy5rSgSI3hZm24e+pplDMunGgb+4BJhNH4dhinoYSHH/I5cerV+oDdzZJxwRnS4m0zwx8EMAbqpyuaGnTRcyWv6moE48fk65OeZyJo3giDRGqQ== 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=S2vb0lbHs0eiBbQV/g463nhHMqsys4ERBQOYpqJcx6A=; b=x2L9dHY474nUjfD2p9u2kriB2MSOAopMiJvMxTFubuXrv85wlHD5LAsXlsLgf2h3thxKORf3lHiXld2TdY2H5Bt5Zzl4m5sPNDy98tzioqolhhyLj+k4sDx0sL1KR86+LEpm/sJtmeA2bwPnn5rO0KSigaFdNSLMqH3V+P5WfyQ= Received: from BLAPR03CA0068.namprd03.prod.outlook.com (2603:10b6:208:329::13) by PH0PR12MB5632.namprd12.prod.outlook.com (2603:10b6:510:14c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Mon, 28 Oct 2024 02:02:17 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:208:329:cafe::e2) by BLAPR03CA0068.outlook.office365.com (2603:10b6:208:329::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:02: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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02:15 -0500 From: Mario Limonciello To: Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= CC: "Rafael J . Wysocki" , Len Brown , Maximilian Luz , Lee Chun-Yi , "Shyam Sundar S K" , Corentin Chary , "Luke D . Jones" , Ike Panhc , Henrique de Moraes Holschuh , "Alexis Belmonte" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Ai Chao , Gergo Koteles , open list , "open list:ACPI" , "open list:MICROSOFT SURFACE PLATFORM PROFILE DRIVER" , "open list:THINKPAD ACPI EXTRAS DRIVER" , Mark Pearson , Matthew Schwartz , Mario Limonciello Subject: [PATCH v2 10/15] ACPI: platform_profile: Only show profiles common for all handlers Date: Sun, 27 Oct 2024 21:01:26 -0500 Message-ID: <20241028020131.8031-11-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|PH0PR12MB5632:EE_ X-MS-Office365-Filtering-Correlation-Id: c6dddaea-2375-47be-a19a-08dcf6f48cab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: ZOzBeZQpnBBvI2tAY8HRbAKRRg0PzC4HJMKnengqtezIkAVKGJz2erJaba6EiyctYpHCvhunKurxE+i+JHb1WYF3YvPwpTD89TcoCnTn018XxM1gPArYjXhGs7bVqYExK/OSbAUQzW2kotGs6z9Txi3xhpkFlLGMhWUmu/DWuxzqvSU+IjM7oUwjmCijLmBnBcH6+255q2v18I4Poh6jJ0cIpyn9E6UH2PhN76BgcnYUDEzThEPPRb/kEZsGJ0FWAOuP39U7gW9/Pwr1eJ1AIJ58HktajFpRaJ1FoBNPcXq7ppolyXdbyjHn14jA/J/bxbh7BoQzkZSNyes9uY5WAmtL2KQPPtSyd95ym0qG1byBuReCQCWWA1ib9iQEKB4QnuaqP5+Hw4u1EOnTP+UzKSemmAF5DygsLZL7B6i7lKV5rqZa/j7P8U7WDtxFKq8yB+hNz6aFtcB3ml9Di/oaPvA/yc9ENA78FbuOGC0jWpfNjjQmevJ5Patornt+qlS9NCwGCAfDmfugLGVd4U9+GIs6zrp/1G50ireyDnjaDgB1vX6RdP37yFJpUs7v2AbIn/kNPaUaNHGumiUkCDOYuKcHVA8qp2SiMGjLCuIdfPWU0wNGr4BW1Uzv5XyE+f070VubDLF1UqCF9cGFRkYVVyJNo5LNlnzs07/S0FB08cTzEDD6TnedUa+sOm49djVUsx9Ex84BybzOtRnYCxmF5l2yMlT4LUN2/GiPVfOQQvPF1HjTuNjzklQrdtVvqpFI3lyI8wcYuJlwxZlWEzKHs6m5D0S84HX+gHmzqytoKEO4D6FZ/lFdGZOl0tJ8wAj5jQgwTShAOF9HYqf8Qkr/oxeJwZvnMDhJU7bj4wOtKcsfcuesuYmBGjXNVUf9IqZokgHqzIbIS4cgyjfBnGRYlYHTuT4773r3MT2WCZSiTW4FKLiQSYwEfRc8+9nlWBABSSEtJm6e8VdvI63gOy7FodNZPBpRUT0cmZjq8QotePie+FHWe6n5U9CNZA4cCGgNjQdW0Used9RGMOH0DKZ1CIlt2XWphNvilyT3sSnIUD2g47AkcsfJ25v7XuLB5rFUtIdT9+15Qi4OF9S62gfFGVRtRlNg3P5Snbw7XP/noY6ymDHXiA8UdejiRxKNByjNY0DMBUkHiMVdvcj4Mtz7scT0XFPyQHew8Ag6QTdO18W4Q/DPP7+MDdLHUjRSdpQAvy5+0G/EUp20E5a/G4KrEHgRSCUKBcrFIgizd93kbYDo8PrlCcVWYmVkl9R1YdE+RBAGSSnzSRsdi063lK6QrtGcsUr1OVtp2t4PKUWr70woWgkSpscaw/DsCOtvzMAEVNqjOQn7+PMLJAm/VAtWxhuY0XvZz6yoOwaWAVOpZ50tgfMTLQJZxjhAc6tG0bqfybGwyf22rQOpgT384MTW9g== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:17.1654 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6dddaea-2375-47be-a19a-08dcf6f48cab 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5632 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 | 35 ++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index 5fee467614eac..a83842f05022b 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -33,30 +33,43 @@ static bool platform_profile_is_registered(void) return count > 0; } +/* expected to be called under mutex */ +static unsigned long platform_profile_get_choices(void) +{ + struct platform_profile_handler *handler; + unsigned long seen = 0; + int i; + + list_for_each_entry(handler, &platform_profile_handler_list, list) { + for_each_set_bit(i, handler->choices, PLATFORM_PROFILE_LAST) { + if (seen & BIT(i)) + continue; + seen |= BIT(i); + } + } + + return seen; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) { + unsigned long choices; int len = 0; - int err, i; - - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; + int i; - if (!cur_profile) { - mutex_unlock(&profile_lock); - 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) { + 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"); - mutex_unlock(&profile_lock); return len; } From patchwork Mon Oct 28 02:01:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852802 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2044.outbound.protection.outlook.com [40.107.94.44]) (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 E80AC18E751; Mon, 28 Oct 2024 02:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080950; cv=fail; b=X0+kLxNu8Ag3VIZUyPK0yy7pcW6EgbSa0uk9PlunTKJj7fn7208vBdPy0culK7JyuEr+ThsJ7NYp7FqnhKQcIKTIkEo/uMIapUSYJUHIyjgHPAJVwQ7xn0jaa/5IjgQowS+I+FwHDBof3ulf0Tvs8JeJGxMH9Ic9bKJBgomYuRk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080950; c=relaxed/simple; bh=hRMdJxh2U6nRN/XXacx1ArC9M1AvzMSxjV3SY+R5fm4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G1XOyE0e8/ugMKM6Q0yLCVoJwyuuMiUJIOQn4g2gWX2Hwq5xstxT07WVMDGkxxXMuGP7DZTXwtpRPYgePI2nFtZNgWdFUqsClX2fqSqI5FNsd6R7CgHOj1Z3z/jVq4wSfF98HBkvMJgj2Zn+rz/DxIg16vyqYIlbWqXXHto349k= 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=sVZDXmI1; arc=fail smtp.client-ip=40.107.94.44 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="sVZDXmI1" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=O9k4fXoXVmobvHM9hPuMS3lKINN1n5KEOfCNLDD3IwWpN7kLIzeGgOI+mLMo/iOfoNlTuaBQ0i2BIUDv4CDz2lBWLnCxv78cwlHe//RsMTDam+ZeaCRo5qA0IvLa6g7AVaQLUcO7AJUQkCXaD4WlxWxRnJAo8lWzwjE+K6WcmUsiccgtUhDQ2IvyWJvtd5exycDMw0u/Cpd0L6jTaL3geO8HxTJT82+7oVDCYQXPd5TcFNUZZjt045tEA/qHivIhQfiOBI7bQ/tvT+oDayTBz+6CeQdCvSAWVjd32v2EnHMCgsa0UuF+/GnCoERnO/LZ6J1vsJc89f1cj1FMS0o4xw== 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=jA7mkXOyFAEZsu6LCLTcVYR3EdIJJE8Ibol0D0QosHs=; b=USR5t8BpYdXg2h9ZKb7flDB8INMPoWE7xd1JW06sLipr+q3Uh58OZPpJN9abvZg1W6az4phgQkopfw8l0lkAQlO1HYDh/R5hDlQQNuAsEaBAkwwWWvIdCwFS/Cp7wrKvOdX0fModuLGLBwXTiylsbc07p6Z4XSyXyb7+O00P5F7QGWrY0EiSiF8Sy0GWopmKnLSmi4O0hy8pSD51wwM73QlTDTKHhh7BbnG0JFEcm0j4TzMl7nipi4Q8I8dBAOTCbeVatUquTed89XJZmtcIj+n4HY7eVajgregFkgmTIfNYp7noW/sGBk5qItBHzllG7ZWU1P6exOaNu6BWbHX6wA== 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=jA7mkXOyFAEZsu6LCLTcVYR3EdIJJE8Ibol0D0QosHs=; b=sVZDXmI1Mz05dywID0eJ1KELna0nbToz5HeVRx0Mu6T43q1dgc4+uCUDg3daL+T7HrD4OVCR0Iw2UOHrf0Vmzq3DPCUJlUBDo8DZ75sRvS9LSXGAkqpaHuy2kY6KDzR1K4fmJ0Nsatj3VN8tOcq8SbXzyWjoBmNgs0otPwaCDsk= Received: from BN9PR03CA0908.namprd03.prod.outlook.com (2603:10b6:408:107::13) by CH3PR12MB7690.namprd12.prod.outlook.com (2603:10b6:610:14e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:02:22 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:107:cafe::73) by BN9PR03CA0908.outlook.office365.com (2603:10b6:408:107::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.22 via Frontend Transport; Mon, 28 Oct 2024 02:02: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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02: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 v2 11/15] ACPI: platform_profile: Set profile for all registered handlers Date: Sun, 27 Oct 2024 21:01:27 -0500 Message-ID: <20241028020131.8031-12-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|CH3PR12MB7690:EE_ X-MS-Office365-Filtering-Correlation-Id: d4632f72-84fa-4983-55ce-08dcf6f48fca 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: xH4HIPyIbHfiB1ZP0KqL7v9V8I19eEuT6UAZIxabX3Gi28bpdy4eseAKWc+d0nl9FqCoK4vQrNKe0zOIdRRsdxpZLzAR371Fy8CqFHDJtpt7pxZBHtpWpq23V5H1fCMHpRQyzjiMqxyofX7mTAgddmBxUhD3GD0NQ+uymIvVNSSbiRVBD/9uXmUIM1S1pQpCacaVAxDDC9j8rnGJLin0E/M/eeIYchpBnk14n4V81zrgsVwHM/thy+EYlZOh7wGR+kyum99lLSE09EnfwhnW6OwUtqLW0so9HVn+PSPPGrDyLq47O+gQIt6yj8dMUmyd4rgZY+WfhEy2aASFNYMDBy8XPx5+xQBUp0q7WSBocI55N18Rr9I4AnO6vSL8kOvsho1b9URw/HbrNhDXWTygt6QQbYMJYz2rHCnIfkqnRXSLHEzc1pT1TMXXX4FpkifaXCJH0md1nYL/hy66gQ4HKM7j8B5aWxPWosbXMvCDISAi9NeikPKAAC1k1Kaf58h+5Yj0NMIr4/JZIqQOXCRV1jnNzA1Utmw2AoPd7nviiH4BlJ1l7iA+bvDPZVdNq7zPSyvAtoO2rpRE0BwZdwgAAfpdGyMhMWcP6s1lB/sfd9kuJkXBkg+KPXEcT3C1wKVBJrVo7nxqOnWzhiPEt5Mu1m9ks4Ah1ird68EWvF7+ieQLr+ssgHzPiLu3gV4egcrEh3x1OYt9nFhThrf6dPlQnfcR+A0sc0ur+v4dHk54ZXJrcuj7n3fK0NiwvVLEJHc8a0JJt7ATF51dv4FubE+dEfMyebPyeQnIMcgQGgYF3K96R2sQq1t8ENowuIrSYLgXAJWBn2ymp74jt+PRQe9SG5wd09vnVmNx4h0R/0Q3mOSeh+HXot/D/IC1GcE5D8+C9cRmzchz99YOmxnuQfZtNDaKZ7XnpFwYPLImxKsqt8uq4NZH3DpDTf3PN6FyLnJhtpyPLm2mIXiNHQsc4c5A0r6/6uPxEJuzH2H1psjWbNtcVKSA86fv5jy5cjwW/w9CvlK6zh9NvDNd8lI35y3CyZLznwd0Ytl88uHhBMrZ1BhpmzjuODQDV/ILz4Hl0sDaOfN+ABS/iEyfer5fdhDjZ3I5v/dhTdhi+uNmVZH8Bh5lpSehfxHyEILjkFlNRVUxSNVWCEM1O4mR/qh61ZjvM19K/jAS775G/GqSLsDbZR6nVQpmAAUWiEkkORy5jf2VC2co+HVN9Qi0NmYl/IZk5giFwd184Kp6VHfpqiIlgTeVi+mfPYrox7udrL3G/ZPdlilLF/lN+DOvF6pXcoeu4I0Nq3mGjpkxReuHQA5Lp5J1MKZMh9Pu+96OCAIhqt/NAnj6sLYruk9ZsSTj+hdRpvsecZmmTsjxl07AgTcfY2pEHgWtKpp5JBkQg6rx//VT6fJLoWxLbygpR0T9+ej/Mg== 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: 28 Oct 2024 02:02:22.3998 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4632f72-84fa-4983-55ce-08dcf6f48fca 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7690 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 | 47 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index a83842f05022b..db2ebd0393cf7 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -105,37 +105,42 @@ 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; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } - /* Scan for a matching profile */ i = sysfs_match_string(profile_names, buf); if (i < 0) { - mutex_unlock(&profile_lock); return -EINVAL; } - /* Check that platform supports this profile choice */ - if (!test_bit(i, cur_profile->choices)) { - mutex_unlock(&profile_lock); - return -EOPNOTSUPP; - } + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!platform_profile_is_registered()) + return -ENODEV; - err = cur_profile->profile_set(cur_profile, i); - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + /* Check that all handlers support this profile choice */ + choices = platform_profile_get_choices(); + if (!test_bit(i, &choices)) + return -EOPNOTSUPP; + + 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; + } + } - mutex_unlock(&profile_lock); - if (err) - return err; + sysfs_notify(acpi_kobj, NULL, "platform_profile"); return count; } From patchwork Mon Oct 28 02:01:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852801 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2059.outbound.protection.outlook.com [40.107.102.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 62ED618E744; Mon, 28 Oct 2024 02:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080950; cv=fail; b=Y8z5vAvvO/JnL7yQ8CZ8GjxbkdkiYHtpvb+L8niE5n1lJ+L+zz5S2B0oqeg1ePnCN1wzNih3ZjNXbtK9Bgyhl2NvGDK9gXjNikGxEX+aJ0M8ZNjgX3jvyf9vDSABdYYjdu6UcG2YtRwCJ+i+LqHEZAACk/7PMD+c1kOSLNUjxpk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080950; c=relaxed/simple; bh=W+fSgJhDtdVD/6141uj9L3PIS1UUOjhO6wr49vbQxCY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BkNzaRtLvnhiLM7G3H48FAUAtNDculsXgu4XyjJFBkqWle2OUKKZKnXxwIwWosW8tHDj0ClT0cS/AzUTfBITtjeWgcsQWiIFm5fSPGqVuiilp3IvWzrudiljkl7ZaxaII6WUULHR82XnhP0YEgoRasz2mNBrainKTAnc/mUhlM0= 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=YwME/gla; arc=fail smtp.client-ip=40.107.102.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="YwME/gla" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ud8LDt1DfCaGlX6vj9gODJOr8PWwVYV5yydDOGy842G56JUZTkYvhQ+pGMGUkvBzC7ozP94Uy3cLWS7EZXetkFJyD67xg5cimG8+2N83RbpTOr/A6YZruQT9hD9iLdh9OHmwx06xT2jWaiJ1DNCz48kTrNK3awnyE6P10k/gyMzSifgJ5P8JFQGIA5y6vnye+Lnx98reDO2VJteK+a06I9bPek6IN0r7XuC9KwBCGm+VNjnR495YnADLNnvMIzqW9bx6C4bRshEHP2PmrOt0JGQ8ZKbLNER/D2QjbqUtyemu9TDxlggXArrgCM3LZacrCyBkeuBBwr24/nJb3mamIg== 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=Ql6c7Js8FYvAm4PiZo27iRN5a3gxXJfJtHYC8UW3PnU=; b=VWujriMC88RZTwIFHkk5VFpTQVOT3Pa2bAwcbJ5cJJgyvA6/JEgUOlhp1y4Ti1t2fqWm5Iz6BzH7L4qB3925Bry55ZiE/Bgj4I5FE817Qzy9CRlfbfVegWPgSx/JJsWwRw3Sm6yl1GrlXfoMPSZGDst6Mr0i5VWxFx/x2zYtKDEejy3m2fzjX0FlR9ov0BEOTllhhmeJLBW58+SB+f72KM59+JqAcBA99SbaZLvR4mGEZYrpAsFevS2T3BSGwavdZzvKeYWAg73gOiz+Smt96h1Zp3mPTRbBc5w650gWzYvfywujYzf68z24ZiWQ29u4Ugt/b9Q/ehVubeM5qL4sBg== 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=Ql6c7Js8FYvAm4PiZo27iRN5a3gxXJfJtHYC8UW3PnU=; b=YwME/glaOTxtVRGLsZB7lRpOTK/Dti9Q8qaZdYY1iQZi27WXEvvMlpvwZByuPLswqbmmbJsQB+7PaZlRs8uIE7L4X1nLzTsdQHOKshqGVsFbOLdn1Zo8QB7ZSGIaYmzmAtlotJZV9U6U5KPFbPxsm5dpmi4GSLq+klkhLrX/KTM= Received: from BN9PR03CA0911.namprd03.prod.outlook.com (2603:10b6:408:107::16) by IA1PR12MB6410.namprd12.prod.outlook.com (2603:10b6:208:38a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:23 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:107:cafe::65) by BN9PR03CA0911.outlook.office365.com (2603:10b6:408:107::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 02:02:23 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02: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 v2 12/15] ACPI: platform_profile: Make sure all profile handlers agree on profile Date: Sun, 27 Oct 2024 21:01:28 -0500 Message-ID: <20241028020131.8031-13-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|IA1PR12MB6410:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c8f6d72-da6a-4415-ef45-08dcf6f49024 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: ZEz8A4/nGThEAHyxIFuDiJkcyaAkVMKVAEO+aeZNU401bbghYKV8myb4lTNPXbNvQh6pv/ZFwVNfFzqq0FAwdQUaX5BnrCMrO82xA5uq8CAfdYC/sS1MuAcLpKInTolNFgOcJiwcWe+CTyxHQjCVnns8NefBgFOLn1t6MuCb/oBLiCkHyK65DhNUa33z4m9b63dAkN27dPjh5Cu82dbYqFQJvCFVOciE4nOwkeyL3hn9e8+kzCnOd15bZM/IKmgbuZrsPJEK4MZBVmRAqO4M6HJUkiygnPG2yAO6ZzwnNN2XugDp6Sb7x5ZhPRXT1YzEw9MjxqVdm6bYcA+90m41J3B6FLfPy27yZnhXkbJPCKTB71Egmw+rs/PE0ylXrkHTHBm9u8XeEFnbYifQ4cA49Dunxhf6NVJ8aav2XbuJsCfjVR0SQGlkYHrGXeQbGu2L7G0txDzCuTWyGfI1Y7Z0YiGLf4bqVZMnRdPDjGG99QKK5ET8e/9YIfArbB2rAnP1W9JwmGrR5KoGOgSNOJlY64eR7sW/A8fRD1qVrWtFr36Z0RrqtiLOgmXBJf2+PwFhxbem7QPLtzX6rvOoal1uoPM6JHhnSzWzJpO05kKNwgvwya2SWxUSm1kiBZWzH6j1pct2jzQETsfzrl0B+GHNivYmp/85aj6usKHB+q67cfNPHnUfsGHZKhA0NhI00oyaGTKPFx04SIy98uRK4oKP5Gxx42fAOx/Hk4vim3BDJRyH2JEIOCXfaKxCcMVq8VI7kEhCnnRSgN4Vrn388Mo+mLIwyaxtjIz7RM47yIX0uVZ9g4wbjz4NZ2D/erDmhk8fw3OXP77qemMhZyf1w9LbDNOc4U+f3g2mZEL1Jr1j+LgsL9kj+91dwzQir+rvIwSd6PJMV6jXRO1Tv1Bi1304wa3/ZOWS971jGgV/a/LJeH97Z6ciVeGGC+bqbAsaiCg4TVnm5LdSdwhGqIdjbPlTYiUq/eks1Y6RxM0Fd001YYibmmzOdFe+JYtb4zCHhlsC4OexUqApa0QDp18lNZ4aOI1RHX6zDOKVHehSYxWT1FufKb/3cGK5mzDJY6FjcHO4xqrcbvgD74nw6KUQAhpjky8RgQVAkY4WxLrTJmBcriWsOgzMlRx2WjKS7QTS59bu2aOgYYU5pA4OPGaFEJSQ6TitkxdpgaHwvMg89XchvIYw8ytGzy/oRKvxpl1+9Nl7IPHn6yNW1DoBNMkOC+cUAM+B+2Y6MlA2xkkfam0c01d3PEHDRnGOUl2kG1EVkNFhQz4logzOgclsYf7M6ISnDAeN6A+DMkIsYPeCpyuktUNyaKLqk0FHj9GUCwP5jRiXhp5E/cRvyL+iZ+b6IG75QJMiJIHnS7dnOJSuLXNKH9H7muUf1D+t5EjBV5RLoWrz59rdxfDtmWeKsQMxl+Pryw== 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: 28 Oct 2024 02:02:22.9935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c8f6d72-da6a-4415-ef45-08dcf6f49024 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6410 If for any reason multiple profile handlers don't agree on the profile set for the system then the value shown in sysfs can be wrong. Explicitly check that they match. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 61 ++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index db2ebd0393cf7..d22c4eb5f0c36 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -51,6 +51,45 @@ static unsigned long platform_profile_get_choices(void) return seen; } +/* expected to be called under mutex */ +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 active2 = PLATFORM_PROFILE_LAST; + int err; + + list_for_each_entry(handler, &platform_profile_handler_list, list) { + if (active == PLATFORM_PROFILE_LAST) + err = handler->profile_get(handler, &active); + else + err = handler->profile_get(handler, &active2); + if (err) { + pr_err("Failed to get profile for handler %s\n", handler->name); + return err; + } + + if (WARN_ON(active == PLATFORM_PROFILE_LAST)) + return -EINVAL; + if (active2 == PLATFORM_PROFILE_LAST) + continue; + + if (active != active2) { + pr_warn("Profile handlers don't agree on current profile\n"); + return -EINVAL; + } + active = active2; + } + + /* Check that profile is valid index */ + if (WARN_ON((active < 0) || (active >= ARRAY_SIZE(profile_names)))) + return -EIO; + + *profile = active; + + return 0; +} + static ssize_t platform_profile_choices_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -80,24 +119,14 @@ 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; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + if (!platform_profile_is_registered()) + return -ENODEV; + err = platform_profile_get_active(&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; - return sysfs_emit(buf, "%s\n", profile_names[profile]); } From patchwork Mon Oct 28 02:01:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852803 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2082.outbound.protection.outlook.com [40.107.212.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F127D18E754; Mon, 28 Oct 2024 02:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080951; cv=fail; b=uxImHk2pueFXCW4y3wI/t3baKEVtulqw7tMzuCtXl4bPrBfRFQUcQZU6jfjYCY8wfgAeM2VBYrPCORfU2FBPMlycXyAC/mGy9UYDwv+H48A/4AXrRfXymHFzn1IfirzhpgCDr2DXxeoTz5MpcjXHQtl1fsvQL71g04ZCIJ5ZQoE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080951; c=relaxed/simple; bh=aFwzSKPLz/YXemmVCdt8GJyf6EUcnLuQ4/HLB16K6Ks=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CDs5yepy9G8tUrF3JDd56VOFJDFzR9r8+N9iGoxgK88HMWjPH6G1syMfNXnO4bkTGhnGMvqMx7fiRsr4Z2d9DMxaUUJtsi7CXYQIs8EE3PZhcY6zsH0HTHQb6MBU/Ufr9doKLXFI54kG9zrsiZiFTKVhZf4pqm+wTtPABGs1d4k= 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=ICYQkUVT; arc=fail smtp.client-ip=40.107.212.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ICYQkUVT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YPCJ+Q4p/Z+exmQM2hMfuZYqAJhWgRuSuDIwrim6hL3y3siFdoKfBn/wAXa0Gi6tqiGThVH6hnYH/OS3v2KJdy2bjOgMYkc+zEVukxmIDeebJOa3cxPNalTjMMsWigi9cP4NK4v0s5/rhFshWF7nyPhFrSdbc4HkkXNQk742Bl8XVIRUYAbCeD71Lb3xA2/+XDumidIkuXRJZvrTCXYkCoD3DL/dnWdV+HOUfnpfB//gebT8OrORgxI3v9d/n63ZVojGU3oedYWyLfOnUM6PKoTcE2stWlapOQb0TVUVklh/lYslXAuvt36/SALPaeWBcI2MdKwgSeH/oNTTrqmYmA== 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=7kxczHy0H4hTAJE0R5okzA9R2sjEja1ZRGsbQuw3pv4=; b=RWIHAtSAr/6rrftr2i/fkQb0UDO/WmVtJqbgCV2CpPj/7jqWo3XJbe6pRtHxFYgXAzSTm6OANZZshYGQIMAIOGjm6DXzIuFGcVl9MuOV6UDEUFX8AWyo+v9JYe/7uzw/MeOdBOVUPyStCNBk7Kt6am9dsGp6YBVEYBhpcLOiKOTcZ2106Uc9tUeP1qqTjciVzJ7RD3ZkOogRCkWsHSNSA2+6FUVYHrt8nhut1jJiKxeUgpEB4RS4tdyuXBWVQAxVqt1tY0N+lg5ydQD8zmzqaqdAfAzcW7tZiwbRcz31ksKV9ed3XCn/Qa+/5szT8NxanHNP4gpbVUlAkQlU0jK3KA== 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=7kxczHy0H4hTAJE0R5okzA9R2sjEja1ZRGsbQuw3pv4=; b=ICYQkUVT+6Z3rtkucM6863zA4Sg2G3c1trXel7U5TpgoPAV9wzlSgWcaUXvD+oNn37AkyAOVUlODRACap4ZtlZVZJ0xqPxPQ9qzQau6EANHcHh92/eqAedssVX55LWF+GqBRkVLoMAy2kgSo1rsshAQFps2nVimWtkycpkd9TN0= Received: from BN9PR03CA0927.namprd03.prod.outlook.com (2603:10b6:408:107::32) by DS7PR12MB5910.namprd12.prod.outlook.com (2603:10b6:8:7b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:02:23 +0000 Received: from BL02EPF00021F69.namprd02.prod.outlook.com (2603:10b6:408:107:cafe::f9) by BN9PR03CA0927.outlook.office365.com (2603:10b6:408:107::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.21 via Frontend Transport; Mon, 28 Oct 2024 02:02:23 +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 BL02EPF00021F69.mail.protection.outlook.com (10.167.249.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8114.16 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02: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 Subject: [PATCH v2 13/15] ACPI: platform_profile: Check all profile handler to calculate next Date: Sun, 27 Oct 2024 21:01:29 -0500 Message-ID: <20241028020131.8031-14-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F69:EE_|DS7PR12MB5910:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fd22a2c-adca-46ba-9e62-08dcf6f49054 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: 6sw3KkCx1cRngOWQNcg+I0qHJM08XE08Ep6XViSlMq05ICbz1qb5H6k5M/9q+5syauEzVqUf1lwcI7GCK7JKcWUolUOAWU1bL0Uz43dmafM50wzB+D3q93+2g+w9HvqMtqHgbSvAE9OIsy/2SSCbPCRVsf7wQJJkMgLhezO6kq7TrKP4G9SPfm9ys7nntp2pwt6NSx0c97rPeknuqRAJn74ONE70DjhTnY3ztMkRnwFtSnwLZUrM13wQxhUs6lUOaofe5Eciz+lSaR6mqrl/1gcK7HUWXPM9xpqq5e6hyTHHAd05kYti5re/wGB5577lyP7TAR8Rg+LnEko2+uEkMahinIkt2GgCVEPMV6WXYTnJbbhk7YrJPbkaHd2MLaM2RI7V8IMlJF8vWvm/9dgE7COpXWnhpqlilmVd9xyY+fvK6E5D2uV+uO5fwgMWHHVhdPq58x+koi2qYKNKWEnCFNze6wIXyPixJ5M74WsuHdMXbaTgP54dQj+5hY+jkgegnfWqQsNdVH8338qg8esv479RldxhbADy4BRoTF8uMjZJnLZ5AJLEcVIhyCWQ3MCpjPVVEBaQXJET2BvUernUaeIe5bAVNXmRQDVQWVP1LmOXAPxKRw/Tn+Ww5tTIqtwDw/M157TkeukUYEd4buBD1nJDjIf2tue+k55Lsav8m17QwDfkZMAiYTCQeSMJkq0rucScAwcmki40IMfYEt4GvsxKOuT1DpNbXNyCP77Hh6FNREclPfc46gu5vQc0s6nRr57qUe27zyg2PRU/SJ7VLquEXDju0lBDpmtCC2g28NUUeeTG0D/ocDbsT97VVO4Wvm8y5rKLjiaqs+oQU7gJ1IjYlDxf2vlwevyuVctNDMTlAe45bX5hUx+vBPF1b0wZZe+KYwksZY3M9jNs7QpHS4EOdhZWmdG40V3qRbBhXhxAJWPPZ6kRBhWWjvFNTgq2ylJW5wocsWnm4s8fz9RRU+Mmpsdfd4p0+fxMcrZg5QNdZMoBLmA+xGfSmgep9vO/kJG3JnZS7NRH7tLXchE8wbiPV9CFwjzDoHxMXIY4Eq2mew0dfF94qgtumbb57XEaeImhchhy5KSIZH2zTFKwNyJz89yqgigau/563XK3r1vtviM6v0TLxFs2Sb/ufj3Nb3lPTT6FOL5+q215xnq7MfXvGGkvZV0dZZVd2tMFzhRHcIBHIGfoOUsg4pOW0LHp3Zg85POS29pBMZ2qO1IdzOfuPf6ApVhdMEHvHb77mdknQcxACcvA5VM44r5yY002qm0AJrt04uClT9efD5Sul+KecDGCDc2VaOvKIEgDLACfDYfku7neZwd8fPmomTNdXjoFRVyFwhT+RVVAbWMz2fvKewSARvsv8dIb9ct2QLlzagBCBqjXylYuSYKwsBTJK96HUW16QK+qP58WFlmi4g== 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)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:23.3060 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6fd22a2c-adca-46ba-9e62-08dcf6f49054 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: BL02EPF00021F69.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5910 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. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello --- drivers/acpi/platform_profile.c | 52 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index d22c4eb5f0c36..e6ea5b600e2af 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -196,40 +196,42 @@ 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; - err = mutex_lock_interruptible(&profile_lock); - if (err) - return err; - - if (!cur_profile) { - mutex_unlock(&profile_lock); - return -ENODEV; - } + scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &profile_lock) { + err = platform_profile_get_active(&profile); + if (err) + return err; - err = cur_profile->profile_get(cur_profile, &profile); - if (err) { - mutex_unlock(&profile_lock); - return err; - } + choices = platform_profile_get_choices(); - next = find_next_bit_wrap(cur_profile->choices, PLATFORM_PROFILE_LAST, - profile + 1); + next = find_next_bit_wrap(&choices, + PLATFORM_PROFILE_LAST, + profile + 1); - if (WARN_ON(next == PLATFORM_PROFILE_LAST)) { - mutex_unlock(&profile_lock); - return -EINVAL; + 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); + } + } } - err = cur_profile->profile_set(cur_profile, next); - mutex_unlock(&profile_lock); - - if (!err) - sysfs_notify(acpi_kobj, NULL, "platform_profile"); + sysfs_notify(acpi_kobj, NULL, "platform_profile"); - return err; + return 0; } EXPORT_SYMBOL_GPL(platform_profile_cycle); From patchwork Mon Oct 28 02:01:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13852804 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060.outbound.protection.outlook.com [40.107.244.60]) (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 18F5418E758; Mon, 28 Oct 2024 02:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080952; cv=fail; b=fc+gVnsxwYX4JTNlQyRNBMf7hcOOrT/mJReDcdM4Kka1HM3qYEUN4A3mx/7aUrxOtYK6lGI2jWN8k3uQhLhtTZZc++iJSeEK1wKT4iWqbWMFXcgMfaC8RNO5W3Hj08gkczZirK78zFk6XB+WExiSf7CR1JJl/ledCocgSs8aQxw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080952; c=relaxed/simple; bh=fjLVtWLvjdxjEjtwy83jVOC5p2fUEmI3179W2pZoPGc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SSJYVc0l/lVJJDaEsuwILsERCnVL/hxXIIya6vMyZg3u8GiJ6Lplnzc4FiKkrugP2XDbUviSAar4W0WvEibBWkNHXciz0rR0kZCVwEijQQ/4cDSSk/l/Qt4U3itml7KRVjOGWjbetS/voEOX2E1x2vco+pzBP+pSJ/wWlUbxKZk= 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=0fJo4wXb; arc=fail smtp.client-ip=40.107.244.60 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="0fJo4wXb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S65MwHl1nEp07l4eGKo5eD0oO40R064Ekvujb1fm8iaPB/lEa/6WnxdGp7IMYXCLPgCz2pXWtDg7V2ZdCTuE4EC5w8+l985tMVr1ZMFo/FKPfKzdr4OcsArWjsevbEiaVWxztDj8DfrOb3gQWn8gFlkkQKDDnH/C6foqqds6G61zm4IaJ/FJ/e3LL54Tw+719du9EhzGCCwjmzczEz2AAx3ShahNJ07BT2D67EPPNiMGnjYcip0kcZ2EGF/EEJ8QBGMSX//QvCIrVMEOiC3luO+uXbE2Zdt7bqeZffdbKCTw5k+Zx6Ap/PGaAtplEOAv48t+juzANqEAP5AmF8cC1A== 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=TfRMK+/cK1f36OYEo4S6/Q9As/pXGudvLftjTZfY9GU=; b=hqPAQMwrGJ31C1l5PwYNr9KXrQHzlAZiDAqXKIZVuLQH/ia6P6NNoMlgH6hoG0U5dkaF8AawEzEoAi+ikaPpSta6aX5D4KQIPcFcR1LP6bTQ9Ef4pEVWxzmVyPjNnIhvDsRtFrctUv7C22KQSwkZ6Iy1nUZiOQ2L+n2Kp9lkZ3z0A+OKRnJ3KmmdpR0WPDeL6X8dteH//M04AGZOSi5azBYiocuQgxsSLDDfStH5gEg8qr3D1WOjZRDWZ7DPjQ3rvcLCXHgipNmJi+NyTJdfcYFFAvrOg1KrlzBY0JkJDBbgUjBk4TKo7U2FAxZGTZrqhV+dbsK5MtuijHrdgYV+gg== 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=TfRMK+/cK1f36OYEo4S6/Q9As/pXGudvLftjTZfY9GU=; b=0fJo4wXbWLLWuMxu8cJ28kniZ/XAooyeKufId5T159qbgA7B5XFZcb59IR1gCDGEglcZjei12gazC3WxpB5gW/RffqdmqiB0m+y/CbyTexN2rCljINKUsZvRyOaGuedjAy1WuU/E8fe5mtJbj5v/H4IcJt2qNfe90fZQcGaLuH8= Received: from BL1P223CA0005.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::10) by CH3PR12MB9431.namprd12.prod.outlook.com (2603:10b6:610:1c1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.24; Mon, 28 Oct 2024 02:02:26 +0000 Received: from BL02EPF00021F6C.namprd02.prod.outlook.com (2603:10b6:208:2c4:cafe::fe) by BL1P223CA0005.outlook.office365.com (2603:10b6:208:2c4::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:02: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 BL02EPF00021F6C.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02: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 v2 14/15] ACPI: platform_profile: Allow multiple handlers Date: Sun, 27 Oct 2024 21:01:30 -0500 Message-ID: <20241028020131.8031-15-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6C:EE_|CH3PR12MB9431:EE_ X-MS-Office365-Filtering-Correlation-Id: d77a7ae3-b86e-473e-6e48-08dcf6f491f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: HiKr5eAfJE4p5AXOPEGqAluWlgMxjSRSxtA+bRWQrsf7fEmSDgU/G7Xn9UeaTh/FJOFIw03EXQ/ZUJSgRxQCiRjrbXf9vEPL9j/EqgqcilFOZbM1TX5WpeumV4tA+A/vEdJBa3WqXPe261XaBnssA93xVHHzCem4NlpMVgkMOE7uLW0tiJs6rWVqRsQupok9hLrgxARY0XyyAse75liKWc3CABXfjm7a0/2wquF8GDolICQQduDgbonMcLmlW1vNleAEFzj4a32n9I1Gt7gQn3P4cZaB7V3rWomfmTBih2l1yz7qnP5a95/zBOwrP6bVgf5dkZv14G+MXO8z9KjtXq9VszJde11ZGETJO/lWGEifDtBXM8piSBlbu7wQYAAbgltIapEeyEniLq6lac8R7niq09d/J7RoEtuyjXU9FSQm10cXj5W0+YNZdgJZXdCSVbripfdGWrEbqPt6Th8b5YwFfpuASq55S1qlKPorVYWhj1smrivOcWLIuXcvffECBYVnLFI4LVxCI6+HXhfXszKjAPGwU2sMtOzFsTlLtxhKdQrRvx3ZxddcK1nkhicrey+X4l5e3fmssawY7BwBI8gmnJWsBRQKt4gHmtZGlvaA7QsVQeX1lf1JIXwtCiAx9bm+ATDzYXo/eOanuKb9/5Lo7JgZ6Kibsj8+b/v+sMDVFM5yqQWotZtKP1H7Utdjq7Ohm3Yl9JOGeF0qhpHvaRDd8HkIAhKVu7iWSqWndAVUkTfI7Oj4Md22rlZKB9KVvygnpnvd/fKhz2jEEh6+5qceimuFZzZ7GNVsDUV/i69oZ4OktKb1cp1YMcbtJFDuuejkhFIjKxfWMo0xzg8OzBkQMIYFAwLAVbsZ6z66Iv10wdHf/5rcNvkhPPuRsBwwfhmeDvoJQQOtu9Fn28poT8V7761jiQ2Lgus4wFZg1DscdSX0Yo//CrQiEpeJZLWYpgkqRUb4xGicxGEDaryJ2QmO6jq3jbUDhHFJKDBXirbB7zrLK4PP9U+Ezur2N4tg/cbClaTUHDKfgzlNSxgPlQJ8BKZrJg9ewScyCWp1un3EzcaAdj2VdtWZ8rxxEsoL2XuaKL55iZNPt0hfPT0zTNIgan9uC1RsMufi3VwfmXpSvyo6J2PQDOD8hbgRz3wHBqAmUMfcKNxR6Vb5h6WRpn/3LWoTI2L1rBgoKVSIFe13RGZ523QiKTWUWkE2hTQqFIsLTtuSgbifawTefsWx5Ar/kln4mdds+wW9ZYRj7+M9e3QDLJUJKvKCHFyAWf7A6SQSsbVTMtSWYUyF4kbyG2vwRbfP4kplBE7hstXh3bZkCb4kmBFSlwMri0X1Vc3KXIx/YyFu2N1yDivegMuWE8HWvfJuKVglxfp4gHSlLy7DEaJ0Pnj62GObGy0FTESKGvXGBW6KFAcweLF6xD/8Rw== 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)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Oct 2024 02:02:26.0376 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d77a7ae3-b86e-473e-6e48-08dcf6f491f5 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: BL02EPF00021F6C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9431 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 --- drivers/acpi/platform_profile.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index e6ea5b600e2af..2794a8f686200 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); @@ -188,7 +187,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"); } @@ -251,17 +251,15 @@ 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; - err = sysfs_create_group(acpi_kobj, &platform_profile_group); - if (err) - return err; + if (!platform_profile_is_registered()) { + err = sysfs_create_group(acpi_kobj, &platform_profile_group); + if (err) + return err; + } list_add_tail(&pprof->list, &platform_profile_handler_list); sysfs_notify(acpi_kobj, NULL, "platform_profile"); - cur_profile = pprof; return 0; } EXPORT_SYMBOL_GPL(platform_profile_register); @@ -272,9 +270,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 Mon Oct 28 02:01: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: 13852805 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2056.outbound.protection.outlook.com [40.107.243.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 7968E18F2DB; Mon, 28 Oct 2024 02:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080956; cv=fail; b=kNdnwis7SDGEIzZsBb0PnQU1BV0NYKaMPchfCPtVpVlnWn3sHrKi8jucXwdj111UfEihnvh5AF34EQITulWqDAxNcoFjLkdTiTGraVzAHkHt3CBwLggx0dAkjoZbEMvd6CRDhRfiHAofcTMz6/1Enr6jEtfRp/uzl7GktiBPfqU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730080956; c=relaxed/simple; bh=l1NpPYbI1izrOBXlWSw8t//ZEymsa2FMxrONvbtd7M0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VS1+RGHFsUUyz01KBy6kjAudK3VrkIfJx9ubobQZF/0Gy+91RfqWgRtRfBV78170YBdxE5Dg1bMCzaa9FBAz/gJdX2i6oISMmyyEhd1wz08VD35h/76h7PmbxdukXj0ufxXzvb39PUcRYG1Tqc3HWZJOoDwzJ0hVY8Efun3rjDI= 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=wPP0NMi8; arc=fail smtp.client-ip=40.107.243.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="wPP0NMi8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=r0qnn14ul8J32WgWruz2ypJxaRIVd9FhKJIc4uf6jd+pHyBAXlEY27rjy06+RpAI5BrwbnP8yj3FyzrXMNJMHp9VDB5o9CKhIhrvdpNAYgzVqwGjH1kf0QuSZQzgaNtRLapKA93SIyugpfGPbgY2o76AbUcAJEkXDQ6sf5v4yWuFmvFeZ8luKw5387L1iG9qSHnDFHxTnY9KQjdiYYVvGJwqYtHOxz6AozpQcVgZHsDB46/pwficttcfSwOQQZWqYv9EPuHKirJQpMYlMV43Ze8iCob7b6SvN40OyjQTbdde7xVawMi8yyYcYA/Jtmvrx9iftFkA8LHeoq1IZgbzoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wULtWbk/f8Xi0zwfoBxp2g6NVV/1PuBYHNNKAVq3ltM=; b=V1jilFHj/JGG4pZoEYSiENInOeZgKiqDg3bTLfampiPwKTkWeOopbCxBavvpoUJPu/N4SNvx58YeZRbXlp1bswkCfwrlnYPSYQUDWK3Ui3k9loPolmL8zsFd9dOUjWHBGAd3cYd3G13Y8HPcijaSn4f3342N+HB8ZjuZ2ahs86nOXduPwUkmyxw1yvZHXCJZAq6CtQC+Kw6RQNFKnPkd/VSDqDdc+mqUZnHni4BsdVOWshO2JUyI+x87ibPAW6/4zOtsRwJFANx6grAGopTG0xO00QMcRYHXD0KDCBsT6x6JYOIWMGjytJkSvgBavNFvvatLPRFB84MtVhzA0/gnQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wULtWbk/f8Xi0zwfoBxp2g6NVV/1PuBYHNNKAVq3ltM=; b=wPP0NMi8Ib0ce+mLK04tpQPmBmM2xpTOEMXza8wPzq+3Z8+dhxtGcb4mvFqCwuqqy7JKKSk+6ITJiqN2xrHZKna1qDkC8UtOyOOTHEDDLt5VpefQwm3j59B4WcXP2f8MJmu0MF4PcIdgk2qIJ1EhDZyfOYiE1ou7Fpre89+K/OU= Received: from BL1P223CA0020.NAMP223.PROD.OUTLOOK.COM (2603:10b6:208:2c4::25) by IA1PR12MB8555.namprd12.prod.outlook.com (2603:10b6:208:44f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Mon, 28 Oct 2024 02:02:28 +0000 Received: from BL02EPF00021F6C.namprd02.prod.outlook.com (2603:10b6:208:2c4:cafe::cc) by BL1P223CA0020.outlook.office365.com (2603:10b6:208:2c4::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25 via Frontend Transport; Mon, 28 Oct 2024 02:02:28 +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 BL02EPF00021F6C.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8093.14 via Frontend Transport; Mon, 28 Oct 2024 02:02: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; Sun, 27 Oct 2024 21:02: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 v2 15/15] platform/x86/amd: pmf: Drop all quirks Date: Sun, 27 Oct 2024 21:01:31 -0500 Message-ID: <20241028020131.8031-16-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241028020131.8031-1-mario.limonciello@amd.com> References: <20241028020131.8031-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00021F6C:EE_|IA1PR12MB8555:EE_ X-MS-Office365-Filtering-Correlation-Id: ea2de315-8ffc-4813-be7f-08dcf6f4938a 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: /QqFh49Hw54u4drJVFxIPflE0xX/QMJ2n/7avV+iY38U31bsMK+daBvfP4T5+0mpSsvCwcsT9qYHDL8AhvnjyjgJA3F3q1SPI9lBXge71azoRydj5twZ+ViCu0Gt1oZBlKNSiEjQrBG8O1RjEoO6rdZmoCT6zMmSoYv+5DPMHyQntlD2uLTYs9O752NYo/7pCgTHgZ8N8kNCPAWEt7wmdcbmSDg1957SJSVxSzGToXDIVrkaPNOtRge8kImQGGTtUraxgF9V+BRmxAaKjYVAAiRHuXsLNk9mNOZrxi6zE7z+cFPODNM1gu9QllbhARnVZGldSvWTcARSw3mqZ+MOsFR/gl22y/QnIla9K/Dm4Mu2E9lJylsXzNA9rYD776KKwq8MRmXOe5lYQa2rQYZMiOxfhGLQCP/YCfhq+4oqMxj8y4ka5I7By5PmFbJVhQqUmLjvO/puoP4h7/S3V8va/cfLhAS7BDn9eC2uL01y5An1Pjc2EP9Nfh/M2Z08fqUp3blr2t5sOiSA42z7R0XgoF4Z+NbR5j3IHkgClVk5BgcrRo3VFWebn3w1oSOifT+HlS2yYk/TqGzThQo9RmyJbQ8CQNBT8kL3yHKCxqcQ6YlSdXhqUQ/P+tZvrk52XR6DBE+uRWzBL6KvylZLS5oQvBTMtNLF9ME+hHI3iAvP6UPPiTIuImzuX/+/mqKYuKDuenlCNt4u1C6nYEEktW+qAqFYjRBe7uJY9TzfIz0i0/r2leuB8qkrcGoCsG3VncjfYIB9tFhnxgaEorOyCZMg1xcAUeZxvJZ2a9FgqLqFd5hS1ZEDH1CWjJFrjP6X1AnAm0vne7E/sWef8P29TgoWavsbKimtaxhYgW1lXmMaCWVuHZLbaSaFpCJ8dgqt9YwPubeoHkwRLJEcKWW4oFAbsTJuCM51Wi+Cp2REiAHp8NMMk03aET35QiwdzGDWglrOXUtbEjlJy1Xzc97f5YXHl348H97Kep1a1bEd/7QuHlrrD1d4dAUPi6o+HpFfqjriyxjLT5KvIMLrA1fBAYxP4lmB1LRC5m30uiVQCTvw3o2tkP+XkMzPoWfxCMwVPEROPrTJh9NFw/9DOdE2csgULwqi6pfgW0ctYlIRxD6sDyKlL8Afg3+HwnUJMVLlwmrUOeISrYJjRPkQOq21z72cJfg8QQgnEaSnfGhFYQabjIPwm+sMImpihDk3uYOIMNGdXgJf7uGwMcXac7zUZTzX/+V9GqU2bOyiYeDp6lczh/Sdqck8Wiu7yISVA2MDYeY8ZyDVyavnU0Kh/sq1nyWoFj0UGuksCoPzMhUPLQydAEgPuX86iwNnnmArS3XRt+c0AAAH7jDdoJJoy6TYQWJr3pR5PlNMDwE7NyUtWyDOhiwnaR/JDc8rP8+BoSa0qiP63B0ce+Ov8gpFSRTVHMU5Ew== 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: 28 Oct 2024 02:02:28.6939 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea2de315-8ffc-4813-be7f-08dcf6f4938a 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: BL02EPF00021F6C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8555 As multiple platform profile handlers can now be registered, the quirks to avoid registering amd-pmf as a handler are no longer necessary. Drop them. Tested-by: Matthew Schwartz Signed-off-by: Mario Limonciello Acked-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/Makefile | 2 +- drivers/platform/x86/amd/pmf/core.c | 1 - drivers/platform/x86/amd/pmf/pmf-quirks.c | 66 ----------------------- drivers/platform/x86/amd/pmf/pmf.h | 3 -- 4 files changed, 1 insertion(+), 71 deletions(-) delete mode 100644 drivers/platform/x86/amd/pmf/pmf-quirks.c diff --git a/drivers/platform/x86/amd/pmf/Makefile b/drivers/platform/x86/amd/pmf/Makefile index 7d6079b02589c..6b26e48ce8ad2 100644 --- a/drivers/platform/x86/amd/pmf/Makefile +++ b/drivers/platform/x86/amd/pmf/Makefile @@ -7,4 +7,4 @@ obj-$(CONFIG_AMD_PMF) += amd-pmf.o amd-pmf-objs := core.o acpi.o sps.o \ auto-mode.o cnqf.o \ - tee-if.o spc.o pmf-quirks.o + tee-if.o spc.o diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index 47126abd13ca0..6ad00b3d472fe 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -455,7 +455,6 @@ static int amd_pmf_probe(struct platform_device *pdev) mutex_init(&dev->lock); mutex_init(&dev->update_mutex); - amd_pmf_quirks_init(dev); apmf_acpi_init(dev); platform_set_drvdata(pdev, dev); amd_pmf_dbgfs_register(dev); diff --git a/drivers/platform/x86/amd/pmf/pmf-quirks.c b/drivers/platform/x86/amd/pmf/pmf-quirks.c deleted file mode 100644 index 7cde5733b9cac..0000000000000 --- a/drivers/platform/x86/amd/pmf/pmf-quirks.c +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * AMD Platform Management Framework Driver Quirks - * - * Copyright (c) 2024, Advanced Micro Devices, Inc. - * All Rights Reserved. - * - * Author: Mario Limonciello - */ - -#include - -#include "pmf.h" - -struct quirk_entry { - u32 supported_func; -}; - -static struct quirk_entry quirk_no_sps_bug = { - .supported_func = 0x4003, -}; - -static const struct dmi_system_id fwbug_list[] = { - { - .ident = "ROG Zephyrus G14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GA403U"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ROG Ally X", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "RC72LA"), - }, - .driver_data = &quirk_no_sps_bug, - }, - { - .ident = "ASUS TUF Gaming A14", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FA401W"), - }, - .driver_data = &quirk_no_sps_bug, - }, - {} -}; - -void amd_pmf_quirks_init(struct amd_pmf_dev *dev) -{ - const struct dmi_system_id *dmi_id; - struct quirk_entry *quirks; - - dmi_id = dmi_first_match(fwbug_list); - if (!dmi_id) - return; - - quirks = dmi_id->driver_data; - if (quirks->supported_func) { - dev->supported_func = quirks->supported_func; - pr_info("Using supported funcs quirk to avoid %s platform firmware bug\n", - dmi_id->ident); - } -} diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 8ce8816da9c16..b89aa38434faa 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -795,7 +795,4 @@ int amd_pmf_smartpc_apply_bios_output(struct amd_pmf_dev *dev, u32 val, u32 preq void amd_pmf_populate_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); void amd_pmf_dump_ta_inputs(struct amd_pmf_dev *dev, struct ta_pmf_enact_table *in); -/* Quirk infrastructure */ -void amd_pmf_quirks_init(struct amd_pmf_dev *dev); - #endif /* PMF_H */