stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	Mike Turquette <mturquette@linaro.org>,
	linux-kernel@vger.kernel.org
Cc: Rajendra Nayak <rnayak@ti.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] clk: Fix __GFP_FS allocation with irqs disabled
Date: Mon, 22 Dec 2014 11:26:42 -0800	[thread overview]
Message-ID: <54987072.4050002@codeaurora.org> (raw)
In-Reply-To: <54986525.3070305@codeaurora.org>

On 12/22/2014 10:38 AM, Stephen Boyd wrote:
> On 12/22/2014 03:45 AM, Krzysztof Kozlowski wrote:
>
>> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
>> index f4963b7d4e17..35079302a650 100644
>> --- a/drivers/clk/clk.c
>> +++ b/drivers/clk/clk.c
>> @@ -1150,6 +1150,12 @@ static int clk_fetch_parent_index(struct clk *clk, struct clk *parent)
>>  {
>>  	int i;
>>  
>> +	if (clk->num_parents == 1) {
>> +		if (IS_ERR_OR_NULL(clk->parent))
>> +			clk->parent = __clk_lookup(clk->parent_names[0]);
>> +		return 0;
>> +	}
>> +
>>  	if (!clk->parents) {
>>  		clk->parents = kcalloc(clk->num_parents,
>>  					sizeof(struct clk *), GFP_KERNEL);
> This may be a worthwhile optimization, but I wonder why the clk_ops for
> this clock need to fetch the parent index at all? Which clock are we
> actually dealing with here?
>

The clk_set_rate() call should still be fixed, but we can probably do
this too.

---8<---

From: Stephen Boyd <sboyd@codeaurora.org>
Date: Mon, 22 Dec 2014 11:24:28 -0800
Subject: [PATCH] clk: Skip fetching index for single parent clocks

We don't need to fetch the parent index for clocks if they only
have one parent. Doing this also avoid an unnecessary allocation
for the parent cache.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 675f37a7329f..e3a2d36124fd 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1420,7 +1420,7 @@ static struct clk *clk_calc_new_rates(struct clk *clk, unsigned long rate)
 	}
 
 	/* try finding the new parent index */
-	if (parent) {
+	if (parent && clk->num_parents > 1) {
 		p_index = clk_fetch_parent_index(clk, parent);
 		if (p_index < 0) {
 			pr_debug("%s: clk %s can not be parent of clk %s\n",

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project


  reply	other threads:[~2014-12-22 19:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-22 11:45 [PATCH] clk: Fix __GFP_FS allocation with irqs disabled Krzysztof Kozlowski
2014-12-22 18:38 ` Stephen Boyd
2014-12-22 19:26   ` Stephen Boyd [this message]
2015-01-17 22:05     ` Mike Turquette

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=54987072.4050002@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=b.zolnierkie@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mturquette@linaro.org \
    --cc=rnayak@ti.com \
    --cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).