* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
[not found] <20220705022032.281665-1-windhl@126.com>
2022-07-05 7:22 ` Neil Armstrong
@ 2022-07-05 7:22 ` Neil Armstrong
1 sibling, 0 replies; 15+ messages in thread
From: Neil Armstrong @ 2022-07-05 7:22 UTC (permalink / raw)
To: Liang He, khilman, jbrunet, martin.blumenstingl, inux-amlogic
Cc: open list:ARM/Amlogic Meson..., linux-arm-kernel, linux-kernel
+ linux-amlogic, linux-arm-kernel, linux-kernel
On 05/07/2022 04:20, Liang He wrote:
> We should hold the reference returned by of_get_parent() and use
> it to call of_node_put() for refcount balance.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/soc/amlogic/meson-ee-pwrc.c | 5 ++++-
> drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 5 ++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
> index 2be3afe6c2e3..872ab8ba90bc 100644
> --- a/drivers/soc/amlogic/meson-ee-pwrc.c
> +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
> @@ -470,6 +470,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
> const struct meson_ee_pwrc_domain_data *match;
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_ee_pwrc *pwrc;
> + struct device_node *np;
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_hhi)) {
> dev_err(&pdev->dev, "failed to get HHI regmap\n");
> return PTR_ERR(regmap_hhi);
> diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> index b4615b288625..75a4e1cec416 100644
> --- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> +++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> @@ -274,6 +274,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_gx_pwrc_vpu *vpu_pd;
> struct reset_control *rstc;
> + struct device_node *np;
> struct clk *vpu_clk;
> struct clk *vapb_clk;
> bool powered_off;
> @@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
>
> memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd));
>
> - regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_ao = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_ao)) {
> dev_err(&pdev->dev, "failed to get regmap\n");
> return PTR_ERR(regmap_ao);
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-05 7:22 ` Neil Armstrong
0 siblings, 0 replies; 15+ messages in thread
From: Neil Armstrong @ 2022-07-05 7:22 UTC (permalink / raw)
To: Liang He, khilman, jbrunet, martin.blumenstingl, inux-amlogic
Cc: open list:ARM/Amlogic Meson..., linux-arm-kernel, linux-kernel
+ linux-amlogic, linux-arm-kernel, linux-kernel
On 05/07/2022 04:20, Liang He wrote:
> We should hold the reference returned by of_get_parent() and use
> it to call of_node_put() for refcount balance.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/soc/amlogic/meson-ee-pwrc.c | 5 ++++-
> drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 5 ++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
> index 2be3afe6c2e3..872ab8ba90bc 100644
> --- a/drivers/soc/amlogic/meson-ee-pwrc.c
> +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
> @@ -470,6 +470,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
> const struct meson_ee_pwrc_domain_data *match;
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_ee_pwrc *pwrc;
> + struct device_node *np;
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_hhi)) {
> dev_err(&pdev->dev, "failed to get HHI regmap\n");
> return PTR_ERR(regmap_hhi);
> diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> index b4615b288625..75a4e1cec416 100644
> --- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> +++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> @@ -274,6 +274,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_gx_pwrc_vpu *vpu_pd;
> struct reset_control *rstc;
> + struct device_node *np;
> struct clk *vpu_clk;
> struct clk *vapb_clk;
> bool powered_off;
> @@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
>
> memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd));
>
> - regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_ao = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_ao)) {
> dev_err(&pdev->dev, "failed to get regmap\n");
> return PTR_ERR(regmap_ao);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-05 7:22 ` Neil Armstrong
0 siblings, 0 replies; 15+ messages in thread
From: Neil Armstrong @ 2022-07-05 7:22 UTC (permalink / raw)
To: Liang He, khilman, jbrunet, martin.blumenstingl, inux-amlogic
Cc: open list:ARM/Amlogic Meson..., linux-arm-kernel, linux-kernel
+ linux-amlogic, linux-arm-kernel, linux-kernel
On 05/07/2022 04:20, Liang He wrote:
> We should hold the reference returned by of_get_parent() and use
> it to call of_node_put() for refcount balance.
>
> Signed-off-by: Liang He <windhl@126.com>
> ---
> drivers/soc/amlogic/meson-ee-pwrc.c | 5 ++++-
> drivers/soc/amlogic/meson-gx-pwrc-vpu.c | 5 ++++-
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soc/amlogic/meson-ee-pwrc.c b/drivers/soc/amlogic/meson-ee-pwrc.c
> index 2be3afe6c2e3..872ab8ba90bc 100644
> --- a/drivers/soc/amlogic/meson-ee-pwrc.c
> +++ b/drivers/soc/amlogic/meson-ee-pwrc.c
> @@ -470,6 +470,7 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
> const struct meson_ee_pwrc_domain_data *match;
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_ee_pwrc *pwrc;
> + struct device_node *np;
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_hhi)) {
> dev_err(&pdev->dev, "failed to get HHI regmap\n");
> return PTR_ERR(regmap_hhi);
> diff --git a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> index b4615b288625..75a4e1cec416 100644
> --- a/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> +++ b/drivers/soc/amlogic/meson-gx-pwrc-vpu.c
> @@ -274,6 +274,7 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
> struct regmap *regmap_ao, *regmap_hhi;
> struct meson_gx_pwrc_vpu *vpu_pd;
> struct reset_control *rstc;
> + struct device_node *np;
> struct clk *vpu_clk;
> struct clk *vapb_clk;
> bool powered_off;
> @@ -291,7 +292,9 @@ static int meson_gx_pwrc_vpu_probe(struct platform_device *pdev)
>
> memcpy(vpu_pd, vpu_pd_match, sizeof(*vpu_pd));
>
> - regmap_ao = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_ao = syscon_node_to_regmap(np);
> + of_node_put(np);
> if (IS_ERR(regmap_ao)) {
> dev_err(&pdev->dev, "failed to get regmap\n");
> return PTR_ERR(regmap_ao);
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
[not found] <20220705022032.281665-1-windhl@126.com>
2022-07-05 7:22 ` Neil Armstrong
@ 2022-07-25 19:46 ` Martin Blumenstingl
1 sibling, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-25 19:46 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hello,
thank you for your patch!
On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
[...]
> + struct device_node *np;
>
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
This works but I had to read the code twice because I thought the
wrong struct device_node was used.
Other drivers typically use "np" for whatever the code section
currently refers to. In this case the code section is about the power
controller, so I thought that "np" was the same as
"pdev->dev.of_node".
I think the code would be easier to understand and the likelihood of
someone making the same mistake as I did if you could rename "np" to
"parent_np" (just like you have done in your other patches).
[...]
> + struct device_node *np;
same as above, I suggest renaming this to parent_np.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-25 19:46 ` Martin Blumenstingl
0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-25 19:46 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hello,
thank you for your patch!
On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
[...]
> + struct device_node *np;
>
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
This works but I had to read the code twice because I thought the
wrong struct device_node was used.
Other drivers typically use "np" for whatever the code section
currently refers to. In this case the code section is about the power
controller, so I thought that "np" was the same as
"pdev->dev.of_node".
I think the code would be easier to understand and the likelihood of
someone making the same mistake as I did if you could rename "np" to
"parent_np" (just like you have done in your other patches).
[...]
> + struct device_node *np;
same as above, I suggest renaming this to parent_np.
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-25 19:46 ` Martin Blumenstingl
0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-25 19:46 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hello,
thank you for your patch!
On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
[...]
> + struct device_node *np;
>
> int i, ret;
>
> match = of_device_get_match_data(&pdev->dev);
> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>
> pwrc->xlate.num_domains = match->count;
>
> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
> + np = of_get_parent(pdev->dev.of_node);
> + regmap_hhi = syscon_node_to_regmap(np);
This works but I had to read the code twice because I thought the
wrong struct device_node was used.
Other drivers typically use "np" for whatever the code section
currently refers to. In this case the code section is about the power
controller, so I thought that "np" was the same as
"pdev->dev.of_node".
I think the code would be easier to understand and the likelihood of
someone making the same mistake as I did if you could rename "np" to
"parent_np" (just like you have done in your other patches).
[...]
> + struct device_node *np;
same as above, I suggest renaming this to parent_np.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
2022-07-25 19:46 ` Martin Blumenstingl
(?)
@ 2022-07-26 0:58 ` Liang He
-1 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 0:58 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Thanks, I will send a new verison soon.
Liang
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 0:58 ` Liang He
0 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 0:58 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Thanks, I will send a new verison soon.
Liang
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 0:58 ` Liang He
0 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 0:58 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Thanks, I will send a new verison soon.
Liang
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
2022-07-25 19:46 ` Martin Blumenstingl
(?)
@ 2022-07-26 1:17 ` Liang He
-1 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 1:17 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Hi, Martin,
I notice the declarations keep the reverse Christmas tree order,
should I keep that order as the 'parent_np' will become longer than 'np'.
Thanks,
Liang
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 1:17 ` Liang He
0 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 1:17 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Hi, Martin,
I notice the declarations keep the reverse Christmas tree order,
should I keep that order as the 'parent_np' will become longer than 'np'.
Thanks,
Liang
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 1:17 ` Liang He
0 siblings, 0 replies; 15+ messages in thread
From: Liang He @ 2022-07-26 1:17 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@googlemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@126.com> wrote:
>[...]
>> + struct device_node *np;
>>
>> int i, ret;
>>
>> match = of_device_get_match_data(&pdev->dev);
>> @@ -495,7 +496,9 @@ static int meson_ee_pwrc_probe(struct platform_device *pdev)
>>
>> pwrc->xlate.num_domains = match->count;
>>
>> - regmap_hhi = syscon_node_to_regmap(of_get_parent(pdev->dev.of_node));
>> + np = of_get_parent(pdev->dev.of_node);
>> + regmap_hhi = syscon_node_to_regmap(np);
>This works but I had to read the code twice because I thought the
>wrong struct device_node was used.
>Other drivers typically use "np" for whatever the code section
>currently refers to. In this case the code section is about the power
>controller, so I thought that "np" was the same as
>"pdev->dev.of_node".
>
>I think the code would be easier to understand and the likelihood of
>someone making the same mistake as I did if you could rename "np" to
>"parent_np" (just like you have done in your other patches).
>
>[...]
>> + struct device_node *np;
>same as above, I suggest renaming this to parent_np.
Hi, Martin,
I notice the declarations keep the reverse Christmas tree order,
should I keep that order as the 'parent_np' will become longer than 'np'.
Thanks,
Liang
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
2022-07-26 1:17 ` Liang He
(?)
@ 2022-07-26 5:18 ` Martin Blumenstingl
-1 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-26 5:18 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Liang,
On Tue, Jul 26, 2022 at 3:18 AM Liang He <windhl@126.com> wrote:
[...]
> I notice the declarations keep the reverse Christmas tree order,
> should I keep that order as the 'parent_np' will become longer than 'np'.
Good catch!
Personally I would move parent_np up (above pwrc) to keep the reverse
Christmas tree ordering, even for new variables.
Best regards,
Martin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 5:18 ` Martin Blumenstingl
0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-26 5:18 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Liang,
On Tue, Jul 26, 2022 at 3:18 AM Liang He <windhl@126.com> wrote:
[...]
> I notice the declarations keep the reverse Christmas tree order,
> should I keep that order as the 'parent_np' will become longer than 'np'.
Good catch!
Personally I would move parent_np up (above pwrc) to keep the reverse
Christmas tree ordering, even for new variables.
Best regards,
Martin
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent()
@ 2022-07-26 5:18 ` Martin Blumenstingl
0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2022-07-26 5:18 UTC (permalink / raw)
To: Liang He
Cc: Neil Armstrong, khilman, jbrunet, inux-amlogic, linux-amlogic,
linux-arm-kernel, linux-kernel
Hi Liang,
On Tue, Jul 26, 2022 at 3:18 AM Liang He <windhl@126.com> wrote:
[...]
> I notice the declarations keep the reverse Christmas tree order,
> should I keep that order as the 'parent_np' will become longer than 'np'.
Good catch!
Personally I would move parent_np up (above pwrc) to keep the reverse
Christmas tree ordering, even for new variables.
Best regards,
Martin
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2022-07-26 5:19 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20220705022032.281665-1-windhl@126.com>
2022-07-05 7:22 ` [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by of_get_parent() Neil Armstrong
2022-07-05 7:22 ` Neil Armstrong
2022-07-05 7:22 ` Neil Armstrong
2022-07-25 19:46 ` Martin Blumenstingl
2022-07-25 19:46 ` Martin Blumenstingl
2022-07-25 19:46 ` Martin Blumenstingl
2022-07-26 0:58 ` Liang He
2022-07-26 0:58 ` Liang He
2022-07-26 0:58 ` Liang He
2022-07-26 1:17 ` Liang He
2022-07-26 1:17 ` Liang He
2022-07-26 1:17 ` Liang He
2022-07-26 5:18 ` Martin Blumenstingl
2022-07-26 5:18 ` Martin Blumenstingl
2022-07-26 5:18 ` Martin Blumenstingl
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.