[PATCH] ARM: prima2: return rather than panic on missing DT nodes

Barry Song 21cnbao at gmail.com
Thu May 16 20:31:24 EDT 2013


2013/5/17 Rob Herring <robherring2 at gmail.com>:
> On Thu, May 16, 2013 at 12:00 PM, Srinivas KANDAGATLA
> <srinivas.kandagatla at st.com> wrote:
>> 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.

>>
>>
>> On 16/05/13 16:50, Rob Herring wrote:
>>> From: Rob Herring <rob.herring at calxeda.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Rob Herring <rob.herring at calxeda.com>
>>> Cc: Barry Song <baohua.song at csr.com>
>>> ---
>>>  arch/arm/mach-prima2/pm.c   | 2 +-
>>>  arch/arm/mach-prima2/rstc.c | 2 +-
>>>  2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
>>> index 9936c18..a8003e2 100644
>>> --- a/arch/arm/mach-prima2/pm.c
>>> +++ b/arch/arm/mach-prima2/pm.c
>>> @@ -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.
>
> 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.

>
> Rob
>

-barry



More information about the linux-arm-kernel mailing list