linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop
@ 2024-08-16 15:14 Krzysztof Kozlowski
  2024-08-16 15:53 ` Cristian Marussi
  2024-08-20 14:38 ` Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-16 15:14 UTC (permalink / raw)
  To: Sudeep Holla, Cristian Marussi, arm-scmi, linux-arm-kernel,
	linux-kernel
  Cc: Krzysztof Kozlowski

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

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/firmware/arm_scmi/driver.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 33676b6ece95..2b9c38f55989 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -2726,14 +2726,14 @@ scmi_txrx_setup(struct scmi_info *info, struct device_node *of_node,
 static int scmi_channels_setup(struct scmi_info *info)
 {
 	int ret;
-	struct device_node *child, *top_np = info->dev->of_node;
+	struct device_node *top_np = info->dev->of_node;
 
 	/* Initialize a common generic channel at first */
 	ret = scmi_txrx_setup(info, top_np, SCMI_PROTOCOL_BASE);
 	if (ret)
 		return ret;
 
-	for_each_available_child_of_node(top_np, child) {
+	for_each_available_child_of_node_scoped(top_np, child) {
 		u32 prot_id;
 
 		if (of_property_read_u32(child, "reg", &prot_id))
@@ -2744,10 +2744,8 @@ static int scmi_channels_setup(struct scmi_info *info)
 				"Out of range protocol %d\n", prot_id);
 
 		ret = scmi_txrx_setup(info, child, prot_id);
-		if (ret) {
-			of_node_put(child);
+		if (ret)
 			return ret;
-		}
 	}
 
 	return 0;
-- 
2.43.0



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

* Re: [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop
  2024-08-16 15:14 [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop Krzysztof Kozlowski
@ 2024-08-16 15:53 ` Cristian Marussi
  2024-08-20 14:38 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Cristian Marussi @ 2024-08-16 15:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sudeep Holla, Cristian Marussi, arm-scmi, linux-arm-kernel,
	linux-kernel

On Fri, Aug 16, 2024 at 05:14:07PM +0200, Krzysztof Kozlowski wrote:
> Use scoped for_each_child_of_node_scoped() when iterating over device
> nodes to make code a bit simpler.
> 

LGTM.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian


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

* Re: [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop
  2024-08-16 15:14 [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop Krzysztof Kozlowski
  2024-08-16 15:53 ` Cristian Marussi
@ 2024-08-20 14:38 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2024-08-20 14:38 UTC (permalink / raw)
  To: Cristian Marussi, arm-scmi, linux-arm-kernel, linux-kernel,
	Krzysztof Kozlowski
  Cc: Sudeep Holla

On Fri, 16 Aug 2024 17:14:07 +0200, Krzysztof Kozlowski wrote:
> Use scoped for_each_child_of_node_scoped() when iterating over device
> nodes to make code a bit simpler.
>
>

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] firmware: arm_scmi: Simplify with scoped for each OF child loop
      https://git.kernel.org/sudeep.holla/c/a8bd37e64560
--
Regards,
Sudeep



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 15:14 [PATCH] firmware: arm_scmi: Simplify with scoped for each OF child loop Krzysztof Kozlowski
2024-08-16 15:53 ` Cristian Marussi
2024-08-20 14:38 ` Sudeep Holla

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).