Re: [PATCH 2/3] of: Support hashtable lookups for phandles

From: Rob Herring
Date: Mon May 09 2016 - 17:11:53 EST


On Mon, May 9, 2016 at 3:38 PM, Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> Hi Pantelis,
>
> On Mon, May 9, 2016 at 8:11 PM, Pantelis Antoniou
> <pantelis.antoniou@xxxxxxxxxxxx> wrote:
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>
>> @@ -1073,9 +1097,14 @@ struct device_node *of_find_node_by_phandle(phandle handle)
>> return NULL;
>>
>> raw_spin_lock_irqsave(&devtree_lock, flags);
>> - for_each_of_allnodes(np)
>> - if (np->phandle == handle)
>> - break;
>> + /* when we're ready use the hash table */
>> + if (of_phandle_ht_available() && !in_interrupt())
>
> I guess the !in_interrupt() test is because of the locking inside
> rhashtable_lookup_fast()?

Not a use we should support. Just warn for anyone parsing DT in
interrupt context.

Rob