public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ACPI: bus: Use OF match data for PRP0001 matched devices
@ 2026-01-09  9:53 Kartik Rajput
  2026-01-09 10:13 ` Mika Westerberg
  0 siblings, 1 reply; 10+ messages in thread
From: Kartik Rajput @ 2026-01-09  9:53 UTC (permalink / raw)
  To: lenb, sakari.ailus, mika.westerberg, andriy.shevchenko,
	thierry.reding, jonathanh, linux-acpi, linux-kernel
  Cc: Kartik Rajput

During pre-production development, drivers may provide both ACPI and OF
match tables while a formal ACPI HID for the device is not yet
allocated. Such devices are enumerated via PRP0001. In this case,
acpi_device_get_match_data() consults only the driver’s ACPI match table
and returns NULL, even though the device was successfully matched via
PRP0001.

This behavior also risks breaking existing PRP0001 setups if a driver
later gains an ACPI HID, as the presence of an ACPI match table changes
the match-data lookup path.

Explicitly detect PRP0001 and fetch match data from the driver's
OF match table via acpi_of_device_get_match_data().

Signed-off-by: Kartik Rajput <kkartik@nvidia.com>
---
Changes in v3:
        * Swap arguments while comparing HID against PRP0001.
        * Check value of adev against NULL.
        * Declare variables in reversed xmas tree order.
        * Update commit message.
Changes in v2:
        * Fix build errors.
---
 drivers/acpi/bus.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 5e110badac7b..e960df2fcea7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1030,9 +1030,13 @@ static const void *acpi_of_device_get_match_data(const struct device *dev)
 const void *acpi_device_get_match_data(const struct device *dev)
 {
 	const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table;
+	struct acpi_device *adev = ACPI_COMPANION(dev);
 	const struct acpi_device_id *match;
 
-	if (!acpi_ids)
+	if (!adev)
+		return NULL;
+
+	if (!strcmp(acpi_device_hid(adev), ACPI_DT_NAMESPACE_HID))
 		return acpi_of_device_get_match_data(dev);
 
 	match = acpi_match_device(acpi_ids, dev);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-01-12  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-09  9:53 [PATCH v3] ACPI: bus: Use OF match data for PRP0001 matched devices Kartik Rajput
2026-01-09 10:13 ` Mika Westerberg
2026-01-09 11:05   ` Andy Shevchenko
2026-01-09 11:29     ` Sakari Ailus
2026-01-09 17:02       ` Andy Shevchenko
2026-01-09 21:11         ` Rafael J. Wysocki
2026-01-11 22:01           ` Sakari Ailus
2026-01-12  8:42             ` Kartik Rajput
2026-01-12  8:55               ` Andy Shevchenko
2026-01-12  9:11                 ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox