From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH 2/3] of: Support hashtable lookups for phandles Date: Mon, 9 May 2016 22:38:20 +0200 Message-ID: References: <1462817488-8370-1-git-send-email-pantelis.antoniou@konsulko.com> <1462817488-8370-3-git-send-email-pantelis.antoniou@konsulko.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <1462817488-8370-3-git-send-email-pantelis.antoniou-OWPKS81ov/FWk0Htik3J/w@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Pantelis Antoniou Cc: Rob Herring , Frank Rowand , Matt Porter , Grant Likely , Koen Kooi , Guenter Roeck , Marek Vasut , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Pantelis Antoniou List-Id: devicetree@vger.kernel.org Hi Pantelis, On Mon, May 9, 2016 at 8:11 PM, Pantelis Antoniou 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-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html