[PATCH 2/2] of/fdt: add kernel command line option for dtb_compat string

Grant Likely grant.likely at secretlab.ca
Wed Nov 17 11:12:09 EST 2010


On Tue, Nov 16, 2010 at 6:50 AM, Dirk Brandewie
<dirk.brandewie at gmail.com> wrote:
> On 11/15/2010 10:32 PM, Grant Likely wrote:
>>
>> On Mon, Nov 15, 2010 at 08:01:21PM -0800, dirk.brandewie at gmail.com wrote:
>>> +{
>>> +       void *rc = NULL;
>>> +       unsigned long root, size;
>>> +       struct boot_param_header  *orig_initial_boot_params;
>>> +       uint8_t *blob;
>>
>> blob should be a void* here.  It is never used as a uint8.
>>
>
> I used uint8_t prevent compiler warning when blob is compared to __dtb_end
>

okay

>>> +{
>>> +       strncpy(dtb_compat_name, line, MAX_DTB_COMPAT_STR);
>>> +       return 1;
>>> +}
>>
>> I don't remember getting a response about whether or not
>> of_find_compatible_dtb can be called directly from dtb_compat_setup.
>> Doing so would eliminate the arbitrary MAX_DTB_COMPAT_STR because
>> there would be no need to keep around a copy of dtb_compat_name.  It
>> also means that of_find_compatible_dtb() can be restricted to the file
>> scope.
>>
>> Is there a use-case for calling of_find_compatible_dtb() anywhere
>> other than in dtb_compat_setup?
>>
>
> The use case for having these functions exposed is allowing the platfrom
> code decide the policy for which dtb will be used in the case where a dtb
> might have been passed in by the boot loader. These functions can be used as
> a fallback if a dtb was not passed in or to override of the passed in dtb by
> the platform code.

Still this all looks very generic, even across architectures.  I say
don't export the functions for now, and change it later if a use case
shows up that requires it.  I'd really rather not let platform code
muck about with it directly if there isn't a use case for it.

However, thinking about it further.  You also need to make sure this
code is excluded for the powerpc and microblaze architectures because
the kernel command line is passed via the device tree blob in those
cases.  By that time it gets called, it is too late to switch the
device tree pointer.

g.


More information about the devicetree-discuss mailing list