RE: [PATCH v3] driver core: platform: expose numa_node to users in sysfs

From: Song Bao Hua (Barry Song)
Date: Fri Jul 03 2020 - 01:20:10 EST



>
> However, it is still much more clear and credible to users by exposing the data
> directly from ACPI table.
>

Except ARM64 iort, numa_node is actually also applicable to x86 and other architectures through general
acpi_create_platform_device() API:

drivers/acpi/scan.c:
static void acpi_default_enumeration(struct acpi_device *device)
{
...
if (!device->flags.enumeration_by_parent) {
acpi_create_platform_device(device, NULL);
acpi_device_set_enumerated(device);
}
}

struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
struct property_entry *properties)
{
...

pdev = platform_device_register_full(&pdevinfo);
if (IS_ERR(pdev))
dev_err(&adev->dev, "platform device creation failed: %ld\n",
PTR_ERR(pdev));
else {
set_dev_node(&pdev->dev, acpi_get_node(adev->handle));
dev_dbg(&adev->dev, "created platform device %s\n",
dev_name(&pdev->dev));
}

...

return pdev;
}

> >
> > Thanks,
> > John

Thanks
Barry