Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323667

Re: [RESEND PATCH v2 06/16] clk: move core->parents allocation to clk_register()

From Stephen Boyd <sboyd@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [RESEND PATCH v2 06/16] clk: move core->parents allocation to clk_register()
Date 2016-02-02 01:30 +0100
Message-ID <qXx11-2vh-25@gated-at.bofh.it> (permalink)
References <qKDdT-wt-3@gated-at.bofh.it> <qKDdV-wt-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [RESEND PATCH v2 06/16] clk: move core->parents allocation to  clk_register() Stephen Boyd <sboyd@codeaurora.org> - 2016-02-02 01:30 +0100

csiph-web