mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] of/platform: Simplify with scoped for each OF child
@ 2024-08-22  7:34 Jinjie Ruan
  2024-08-24  7:56 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Jinjie Ruan @ 2024-08-22  7:34 UTC (permalink / raw)
  To: robh, saravanak, devicetree, linux-kernel; +Cc: ruanjinjie

Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/of/platform.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 86be4dfb9323..ebc8f0359a95 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -338,7 +338,6 @@ static int of_platform_bus_create(struct device_node *bus,
 				  struct device *parent, bool strict)
 {
 	const struct of_dev_auxdata *auxdata;
-	struct device_node *child;
 	struct platform_device *dev;
 	const char *bus_id = NULL;
 	void *platform_data = NULL;
@@ -382,13 +381,11 @@ static int of_platform_bus_create(struct device_node *bus,
 	if (!dev || !of_match_node(matches, bus))
 		return 0;
 
-	for_each_child_of_node(bus, child) {
+	for_each_child_of_node_scoped(bus, child) {
 		pr_debug("   create child: %pOF\n", child);
 		rc = of_platform_bus_create(child, matches, lookup, &dev->dev, strict);
-		if (rc) {
-			of_node_put(child);
+		if (rc)
 			break;
-		}
 	}
 	of_node_set_flag(bus, OF_POPULATED_BUS);
 	return rc;
@@ -459,7 +456,6 @@ int of_platform_populate(struct device_node *root,
 			const struct of_dev_auxdata *lookup,
 			struct device *parent)
 {
-	struct device_node *child;
 	int rc = 0;
 
 	root = root ? of_node_get(root) : of_find_node_by_path("/");
@@ -470,12 +466,10 @@ int of_platform_populate(struct device_node *root,
 	pr_debug(" starting at: %pOF\n", root);
 
 	device_links_supplier_sync_state_pause();
-	for_each_child_of_node(root, child) {
+	for_each_child_of_node_scoped(root, child) {
 		rc = of_platform_bus_create(child, matches, lookup, parent, true);
-		if (rc) {
-			of_node_put(child);
+		if (rc)
 			break;
-		}
 	}
 	device_links_supplier_sync_state_resume();
 
-- 
2.34.1


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

* Re: [PATCH -next] of/platform: Simplify with scoped for each OF child
  2024-08-22  7:34 [PATCH -next] of/platform: Simplify with scoped for each OF child Jinjie Ruan
@ 2024-08-24  7:56 ` Krzysztof Kozlowski
  2024-08-26  3:57   ` Jinjie Ruan
  0 siblings, 1 reply; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-24  7:56 UTC (permalink / raw)
  To: Jinjie Ruan; +Cc: robh, saravanak, devicetree, linux-kernel

On Thu, Aug 22, 2024 at 03:34:17PM +0800, Jinjie Ruan wrote:
> Use scoped for_each_child_of_node_scoped() when iterating over device
> nodes to make code a bit simpler.
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  drivers/of/platform.c | 14 ++++----------

There are like 3 or 4 patches for OF from you. Send them as ONE
PATCHSET, not one after another.

Best regards,
Krzysztof


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

* Re: [PATCH -next] of/platform: Simplify with scoped for each OF child
  2024-08-24  7:56 ` Krzysztof Kozlowski
@ 2024-08-26  3:57   ` Jinjie Ruan
  0 siblings, 0 replies; 3+ messages in thread
From: Jinjie Ruan @ 2024-08-26  3:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: robh, saravanak, devicetree, linux-kernel



On 2024/8/24 15:56, Krzysztof Kozlowski wrote:
> On Thu, Aug 22, 2024 at 03:34:17PM +0800, Jinjie Ruan wrote:
>> Use scoped for_each_child_of_node_scoped() when iterating over device
>> nodes to make code a bit simpler.
>>
>> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
>> ---
>>  drivers/of/platform.c | 14 ++++----------
> 
> There are like 3 or 4 patches for OF from you. Send them as ONE
> PATCHSET, not one after another.

Thank you very much!

> 
> Best regards,
> Krzysztof
> 

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

end of thread, other threads:[~2024-08-26  3:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-22  7:34 [PATCH -next] of/platform: Simplify with scoped for each OF child Jinjie Ruan
2024-08-24  7:56 ` Krzysztof Kozlowski
2024-08-26  3:57   ` Jinjie Ruan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®