linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
@ 2023-03-19 14:59 Rob Herring
  2023-07-03  5:26 ` Michael Ellerman
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2023-03-19 14:59 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Michael Ellerman, Nicholas Piggin,
	Christophe Leroy
  Cc: linuxppc-dev, linux-kernel

Replace open coded reading of CPU nodes' "reg" properties with
of_get_cpu_hwid() dedicated for this purpose.

Signed-off-by: Rob Herring <robh@kernel.org>
---
 arch/powerpc/platforms/powermac/feature.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 0382d20b5619..dd508c2fcb5a 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1053,11 +1053,11 @@ core99_reset_cpu(struct device_node *node, long param, long value)
 		return -ENODEV;
 
 	for_each_of_cpu_node(np) {
-		const u32 *num = of_get_property(np, "reg", NULL);
 		const u32 *rst = of_get_property(np, "soft-reset", NULL);
-		if (num == NULL || rst == NULL)
+		if (!rst)
 			continue;
-		if (param == *num) {
+		if (param == of_get_cpu_hwid(np, 0)) {
+			of_node_put(np);
 			reset_io = *rst;
 			break;
 		}
@@ -1499,11 +1499,11 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
 		return -ENODEV;
 
 	for_each_of_cpu_node(np) {
-		const u32 *num = of_get_property(np, "reg", NULL);
 		const u32 *rst = of_get_property(np, "soft-reset", NULL);
-		if (num == NULL || rst == NULL)
+		if (!rst)
 			continue;
-		if (param == *num) {
+		if (param == of_get_cpu_hwid(np, 0)) {
+			of_node_put(np);
 			reset_io = *rst;
 			break;
 		}
-- 
2.39.2


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

* Re: [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
  2023-03-19 14:59 [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg' Rob Herring
@ 2023-07-03  5:26 ` Michael Ellerman
  2023-07-03 17:01   ` Christophe JAILLET
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2023-07-03  5:26 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Nicholas Piggin, Christophe Leroy,
	Rob Herring
  Cc: linuxppc-dev, linux-kernel

On Sun, 19 Mar 2023 09:59:31 -0500, Rob Herring wrote:
> Replace open coded reading of CPU nodes' "reg" properties with
> of_get_cpu_hwid() dedicated for this purpose.
> 
> 

Applied to powerpc/next.

[1/1] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
      https://git.kernel.org/powerpc/c/bc1cf75027585f8d87f94e464ee5909acf885a8c

cheers

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

* Re: [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
  2023-07-03  5:26 ` Michael Ellerman
@ 2023-07-03 17:01   ` Christophe JAILLET
  2023-07-03 17:04     ` Marion & Christophe JAILLET
  2023-08-15  4:01     ` Michael Ellerman
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2023-07-03 17:01 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Nicholas Piggin,
	Christophe Leroy, Rob Herring
  Cc: linuxppc-dev, linux-kernel

Le 03/07/2023 à 07:26, Michael Ellerman a écrit :
> On Sun, 19 Mar 2023 09:59:31 -0500, Rob Herring wrote:
>> Replace open coded reading of CPU nodes' "reg" properties with
>> of_get_cpu_hwid() dedicated for this purpose.
>>
>>
> 
> Applied to powerpc/next.
> 
> [1/1] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
>        https://git.kernel.org/powerpc/c/bc1cf75027585f8d87f94e464ee5909acf885a8c
> 
> cheers
> 

Hi,

I guess, that it does not really matter, but shouldn't the 
of_node_put() be *after* the "reset_io = *rst;" statements to be 
absolutely safe?


(This change is in my backlog and I have apparently never proposed it)

CJ

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

* Re: [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
  2023-07-03 17:01   ` Christophe JAILLET
@ 2023-07-03 17:04     ` Marion & Christophe JAILLET
  2023-08-15  4:01     ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Marion & Christophe JAILLET @ 2023-07-03 17:04 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Nicholas Piggin,
	Christophe Leroy, Rob Herring
  Cc: linuxppc-dev, linux-kernel



Le 03/07/2023 à 19:01, Christophe JAILLET a écrit :
> Le 03/07/2023 à 07:26, Michael Ellerman a écrit :
>> On Sun, 19 Mar 2023 09:59:31 -0500, Rob Herring wrote:
>>> Replace open coded reading of CPU nodes' "reg" properties with
>>> of_get_cpu_hwid() dedicated for this purpose.
>>>
>>>
>>
>> Applied to powerpc/next.
>>
>> [1/1] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
>>        
>> https://git.kernel.org/powerpc/c/bc1cf75027585f8d87f94e464ee5909acf885a8c
>>
>> cheers
>>
> 
> Hi,
> 
> I guess, that it does not really matter, but shouldn't the of_node_put() 
> be *after* the "reset_io = *rst;" statements to be absolutely safe?
> 
> 
> (This change is in my backlog and I have apparently never proposed it)

Well, in fact is was in:
https://lore.kernel.org/all/f2186955f310494f10990b5c402ada164d7834b8.1619188632.git.christophe.jaillet@wanadoo.fr/

> 
> CJ
> 

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

* Re: [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
  2023-07-03 17:01   ` Christophe JAILLET
  2023-07-03 17:04     ` Marion & Christophe JAILLET
@ 2023-08-15  4:01     ` Michael Ellerman
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2023-08-15  4:01 UTC (permalink / raw)
  To: Christophe JAILLET, Michael Ellerman, Benjamin Herrenschmidt,
	Nicholas Piggin, Christophe Leroy, Rob Herring
  Cc: linuxppc-dev, linux-kernel

Christophe JAILLET <christophe.jaillet@wanadoo.fr> writes:
> Le 03/07/2023 à 07:26, Michael Ellerman a écrit :
>> On Sun, 19 Mar 2023 09:59:31 -0500, Rob Herring wrote:
>>> Replace open coded reading of CPU nodes' "reg" properties with
>>> of_get_cpu_hwid() dedicated for this purpose.
>>>
>>>
>> 
>> Applied to powerpc/next.
>> 
>> [1/1] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg'
>>        https://git.kernel.org/powerpc/c/bc1cf75027585f8d87f94e464ee5909acf885a8c
>> 
>> cheers
>> 
>
> Hi,
>
> I guess, that it does not really matter, but shouldn't the 
> of_node_put() be *after* the "reset_io = *rst;" statements to be 
> absolutely safe?

Technically yes.

> (This change is in my backlog and I have apparently never proposed it)

Can you rebase and resend?

cheers

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

end of thread, other threads:[~2023-08-15  4:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-19 14:59 [PATCH] powerpc: powermac: Use of_get_cpu_hwid() to read CPU node 'reg' Rob Herring
2023-07-03  5:26 ` Michael Ellerman
2023-07-03 17:01   ` Christophe JAILLET
2023-07-03 17:04     ` Marion & Christophe JAILLET
2023-08-15  4:01     ` Michael Ellerman

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