From: Greg KH <gregkh@linuxfoundation.org>
To: "guojinhui.liam" <guojinhui.liam@bytedance.com>
Cc: rafael@kernel.org, lenb@kernel.org, lizefan.x@bytedance.com,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] driver core: platform: set numa_node before platform_add_device()
Date: Tue, 12 Sep 2023 10:11:49 +0200 [thread overview]
Message-ID: <2023091258-matrix-imitation-cc70@gregkh> (raw)
In-Reply-To: <20230912070900.1862-1-guojinhui.liam@bytedance.com>
On Tue, Sep 12, 2023 at 03:09:00PM +0800, guojinhui.liam wrote:
> platform_add_device creates numa_node attribute of sysfs according to
> whether dev_to_node(dev) is equal to NUMA_NO_NODE. So set the numa node
> of the device before creating numa_node attribute of sysfs.
Why? What will this allow to happen differently? What is broken with
the current code?
> Fixes: 4a60406d3592 ("driver core: platform: expose numa_node to users in sysfs")
> Signed-off-by: guojinhui.liam <guojinhui.liam@bytedance.com>
Please use your name here, and not your email alias, as the first part
of the signed-off-by line.
And also, please fix up your email client to have the correct name as
well.
> ---
> drivers/acpi/acpi_platform.c | 4 +---
> drivers/base/platform.c | 4 ++++
> 2 files changed, 5 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..355abf91930a 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -808,6 +808,7 @@ struct platform_device *platform_device_register_full(
> {
> int ret;
> struct platform_device *pdev;
> + struct acpi_device *adev = to_acpi_device_node(pdevinfo->fwnode);
>
> pdev = platform_device_alloc(pdevinfo->name, pdevinfo->id);
> if (!pdev)
> @@ -841,6 +842,9 @@ struct platform_device *platform_device_register_full(
> goto err;
> }
>
> + if (adev)
> + set_dev_node(&pdev->dev, acpi_get_node(adev->handle));
Are you sure that this platform code can always call acpi functions?
thanks,
greg k-h
next prev parent reply other threads:[~2023-09-12 8:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 7:09 [PATCH] driver core: platform: set numa_node before platform_add_device() guojinhui.liam
2023-09-12 8:11 ` Greg KH [this message]
2023-09-13 3:02 ` guojinhui
2023-09-12 16:11 ` kernel test robot
2023-09-13 10:52 ` kernel test robot
2023-09-13 11:46 ` Jinhui Guo
2023-09-13 15:14 ` Nick Desaulniers
-- strict thread matches above, loose matches on Subject: below --
2023-09-18 10:30 [PATCH v5] " Rafael J. Wysocki
2023-09-18 12:41 ` [PATCH] " Jinhui Guo
2023-09-18 15:09 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023091258-matrix-imitation-cc70@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=guojinhui.liam@bytedance.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox