* [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference
@ 2026-03-03 7:06 Binbin Zhou
2026-03-03 7:18 ` Huacai Chen
2026-03-07 10:14 ` Krzysztof Kozlowski
0 siblings, 2 replies; 3+ messages in thread
From: Binbin Zhou @ 2026-03-03 7:06 UTC (permalink / raw)
To: Binbin Zhou, Huacai Chen, Yinbo Zhu, Arnd Bergmann
Cc: Huacai Chen, Xuerui Wang, loongarch, soc, Binbin Zhou
There is already a global of_root reference. Use that instead of getting
one on our own. We don't need to care about the reference count either
this way.
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
---
drivers/soc/loongson/loongson2_guts.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
index 16913c3ef65c..d32ec0748b12 100644
--- a/drivers/soc/loongson/loongson2_guts.c
+++ b/drivers/soc/loongson/loongson2_guts.c
@@ -92,7 +92,7 @@ static u32 loongson2_guts_get_svr(void)
static int loongson2_guts_probe(struct platform_device *pdev)
{
- struct device_node *root, *np = pdev->dev.of_node;
+ struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
const struct loongson2_soc_die_attr *soc_die;
const char *machine;
@@ -109,11 +109,8 @@ static int loongson2_guts_probe(struct platform_device *pdev)
if (IS_ERR(guts->regs))
return PTR_ERR(guts->regs);
- /* Register soc device */
- root = of_find_node_by_path("/");
- if (of_property_read_string(root, "model", &machine))
- of_property_read_string_index(root, "compatible", 0, &machine);
- of_node_put(root);
+ if (of_property_read_string(of_root, "model", &machine))
+ of_property_read_string_index(of_root, "compatible", 0, &machine);
if (machine) {
soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
if (!soc_dev_attr.machine)
base-commit: 862ad12fb14cdad9c647100fbc16f7d8171b4470
--
2.52.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference
2026-03-03 7:06 [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference Binbin Zhou
@ 2026-03-03 7:18 ` Huacai Chen
2026-03-07 10:14 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Huacai Chen @ 2026-03-03 7:18 UTC (permalink / raw)
To: Binbin Zhou
Cc: Binbin Zhou, Huacai Chen, Yinbo Zhu, Arnd Bergmann, Xuerui Wang,
loongarch, soc
On Tue, Mar 3, 2026 at 3:07 PM Binbin Zhou <zhoubinbin@loongson.cn> wrote:
>
> There is already a global of_root reference. Use that instead of getting
> one on our own. We don't need to care about the reference count either
> this way.
>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
> drivers/soc/loongson/loongson2_guts.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
> index 16913c3ef65c..d32ec0748b12 100644
> --- a/drivers/soc/loongson/loongson2_guts.c
> +++ b/drivers/soc/loongson/loongson2_guts.c
> @@ -92,7 +92,7 @@ static u32 loongson2_guts_get_svr(void)
>
> static int loongson2_guts_probe(struct platform_device *pdev)
> {
> - struct device_node *root, *np = pdev->dev.of_node;
> + struct device_node *np = pdev->dev.of_node;
> struct device *dev = &pdev->dev;
> const struct loongson2_soc_die_attr *soc_die;
> const char *machine;
> @@ -109,11 +109,8 @@ static int loongson2_guts_probe(struct platform_device *pdev)
> if (IS_ERR(guts->regs))
> return PTR_ERR(guts->regs);
>
> - /* Register soc device */
> - root = of_find_node_by_path("/");
> - if (of_property_read_string(root, "model", &machine))
> - of_property_read_string_index(root, "compatible", 0, &machine);
> - of_node_put(root);
> + if (of_property_read_string(of_root, "model", &machine))
> + of_property_read_string_index(of_root, "compatible", 0, &machine);
> if (machine) {
> soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
> if (!soc_dev_attr.machine)
>
> base-commit: 862ad12fb14cdad9c647100fbc16f7d8171b4470
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference
2026-03-03 7:06 [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference Binbin Zhou
2026-03-03 7:18 ` Huacai Chen
@ 2026-03-07 10:14 ` Krzysztof Kozlowski
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2026-03-07 10:14 UTC (permalink / raw)
To: Binbin Zhou, Binbin Zhou, Huacai Chen, Yinbo Zhu, Arnd Bergmann
Cc: Huacai Chen, Xuerui Wang, loongarch, soc
On 03/03/2026 08:06, Binbin Zhou wrote:
> There is already a global of_root reference. Use that instead of getting
> one on our own. We don't need to care about the reference count either
> this way.
>
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> ---
Please follow standard defconfig submission rules, so as explained in
maintainer soc profile document: you are not supposed to send patches
soc@ for review.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-07 10:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 7:06 [PATCH] soc: loongson: loongson2_guts: Use of_root instead of own reference Binbin Zhou
2026-03-03 7:18 ` Huacai Chen
2026-03-07 10:14 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox