From: Chintan Pandya <cpandya@codeaurora.org>
To: frowand.list@gmail.com, Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle()
Date: Wed, 28 Feb 2018 18:57:08 +0530 [thread overview]
Message-ID: <ab87b605-6ec4-0b65-89ff-6232c89cb75f@codeaurora.org> (raw)
In-Reply-To: <1518655979-10910-1-git-send-email-frowand.list@gmail.com>
On 2/15/2018 6:22 AM, frowand.list@gmail.com wrote:
> +static void of_populate_phandle_cache(void)
> +{
> + unsigned long flags;
> + u32 cache_entries;
> + struct device_node *np;
> + u32 phandles = 0;
> +
> + raw_spin_lock_irqsave(&devtree_lock, flags);
> +
> + kfree(phandle_cache);
> + phandle_cache = NULL;
> +
> + for_each_of_allnodes(np)
> + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL)
> + phandles++;
> +
> + cache_entries = roundup_pow_of_two(phandles);
> + phandle_cache_mask = cache_entries - 1;
> +
> + phandle_cache = kcalloc(cache_entries, sizeof(*phandle_cache),
> + GFP_ATOMIC);
> +
NULL check of phandle_cache would be good to have.
> + for_each_of_allnodes(np)
> + if (np->phandle && np->phandle != OF_PHANDLE_ILLEGAL)
> + phandle_cache[np->phandle & phandle_cache_mask] = np;
> +
> + raw_spin_unlock_irqrestore(&devtree_lock, flags);
> +}
Chintan
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center,
Inc. is a member of the Code Aurora Forum, a Linux Foundation
Collaborative Project
next prev parent reply other threads:[~2018-02-28 13:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-15 0:52 [PATCH v3] of: cache phandle nodes to reduce cost of of_find_node_by_phandle() frowand.list-Re5JQEeQqe8AvxtiuMwx3w
2018-02-15 0:52 ` frowand.list
[not found] ` <1518655979-10910-1-git-send-email-frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-16 9:04 ` Chintan Pandya
2018-02-16 9:04 ` Chintan Pandya
[not found] ` <207e055e-1074-9010-e719-2a4c13ede9f9-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-02-16 22:20 ` Frank Rowand
2018-02-16 22:20 ` Frank Rowand
[not found] ` <46d5fc76-33e3-d54a-26b8-e9bb8332924d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-02-16 22:33 ` Frank Rowand
2018-02-16 22:33 ` Frank Rowand
2018-02-28 13:27 ` Chintan Pandya [this message]
2018-02-28 18:22 ` Frank Rowand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab87b605-6ec4-0b65-89ff-6232c89cb75f@codeaurora.org \
--to=cpandya@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.