[PATCH v3 4/9] firmware: arm_scmi: Fall back to ACPI HID when "compatible" is absent
Sudeep Holla
sudeep.holla at kernel.org
Thu Aug 13 04:32:59 PDT 2026
scmi_debugfs_common_setup() uses the "compatible" property to
populate the debugfs transport type string. ACPI-described SCMI
devices do not provide that DT property, so the string remains
NULL and debugfs setup falls through the allocation failure path.
Check the property lookup result and use the ACPI HID as the
fallback transport type when an ACPI companion is present.
All supported DT SCMI platforms are expected to provide "compatible",
so the non-ACPI fallback is not needed for normal DT operation. Keep
the explicit "unknown" fallback anyway to avoid passing NULL to
kstrdup() if that assumption is ever violated.
Signed-off-by: Sudeep Holla <sudeep.holla at kernel.org>
---
drivers/firmware/arm_scmi/driver.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 9014723e0f7f..9ad827c6a9ab 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -16,6 +16,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/acpi.h>
#include <linux/bitmap.h>
#include <linux/cleanup.h>
#include <linux/debugfs.h>
@@ -3063,6 +3064,15 @@ static void scmi_debugfs_common_cleanup(void *d)
kfree(dbg->type);
}
+static const char *scmi_acpi_device_hid(struct acpi_device *adev)
+{
+#ifdef CONFIG_ACPI
+ return adev ? acpi_device_hid(adev) : "unknown";
+#else
+ return "unknown";
+#endif
+}
+
static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
{
char top_dir[16];
@@ -3080,8 +3090,10 @@ static struct scmi_debug_info *scmi_debugfs_common_setup(struct scmi_info *info)
return NULL;
}
- fwnode_property_read_string(dev_fwnode(info->dev), "compatible",
- &c_ptr);
+ if (fwnode_property_read_string(dev_fwnode(info->dev), "compatible",
+ &c_ptr))
+ c_ptr = scmi_acpi_device_hid(ACPI_COMPANION(info->dev));
+
dbg->type = kstrdup(c_ptr, GFP_KERNEL);
if (!dbg->type) {
kfree(dbg->name);
--
2.43.0
More information about the linux-arm-kernel
mailing list