All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
@ 2024-08-07  7:46 Zhang Zekun
  2024-08-19  8:27 ` Daniel Lezcano
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Zhang Zekun @ 2024-08-07  7:46 UTC (permalink / raw)
  To: mark.rutland, maz, daniel.lezcano, tglx, linux-arm-kernel; +Cc: zhangzekun11

for_each_available_child_of_node_scoped() can put the device_node
automatically. So, using it to make the code logic more simple and
remove the device_node clean up code.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
 drivers/clocksource/arm_arch_timer.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index aeafc74181f0..03733101e231 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1594,7 +1594,6 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
 {
 	struct arch_timer_mem *timer_mem;
 	struct arch_timer_mem_frame *frame;
-	struct device_node *frame_node;
 	struct resource res;
 	int ret = -EINVAL;
 	u32 rate;
@@ -1608,33 +1607,29 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
 	timer_mem->cntctlbase = res.start;
 	timer_mem->size = resource_size(&res);
 
-	for_each_available_child_of_node(np, frame_node) {
+	for_each_available_child_of_node_scoped(np, frame_node) {
 		u32 n;
 		struct arch_timer_mem_frame *frame;
 
 		if (of_property_read_u32(frame_node, "frame-number", &n)) {
 			pr_err(FW_BUG "Missing frame-number.\n");
-			of_node_put(frame_node);
 			goto out;
 		}
 		if (n >= ARCH_TIMER_MEM_MAX_FRAMES) {
 			pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n",
 			       ARCH_TIMER_MEM_MAX_FRAMES - 1);
-			of_node_put(frame_node);
 			goto out;
 		}
 		frame = &timer_mem->frame[n];
 
 		if (frame->valid) {
 			pr_err(FW_BUG "Duplicated frame-number.\n");
-			of_node_put(frame_node);
 			goto out;
 		}
 
-		if (of_address_to_resource(frame_node, 0, &res)) {
-			of_node_put(frame_node);
+		if (of_address_to_resource(frame_node, 0, &res))
 			goto out;
-		}
+
 		frame->cntbase = res.start;
 		frame->size = resource_size(&res);
 
-- 
2.17.1



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

* Re: [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
  2024-08-07  7:46 [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped() Zhang Zekun
@ 2024-08-19  8:27 ` Daniel Lezcano
  2024-08-19  8:34   ` Mark Rutland
  2024-08-19  8:34   ` Marc Zyngier
  2024-08-19  8:43 ` Daniel Lezcano
  2024-09-06 18:56 ` [tip: timers/core] " tip-bot2 for Zhang Zekun
  2 siblings, 2 replies; 6+ messages in thread
From: Daniel Lezcano @ 2024-08-19  8:27 UTC (permalink / raw)
  To: Zhang Zekun, mark.rutland, maz, tglx, linux-arm-kernel

On 07/08/2024 09:46, Zhang Zekun wrote:
> for_each_available_child_of_node_scoped() can put the device_node
> automatically. So, using it to make the code logic more simple and
> remove the device_node clean up code.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---

This patch LGTM.

Mar[ck] are you fine with it ?


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
  2024-08-19  8:27 ` Daniel Lezcano
@ 2024-08-19  8:34   ` Mark Rutland
  2024-08-19  8:34   ` Marc Zyngier
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Rutland @ 2024-08-19  8:34 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Zhang Zekun, maz, tglx, linux-arm-kernel

On Mon, Aug 19, 2024 at 10:27:16AM +0200, Daniel Lezcano wrote:
> On 07/08/2024 09:46, Zhang Zekun wrote:
> > for_each_available_child_of_node_scoped() can put the device_node
> > automatically. So, using it to make the code logic more simple and
> > remove the device_node clean up code.
> > 
> > Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> > ---
> 
> This patch LGTM.
> 
> Mar[ck] are you fine with it ?

Looks sound to me:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

> 
> 
> -- 
> <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
> 
> Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
> <http://twitter.com/#!/linaroorg> Twitter |
> <http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
  2024-08-19  8:27 ` Daniel Lezcano
  2024-08-19  8:34   ` Mark Rutland
@ 2024-08-19  8:34   ` Marc Zyngier
  1 sibling, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2024-08-19  8:34 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: Zhang Zekun, mark.rutland, tglx, linux-arm-kernel

On Mon, 19 Aug 2024 09:27:16 +0100,
Daniel Lezcano <daniel.lezcano@linaro.org> wrote:
> 
> On 07/08/2024 09:46, Zhang Zekun wrote:
> > for_each_available_child_of_node_scoped() can put the device_node
> > automatically. So, using it to make the code logic more simple and
> > remove the device_node clean up code.
> > 
> > Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> > ---
> 
> This patch LGTM.
> 
> Mar[ck] are you fine with it ?

Yes, this looks OK to me.

Acked-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.


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

* Re: [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
  2024-08-07  7:46 [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped() Zhang Zekun
  2024-08-19  8:27 ` Daniel Lezcano
@ 2024-08-19  8:43 ` Daniel Lezcano
  2024-09-06 18:56 ` [tip: timers/core] " tip-bot2 for Zhang Zekun
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel Lezcano @ 2024-08-19  8:43 UTC (permalink / raw)
  To: Zhang Zekun, mark.rutland, maz, tglx, linux-arm-kernel

On 07/08/2024 09:46, Zhang Zekun wrote:
> for_each_available_child_of_node_scoped() can put the device_node
> automatically. So, using it to make the code logic more simple and
> remove the device_node clean up code.
> 
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---

Applied, thanks

-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* [tip: timers/core] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()
  2024-08-07  7:46 [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped() Zhang Zekun
  2024-08-19  8:27 ` Daniel Lezcano
  2024-08-19  8:43 ` Daniel Lezcano
@ 2024-09-06 18:56 ` tip-bot2 for Zhang Zekun
  2 siblings, 0 replies; 6+ messages in thread
From: tip-bot2 for Zhang Zekun @ 2024-09-06 18:56 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Zhang Zekun, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     a7456d7d1b8e781fdaa16c10947bd2363c6fd342
Gitweb:        https://git.kernel.org/tip/a7456d7d1b8e781fdaa16c10947bd2363c6fd342
Author:        Zhang Zekun <zhangzekun11@huawei.com>
AuthorDate:    Wed, 07 Aug 2024 15:46:55 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Fri, 06 Sep 2024 14:49:20 +02:00

clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped()

for_each_available_child_of_node_scoped() can put the device_node
automatically. So, using it to make the code logic more simple and
remove the device_node clean up code.

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240807074655.52157-1-zhangzekun11@huawei.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/arm_arch_timer.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
index aeafc74..0373310 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
@@ -1594,7 +1594,6 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
 {
 	struct arch_timer_mem *timer_mem;
 	struct arch_timer_mem_frame *frame;
-	struct device_node *frame_node;
 	struct resource res;
 	int ret = -EINVAL;
 	u32 rate;
@@ -1608,33 +1607,29 @@ static int __init arch_timer_mem_of_init(struct device_node *np)
 	timer_mem->cntctlbase = res.start;
 	timer_mem->size = resource_size(&res);
 
-	for_each_available_child_of_node(np, frame_node) {
+	for_each_available_child_of_node_scoped(np, frame_node) {
 		u32 n;
 		struct arch_timer_mem_frame *frame;
 
 		if (of_property_read_u32(frame_node, "frame-number", &n)) {
 			pr_err(FW_BUG "Missing frame-number.\n");
-			of_node_put(frame_node);
 			goto out;
 		}
 		if (n >= ARCH_TIMER_MEM_MAX_FRAMES) {
 			pr_err(FW_BUG "Wrong frame-number, only 0-%u are permitted.\n",
 			       ARCH_TIMER_MEM_MAX_FRAMES - 1);
-			of_node_put(frame_node);
 			goto out;
 		}
 		frame = &timer_mem->frame[n];
 
 		if (frame->valid) {
 			pr_err(FW_BUG "Duplicated frame-number.\n");
-			of_node_put(frame_node);
 			goto out;
 		}
 
-		if (of_address_to_resource(frame_node, 0, &res)) {
-			of_node_put(frame_node);
+		if (of_address_to_resource(frame_node, 0, &res))
 			goto out;
-		}
+
 		frame->cntbase = res.start;
 		frame->size = resource_size(&res);
 

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

end of thread, other threads:[~2024-09-06 18:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-07  7:46 [PATCH] clocksource/drivers/arm_arch_timer: Using for_each_available_child_of_node_scoped() Zhang Zekun
2024-08-19  8:27 ` Daniel Lezcano
2024-08-19  8:34   ` Mark Rutland
2024-08-19  8:34   ` Marc Zyngier
2024-08-19  8:43 ` Daniel Lezcano
2024-09-06 18:56 ` [tip: timers/core] " tip-bot2 for Zhang Zekun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.