Skip to contentSkip to conversation

ARM: prima2: return rather than panic on missing DT nodes

PATCH New Rob Herring 3 participants 6 messages May 16, 2013 – May 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

From: Rob Herring <[email protected]>

Missing nodes is a normal condition in multi-platform kernels when we boot on other platforms. So remove the panic and just return if we don't find a DT node.

---
 arch/arm/mach-prima2/pm.c   | 2 +-
 arch/arm/mach-prima2/rstc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/pm.c +1 -1
index 9936c18..a8003e2 100644
@@ -102,7 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 
 	np = of_find_matching_node(NULL, pwrc_ids);
 	if (!np)
-		panic("unable to find compatible pwrc node in dtb\n");
+		return -ENODEV;
 
 	/*
 	 * pwrc behind rtciobrg is not located in memory space
arch/arm/mach-prima2/rstc.c +1 -1
index 435019c..6d7d9db 100644
@@ -29,7 +29,7 @@ static int __init sirfsoc_of_rstc_init(void)
 
 	np = of_find_matching_node(NULL, rstc_ids);
 	if (!np)
-		panic("unable to find compatible rstc node in dtb\n");
+		return -ENODEV;
 
 	sirfsoc_rstc_base = of_iomap(np, 0);
 	if (!sirfsoc_rstc_base)
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

Hi Rob,

I was just testing multi_v7_defconfig and noticed that the code is still doing early_initcall and postcore_initcalls. Which IMO is NOK for multiplatforms.

I was just about to send my patch and just noticed your patch.

Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

Missing nodes is a normal condition in multi-platform kernels when we boot on other platforms. So remove the panic and just return if we don't find a DT node.

---
 arch/arm/mach-prima2/pm.c   | 2 +-
 arch/arm/mach-prima2/rstc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/pm.c +0 -0
index 9936c18..a8003e2 100644

arch/arm/mach-prima2/pm.c static int __init sirfsoc_of_pwrc_init(void) · line 102

Quoted 1 line
arch/arm/mach-prima2/pm.c +0 -0
@@ -102,7 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 

First thing is the mach code should not even attempt to run this function in first place.

I think the correct fix for this is to move all the postcore_initcalls and early_initcalls to callbacks in MACHINE.

Thanks,
srini

Quoted 21 lines
arch/arm/mach-prima2/pm.c +1 -1
 	np = of_find_matching_node(NULL, pwrc_ids);
 	if (!np)
-		panic("unable to find compatible pwrc node in dtb\n");
+		return -ENODEV;
 
 	/*
 	 * pwrc behind rtciobrg is not located in memory space
arch/arm/mach-prima2/rstc.c +1 -1
index 435019c..6d7d9db 100644
@@ -29,7 +29,7 @@ static int __init sirfsoc_of_rstc_init(void)
 
 	np = of_find_matching_node(NULL, rstc_ids);
 	if (!np)
-		panic("unable to find compatible rstc node in dtb\n");
+		return -ENODEV;
 
 	sirfsoc_rstc_base = of_iomap(np, 0);
 	if (!sirfsoc_rstc_base)
#2 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

Quoted 32 lines · Srinivas KANDAGATLA

Hi Rob,

I was just testing multi_v7_defconfig and noticed that the code is still doing early_initcall and postcore_initcalls. Which IMO is NOK for multiplatforms.

I was just about to send my patch and just noticed your patch.

Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

Missing nodes is a normal condition in multi-platform kernels when we boot on other platforms. So remove the panic and just return if we don't find a DT node.

---
 arch/arm/mach-prima2/pm.c   | 2 +-
 arch/arm/mach-prima2/rstc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/pm.c +0 -0
index 9936c18..a8003e2 100644

arch/arm/mach-prima2/pm.c static int __init sirfsoc_of_pwrc_init(void) · line 102

Quoted 1 line
arch/arm/mach-prima2/pm.c +0 -0
@@ -102,7 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 

First thing is the mach code should not even attempt to run this function in first place.

Quoted 2 lines

I think the correct fix for this is to move all the postcore_initcalls and early_initcalls to callbacks in MACHINE.

Agreed, but that may cause some init ordering issues. So I'll leave that to someone that knows this platform and can test it.

Rob

#3 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

2013/5/17 Rob Herring <[email protected]>:

Quoted 34 lines
Quoted 32 lines · Srinivas KANDAGATLA

Hi Rob,

I was just testing multi_v7_defconfig and noticed that the code is still doing early_initcall and postcore_initcalls. Which IMO is NOK for multiplatforms.

I was just about to send my patch and just noticed your patch.

Quoted 18 lines · Rob Herring

From: Rob Herring <[email protected]>

Missing nodes is a normal condition in multi-platform kernels when we boot on other platforms. So remove the panic and just return if we don't find a DT node.

---
 arch/arm/mach-prima2/pm.c   | 2 +-
 arch/arm/mach-prima2/rstc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/pm.c +0 -0
index 9936c18..a8003e2 100644

arch/arm/mach-prima2/pm.c static int __init sirfsoc_of_pwrc_init(void) · line 102

Quoted 1 line
arch/arm/mach-prima2/pm.c +0 -0
@@ -102,7 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 

First thing is the mach code should not even attempt to run this function in first place.

Quoted 5 lines
Quoted 2 lines

I think the correct fix for this is to move all the postcore_initcalls and early_initcalls to callbacks in MACHINE.

Agreed, but that may cause some init ordering issues. So I'll leave that to someone that knows this platform and can test it.

what if i really want the system to panic early when these is no pwrc node? then we can check the machine , if it is sirf, we panic the kernel. that results in ugly source codes.

        np = of_find_matching_node(NULL, pwrc_ids);
        if (!np)

- panic("unable to find compatible pwrc node in dtb\n");
+ return -ENODEV;

then it turns out that moving the codes to callbacks of machine is the right way. i will take care the init ordering issues.

Quoted 3 lines

Rob

-barry

#4 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

Quoted 2 lines · Barry Song

then it turns out that moving the codes to callbacks of machine is the right way. i will take care the init ordering issues.

Not sure if this helps but, I have done a patch for this yesterday to fix few more issues when booting with multi_v7_defconfig then the one pointed out by Rob .

--srini
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ARM-prima2-remove-early-and-postcore-initcalls.patch
Type: text/x-patch
Size: 4362 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130517/156c6278/attachment.bin>

#5 lore raw

PATCH 1/1 ARM: prima2: return rather than panic on missing DT nodes

In reply to Rob Herring

2013/5/17 Rob Herring <[email protected]>:

Quoted 9 lines
Quoted 7 lines · Srinivas KANDAGATLA

Hi Rob,

I was just testing multi_v7_defconfig and noticed that the code is still doing early_initcall and postcore_initcalls. Which IMO is NOK for multiplatforms.

I was just about to send my patch and just noticed your patch.

will you send? i can test.

Quoted 25 lines
Quoted 25 lines · Rob Herring
Quoted 18 lines

From: Rob Herring <[email protected]>

Missing nodes is a normal condition in multi-platform kernels when we boot on other platforms. So remove the panic and just return if we don't find a DT node.

---
 arch/arm/mach-prima2/pm.c   | 2 +-
 arch/arm/mach-prima2/rstc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-prima2/pm.c +0 -0
index 9936c18..a8003e2 100644

arch/arm/mach-prima2/pm.c static int __init sirfsoc_of_pwrc_init(void) · line 102

Quoted 1 line
arch/arm/mach-prima2/pm.c +0 -0
@@ -102,7 +102,7 @@ static int __init sirfsoc_of_pwrc_init(void)
 

First thing is the mach code should not even attempt to run this function in first place.

Quoted 5 lines
Quoted 2 lines

I think the correct fix for this is to move all the postcore_initcalls and early_initcalls to callbacks in MACHINE.

Agreed, but that may cause some init ordering issues. So I'll leave that to someone that knows this platform and can test it.

what if we want the system to keep the behavior of panic when these is no pwrc node? then we can check the machine , if it is sirf, we panic the kernel. that results in ugly source codes.

np = of_find_matching_node(NULL, pwrc_ids);
if (!np) {
if (sirf platform)
panic("unable to find compatible pwrc

node in dtb\n");
               else
                              return -ENODEV;
      }

it turns out that moving the codes to callbacks of machine is the right way. i will take care the init ordering issues.

Quoted 3 lines

Rob

-barry