mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mario Limonciello <mario.limonciello@amd.com>
To: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: "open list:AMD HETERO CORE HARDWARE FEEDBACK DRIVER"
	<platform-driver-x86@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH 3/3] platform/x86/amd: hfi: Rely on ACPI enumeration instead of a dummy device
Date: Mon, 21 Sep 2026 12:04:11 -0500	[thread overview]
Message-ID: <20260921170411.1149960-4-mario.limonciello@amd.com> (raw)
In-Reply-To: <20260921170411.1149960-1-mario.limonciello@amd.com>

amd_hfi_init() manually registers a platform device with
platform_device_register_simple() before registering the driver.  This
device has no ACPI companion, so when amd_hfi_probe() runs for it the
acpi_match_device() check fails and probe returns -ENODEV.

The driver already advertises an ACPI match table, so the ACPI subsystem
enumerates the real AMDI0104 device and binds it to the driver.  The
manually created device therefore serves no purpose: it never binds and
lingers as an unbound platform device, wasting memory and cluttering the
device tree.

Drop the manual platform_device_register_simple() and the device that
tracked it, and rely solely on ACPI enumeration.  The CPU feature gating
in amd_hfi_init() is retained so the driver is only registered on
supported hardware.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/platform/x86/amd/hfi/hfi.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c
index 6d1d3b6c28a97..a923345dd1cf6 100644
--- a/drivers/platform/x86/amd/hfi/hfi.c
+++ b/drivers/platform/x86/amd/hfi/hfi.c
@@ -39,8 +39,6 @@
 
 #define AMD_HETERO_CPUID_27	0x80000027
 
-static struct platform_device *device;
-
 /**
  * struct amd_shmem_info - Shared memory table for AMD HFI
  *
@@ -540,12 +538,6 @@ static int __init amd_hfi_init(void)
 	    !cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS))
 		return -ENODEV;
 
-	device = platform_device_register_simple(AMD_HFI_DRIVER, -1, NULL, 0);
-	if (IS_ERR(device)) {
-		pr_err("unable to register HFI platform device\n");
-		return PTR_ERR(device);
-	}
-
 	ret = platform_driver_register(&amd_hfi_driver);
 	if (ret)
 		pr_err("failed to register HFI driver\n");
@@ -556,7 +548,6 @@ static int __init amd_hfi_init(void)
 static __exit void amd_hfi_exit(void)
 {
 	platform_driver_unregister(&amd_hfi_driver);
-	platform_device_unregister(device);
 }
 module_init(amd_hfi_init);
 module_exit(amd_hfi_exit);
-- 
2.55.0


  parent reply	other threads:[~2026-09-21 17:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 17:04 [PATCH 0/3] Fix a few Sashiko flagged issues on AMD_HFI Mario Limonciello
2026-09-21 17:04 ` [PATCH 1/3] platform/x86/amd: hfi: Fix a use-after-free when unloading the driver Mario Limonciello
2026-09-21 17:26   ` Mario Limonciello
2026-09-21 17:04 ` [PATCH 2/3] platform/x86/amd: hfi: Fix out-of-bounds reads when parsing ranking data Mario Limonciello
2026-09-21 17:27   ` Mario Limonciello
2026-09-21 17:04 ` Mario Limonciello [this message]
2026-09-21 17:27   ` [PATCH 3/3] platform/x86/amd: hfi: Rely on ACPI enumeration instead of a dummy device Mario Limonciello
2026-09-21 17:10 ` [PATCH 0/3] Fix a few Sashiko flagged issues on AMD_HFI Ilpo Järvinen
2026-09-21 17:13   ` Mario Limonciello
2026-09-21 17:22     ` Ilpo Järvinen
2026-09-21 17:26       ` Mario Limonciello
2026-10-12 15:54 ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260921170411.1149960-4-mario.limonciello@amd.com \
    --to=mario.limonciello@amd.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®