[PATCH net-next v2 0/2] net: switch to scoped device_for_each_child_node()

Javier Carrasco posted 2 patches 1 month, 4 weeks ago
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 10 +++-------
drivers/net/mdio/mdio-thunder.c                   |  4 +---
2 files changed, 4 insertions(+), 10 deletions(-)
[PATCH net-next v2 0/2] net: switch to scoped device_for_each_child_node()
Posted by Javier Carrasco 1 month, 4 weeks ago
This series switches from the device_for_each_child_node() macro to its
scoped variant. This makes the code more robust if new early exits are
added to the loops, because there is no need for explicit calls to
fwnode_handle_put(), which also simplifies existing code.

The non-scoped macros to walk over nodes turn error-prone as soon as
the loop contains early exits (break, goto, return), and patches to
fix them show up regularly, sometimes due to new error paths in an
existing loop [1].

Note that the child node is now declared in the macro, and therefore the
explicit declaration is no longer required.

The general functionality should not be affected by this modification.
If functional changes are found, please report them back as errors.

Link:
https://lore.kernel.org/all/20240901160829.709296395@linuxfoundation.org/
[1]

Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
Changes in v2:
- Rebase onto net-next.
- Fix commit messages (incomplete path, missing net-next prefix).
- Link to v1: https://lore.kernel.org/r/20240930-net-device_for_each_child_node_scoped-v1-0-bbdd7f9fd649@gmail.com

---
Javier Carrasco (2):
      net: mdio: thunder: switch to scoped device_for_each_child_node()
      net: hns: hisilicon: hns_dsaf_mac: switch to scoped device_for_each_child_node()

 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c | 10 +++-------
 drivers/net/mdio/mdio-thunder.c                   |  4 +---
 2 files changed, 4 insertions(+), 10 deletions(-)
---
base-commit: c824deb1a89755f70156b5cdaf569fca80698719
change-id: 20240930-net-device_for_each_child_node_scoped-ebe62f742847

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Re: [PATCH net-next v2 0/2] net: switch to scoped device_for_each_child_node()
Posted by Andrew Lunn 1 month, 4 weeks ago
On Mon, Sep 30, 2024 at 10:38:24PM +0200, Javier Carrasco wrote:
> This series switches from the device_for_each_child_node() macro to its
> scoped variant. This makes the code more robust if new early exits are
> added to the loops, because there is no need for explicit calls to
> fwnode_handle_put(), which also simplifies existing code.
> 
> The non-scoped macros to walk over nodes turn error-prone as soon as
> the loop contains early exits (break, goto, return), and patches to
> fix them show up regularly, sometimes due to new error paths in an
> existing loop [1].
> 
> Note that the child node is now declared in the macro, and therefore the
> explicit declaration is no longer required.
> 
> The general functionality should not be affected by this modification.
> If functional changes are found, please report them back as errors.
> 
> Link:
> https://lore.kernel.org/all/20240901160829.709296395@linuxfoundation.org/
> [1]
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
> Changes in v2:
> - Rebase onto net-next.
> - Fix commit messages (incomplete path, missing net-next prefix).
> - Link to v1: https://lore.kernel.org/r/20240930-net-device_for_each_child_node_scoped-v1-0-bbdd7f9fd649@gmail.com

Much better.

Just watch out for the 24 hour rule between reposts. Reposting too
fast results in wasted time. Reviewers see you v1 and give comments on
it without knowing there is a v2 which might have the issues
fixed. And you might ignore those late comments on v1 ...

I will wait a day or two to review the actual patches, to give others
time to take a look.

  Andrew
Re: [PATCH net-next v2 0/2] net: switch to scoped device_for_each_child_node()
Posted by Javier Carrasco 1 month, 4 weeks ago
On 30/09/2024 22:47, Andrew Lunn wrote:
> On Mon, Sep 30, 2024 at 10:38:24PM +0200, Javier Carrasco wrote:
>> This series switches from the device_for_each_child_node() macro to its
>> scoped variant. This makes the code more robust if new early exits are
>> added to the loops, because there is no need for explicit calls to
>> fwnode_handle_put(), which also simplifies existing code.
>>
>> The non-scoped macros to walk over nodes turn error-prone as soon as
>> the loop contains early exits (break, goto, return), and patches to
>> fix them show up regularly, sometimes due to new error paths in an
>> existing loop [1].
>>
>> Note that the child node is now declared in the macro, and therefore the
>> explicit declaration is no longer required.
>>
>> The general functionality should not be affected by this modification.
>> If functional changes are found, please report them back as errors.
>>
>> Link:
>> https://lore.kernel.org/all/20240901160829.709296395@linuxfoundation.org/
>> [1]
>>
>> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>> ---
>> Changes in v2:
>> - Rebase onto net-next.
>> - Fix commit messages (incomplete path, missing net-next prefix).
>> - Link to v1: https://lore.kernel.org/r/20240930-net-device_for_each_child_node_scoped-v1-0-bbdd7f9fd649@gmail.com
> 
> Much better.
> 
> Just watch out for the 24 hour rule between reposts. Reposting too
> fast results in wasted time. Reviewers see you v1 and give comments on
> it without knowing there is a v2 which might have the issues
> fixed. And you might ignore those late comments on v1 ...
> 
> I will wait a day or two to review the actual patches, to give others
> time to take a look.
> 
>   Andrew

Thanks again, the commit messages were so broken that I thought the
series would not be taken into account, especially after your reply. But
you are right, it could confuse reviewers and we are definitely not in a
hurry :)

Best regards,
Javier Carrasco