[PATCH v3 4/9] firmware: arm_scmi: Fall back to ACPI HID when "compatible" is absent

Jonathan Cameron jonathan.cameron at oss.qualcomm.com
Mon Aug 24 10:43:37 PDT 2026


On Thu, 13 Aug 2026 12:32:59 +0100
Sudeep Holla <sudeep.holla at kernel.org> wrote:

> 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>
Can drop some complexity in here and rely on the stubs in acpi.h a little more.

> ---
>  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

Hmm. Ugly that acpi_device_id returns an empty string.

However given when !CONFIG_ACPI the stub for ACPI_COMPANION(dev) is
NULL.  You don't need this dance anyway.

> +	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);
> 




More information about the linux-arm-kernel mailing list