mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH v2 06/16] clk: move core->parents allocation to clk_register()
Date: Mon, 1 Feb 2016 16:23:53 -0800	[thread overview]
Message-ID: <20160202002353.GM4848@codeaurora.org> (raw)
In-Reply-To: <1451298191-30815-7-git-send-email-yamada.masahiro@socionext.com>

On 12/28, Masahiro Yamada wrote:
> @@ -2343,26 +2331,15 @@ static int __clk_core_init(struct clk_core *core)
>  				__func__, core->name);
>  
>  	/*
> -	 * Allocate an array of struct clk *'s to avoid unnecessary string
> -	 * look-ups of clk's possible parents.  This can fail for clocks passed
> -	 * in to clk_init during early boot; thus any access to core->parents[]
> -	 * must always check for a NULL pointer and try to populate it if
> -	 * necessary.
> +	 * clk_core_lookup returns NULL for parents that have not been
> +	 * clk_init'd; thus any access to clk->parents[] must check
> +	 * for a NULL pointer.  We can always perform lazy lookups for
> +	 * missing parents later on.
>  	 */
> -	if (core->num_parents > 1) {
> -		core->parents = kcalloc(core->num_parents,
> -					sizeof(*core->parents), GFP_KERNEL);
> -		/*
> -		 * clk_core_lookup returns NULL for parents that have not been
> -		 * clk_init'd; thus any access to clk->parents[] must check
> -		 * for a NULL pointer.  We can always perform lazy lookups for
> -		 * missing parents later on.
> -		 */
> -		if (core->parents)
> -			for (i = 0; i < core->num_parents; i++)
> -				core->parents[i] =
> -					clk_core_lookup(core->parent_names[i]);
> -	}
> +	if (core->parents)

Do we even need this check? From what I can tell it's always true
now even when core->num_parents == 0. Plus we can always do the
for loop and terminate early when core->num_parents == 0.

> +		for (i = 0; i < core->num_parents; i++)
> +			core->parents[i] =
> +				clk_core_lookup(core->parent_names[i]);
>  
>  	core->parent = __clk_init_parent(core);
>  nfo.html

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

  reply	other threads:[~2016-02-02  0:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-28 10:22 [RESEND PATCH v2 00/16] clk: a collection of various clean-ups and improvements Masahiro Yamada
2015-12-28 10:22 ` [RESEND PATCH v2 01/16] clk: remove unused first argument of __clk_init() Masahiro Yamada
2016-01-08  0:44   ` Vladimir Zapolskiy
2016-01-08  3:56     ` Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:22 ` [RESEND PATCH v2 02/16] clk: change the argument of __clk_init() into pointer to clk_core Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:22 ` [RESEND PATCH v2 03/16] clk: rename __clk_init() into __clk_core_init() Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:22 ` [RESEND PATCH v2 04/16] clk: remove unnecessary !core->parents conditional Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:22 ` [RESEND PATCH v2 05/16] clk: change sizeof(struct clk *) to sizeof(*core->parents) Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 06/16] clk: move core->parents allocation to clk_register() Masahiro Yamada
2016-02-02  0:23   ` Stephen Boyd [this message]
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 07/16] clk: simplify clk_core_get_parent_by_index() Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 08/16] clk: drop the initial core->parents look-ups from __clk_core_init() Masahiro Yamada
2016-02-02  0:25   ` Stephen Boyd
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 09/16] clk: replace pr_warn() with pr_err() for fatal cases Masahiro Yamada
2016-02-02  1:07   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init() Masahiro Yamada
2016-02-02  0:50   ` Stephen Boyd
2016-02-02  2:19     ` Masahiro Yamada
2016-02-02  2:39       ` Stephen Boyd
2016-02-02  2:48         ` Masahiro Yamada
2016-02-02 20:43           ` Stephen Boyd
2016-02-03  2:09             ` Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 11/16] clk: simplify __clk_init_parent() Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 12/16] clk: avoid circular clock topology Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 13/16] clk: walk the orphan clock list more simply Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 14/16] clk: make sure parent is not NULL in clk_fetch_parent_index() Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 15/16] clk: simplify clk_fetch_parent_index() function Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2015-12-28 10:23 ` [RESEND PATCH v2 16/16] clk: slightly optimize clk_core_set_parent() Masahiro Yamada
2016-02-02  1:08   ` Stephen Boyd
2016-01-04 23:57 ` [RESEND PATCH v2 00/16] clk: a collection of various clean-ups and improvements Michael 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=20160202002353.GM4848@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=yamada.masahiro@socionext.com \
    /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

Powered by JetHome