[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48085de5.7dd.1823802f2c1.Coremail.windhl@126.com>
Date: Tue, 26 Jul 2022 08:58:13 +0800 (CST)
From: "Liang He" <windhl@....com>
To: "Martin Blumenstingl" <martin.blumenstingl@...glemail.com>
Cc: "Neil Armstrong" <narmstrong@...libre.com>, khilman@...libre.com,
jbrunet@...libre.com, inux-amlogic@...ts.infradead.org,
linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re:Re: [PATCH] soc: amlogic: meson-pwrc: Hold reference returned by
of_get_parent()
At 2022-07-26 03:46:30, "Martin Blumenstingl" <martin.blumenstingl@...glemail.com> wrote:
>Hello,
>
>thank you for your patch!
>
>On Tue, Jul 5, 2022 at 4:20 AM Liang He <windhl@....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
Powered by blists - more mailing lists