lkml.org 
[lkml]   [2016]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 2/3] of: Support hashtable lookups for phandles
From
Hi Pantelis,

On Mon, May 9, 2016 at 8:11 PM, Pantelis Antoniou
<pantelis.antoniou@konsulko.com> 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()?

> + np = of_phandle_ht_lookup(handle);
> + else { /* fallback */
> + for_each_of_allnodes(np)
> + if (np->phandle == handle)
> + break;
> + }

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

\
 
 \ /
  Last update: 2016-05-09 23:01    [W:0.099 / U:0.744 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site