Re: [PATCH v4] driver core: platform: set numa_node before platform_add_device()

From: Greg KH
Date: Thu Sep 14 2023 - 15:29:11 EST


On Thu, Sep 14, 2023 at 11:06:12PM +0800, Jinhui Guo wrote:
> platform_add_device() creates the numa_node attribute of sysfs according
> to whether dev_to_node(dev) is equal to NUMA_NO_NODE. So set the numa node
> of device before creating numa_node attribute of sysfs.
>
> Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs")
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202309122309.mbxAnAIe-lkp@xxxxxxxxx/
> Signed-off-by: Jinhui Guo <guojinhui.liam@xxxxxxxxxxxxx>
> ---
> drivers/acpi/acpi_platform.c | 4 +---
> drivers/base/platform.c | 1 +
> include/linux/acpi.h | 5 +++++
> 3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
> index 48d15dd785f6..adcbfbdc343f 100644
> --- a/drivers/acpi/acpi_platform.c
> +++ b/drivers/acpi/acpi_platform.c
> @@ -178,11 +178,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev,
> 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));
> + else
> dev_dbg(&adev->dev, "created platform device %s\n",
> dev_name(&pdev->dev));
> - }
>
> kfree(resources);
>
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 76bfcba25003..35c891075d95 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -841,6 +841,7 @@ struct platform_device *platform_device_register_full(
> goto err;
> }
>
> + set_dev_node(&pdev->dev, ACPI_NODE_GET(ACPI_COMPANION(&pdev->dev)));
> ret = platform_device_add(pdev);
> if (ret) {
> err:
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index a73246c3c35e..6a349d53f19e 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -477,6 +477,10 @@ static inline int acpi_get_node(acpi_handle handle)
> return 0;
> }
> #endif
> +
> +#define ACPI_NODE_GET(adev) ((adev) && (adev)->handle ? \
> + acpi_get_node((adev)->handle) : NUMA_NO_NODE)
> +
> extern int pnpacpi_disabled;
>
> #define PXM_INVAL (-1)
> @@ -770,6 +774,7 @@ const char *acpi_get_subsystem_id(acpi_handle handle);
> #define ACPI_COMPANION_SET(dev, adev) do { } while (0)
> #define ACPI_HANDLE(dev) (NULL)
> #define ACPI_HANDLE_FWNODE(fwnode) (NULL)
> +#define ACPI_NODE_GET(adev) NUMA_NO_NODE
>
> #include <acpi/acpi_numa.h>
>
> --
> 2.20.1
>

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- This looks like a new version of a previously submitted patch, but you
did not list below the --- line any changes from the previous version.
Please read the section entitled "The canonical patch format" in the
kernel file, Documentation/process/submitting-patches.rst for what
needs to be done here to properly describe this.

- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documetnation/process/stable-kernel-rules.rst file for how to resolve
this.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot