[PATCH] Introduce 'struct machine_class' for SoC level abstraction

Hendrik Sattler post at hendrik-sattler.de
Thu Jul 22 07:40:47 EDT 2010


Zitat von Eric Miao <eric.y.miao at gmail.com>:

> On Thu, Jul 22, 2010 at 1:11 PM, Hendrik Sattler
> <post at hendrik-sattler.de> wrote:
>> Zitat von Eric Miao <eric.miao at canonical.com>:
>>>
>>> @@ -772,8 +774,13 @@ void __init setup_arch(char **cmdline_p)
>>>
>>>        if (__atags_pointer)
>>>                tags = phys_to_virt(__atags_pointer);
>>> -       else if (mdesc->boot_params)
>>> -               tags = phys_to_virt(mdesc->boot_params);
>>> +       else {
>>> +               unsigned long boot_params = mdesc->boot_params ?
>>> +                                           mdesc->boot_params :
>>> +                                          (class ? class->boot_params:
>>> 0);
>>> +               if (boot_params)
>>> +                       tags = phys_to_virt(boot_params);
>>> +       }
>>
>> Isn't
>>        if (__atags_pointer)
>>                tags = phys_to_virt(__atags_pointer);
>>        else if (mdesc->boot_params)
>>                tags = phys_to_virt(mdesc->boot_params);
>> +       else if (class)
>> +               tags = phys_to_virt(class->boot_params);
>>
>> equivalent and much simpler?
>>
>
> The idea is for mdesc->boot_params to override class->boot_params
> if it's non-zero. Eventually this can be removed as the old way of
> passing parameters from the bootloader at .boot_params will just
> go away.

Just expand that your snippet to:
   unsigned long boot_params = 0;
   if (mdesc->boot_params)
     boot_params = mdesc->boot_params;
   else {
     if (class)
       boot_params = class->boot_params;
   }
   if (boot_params)
     tags = phys_to_virt(boot_params);

That is just more complicated than adding that simple else case but  
does the same.

HS





More information about the linux-arm-kernel mailing list