netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node()
@ 2024-08-16  1:58 Zhang Zekun
  2024-08-16 16:24 ` Simon Horman
  2024-08-20 13:21 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Zekun @ 2024-08-16  1:58 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, mkl, netdev; +Cc: zhangzekun11

for_each_child_of_node can help to iterate through the device_node,
and we don't need to use while loop. No functional change with this
conversion.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/net/ethernet/ibm/ehea/ehea_main.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index 1e29e5c9a2df..c41c3f1cc506 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -3063,14 +3063,13 @@ static void ehea_shutdown_single_port(struct ehea_port *port)
 static int ehea_setup_ports(struct ehea_adapter *adapter)
 {
 	struct device_node *lhea_dn;
-	struct device_node *eth_dn = NULL;
+	struct device_node *eth_dn;
 
 	const u32 *dn_log_port_id;
 	int i = 0;
 
 	lhea_dn = adapter->ofdev->dev.of_node;
-	while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
-
+	for_each_child_of_node(lhea_dn, eth_dn) {
 		dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
 						 NULL);
 		if (!dn_log_port_id) {
@@ -3102,12 +3101,11 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
 					   u32 logical_port_id)
 {
 	struct device_node *lhea_dn;
-	struct device_node *eth_dn = NULL;
+	struct device_node *eth_dn;
 	const u32 *dn_log_port_id;
 
 	lhea_dn = adapter->ofdev->dev.of_node;
-	while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
-
+	for_each_child_of_node(lhea_dn, eth_dn) {
 		dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no",
 						 NULL);
 		if (dn_log_port_id)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node()
  2024-08-16  1:58 [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node() Zhang Zekun
@ 2024-08-16 16:24 ` Simon Horman
  2024-08-20 13:21 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-08-16 16:24 UTC (permalink / raw)
  To: Zhang Zekun; +Cc: davem, edumazet, kuba, pabeni, mkl, netdev

On Fri, Aug 16, 2024 at 09:58:37AM +0800, Zhang Zekun wrote:
> for_each_child_of_node can help to iterate through the device_node,
> and we don't need to use while loop. No functional change with this
> conversion.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>

I don't think there is a need to respin for this,
but the patch should be explicitly targeted at net-next

Subject: [PATCH net-next] ...

Otherwise, this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node()
  2024-08-16  1:58 [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node() Zhang Zekun
  2024-08-16 16:24 ` Simon Horman
@ 2024-08-20 13:21 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-20 13:21 UTC (permalink / raw)
  To: Zhang Zekun; +Cc: davem, edumazet, kuba, pabeni, mkl, netdev

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri, 16 Aug 2024 09:58:37 +0800 you wrote:
> for_each_child_of_node can help to iterate through the device_node,
> and we don't need to use while loop. No functional change with this
> conversion.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---
>  drivers/net/ethernet/ibm/ehea/ehea_main.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

Here is the summary with links:
  - net: ethernet: ibm: Simpify code with for_each_child_of_node()
    https://git.kernel.org/netdev/net-next/c/797653865b98

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-20 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16  1:58 [PATCH] net: ethernet: ibm: Simpify code with for_each_child_of_node() Zhang Zekun
2024-08-16 16:24 ` Simon Horman
2024-08-20 13:21 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).