[PATCH v2 1/4] ACPI/APMT: Use stable device ID

Hanjun Guo guohanjun at huawei.com
Thu Jul 16 18:31:19 PDT 2026


On 2026/7/16 22:56, Robin Murphy wrote:
> The APMT node format includes a unique identifier, so we can use this as
> the platform device ID to give userspace stable and identifiable device
> names, rather than auto numbering dependent on how the table is parsed.
> 
> Cc: Lorenzo Pieralisi <lpieralisi at kernel.org>
> Cc: Hanjun Guo <guohanjun at huawei.com>
> Cc: Sudeep Holla <sudeep.holla at kernel.org>
> Reviewed-by: Ilkka Koskinen <ilkka at os.amperecomputing.com>
> Signed-off-by: Robin Murphy <robin.murphy at arm.com>
> 
> ---
> v2: Handle and warn about unexpected signed overflow
> ---
>   drivers/acpi/arm64/apmt.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/apmt.c b/drivers/acpi/arm64/apmt.c
> index bb010f6164e5..91fcdd289e63 100644
> --- a/drivers/acpi/arm64/apmt.c
> +++ b/drivers/acpi/arm64/apmt.c
> @@ -76,10 +76,12 @@ static int __init apmt_add_platform_device(struct acpi_apmt_node *node,
>   					   struct fwnode_handle *fwnode)
>   {
>   	struct platform_device *pdev;
> -	int ret, count;
> +	int ret, count, uid = node->id & INT_MAX;
>   	struct resource res[DEV_MAX_RESOURCE_COUNT];
>   
> -	pdev = platform_device_alloc(DEV_NAME, PLATFORM_DEVID_AUTO);
> +	if (uid != node->id)
> +		pr_warn("Unexpectedly large UID 0x%x, truncated to 0x%x\n", node->id, uid);
> +	pdev = platform_device_alloc(DEV_NAME, uid);
>   	if (!pdev)
>   		return -ENOMEM;

Reviewed-by: Hanjun Guo <guohanjun at huawei.com>

Thanks
Hanjun




More information about the linux-arm-kernel mailing list