linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/7] dt/clock: add a simple provider get function
Date: Fri, 06 Apr 2012 22:26:01 -0600	[thread overview]
Message-ID: <20120407042601.7642C3E303C@localhost> (raw)
In-Reply-To: <1331680947-29861-6-git-send-email-robherring2@gmail.com>

On Tue, 13 Mar 2012 18:22:25 -0500, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> For simple cases, the clock provider data can simply be the struct clk ptr.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
>  drivers/of/clock.c |   18 +++++++++++-------
>  1 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/of/clock.c b/drivers/of/clock.c
> index 06fd5ad..f4a0965 100644
> --- a/drivers/of/clock.c
> +++ b/drivers/of/clock.c
> @@ -33,6 +33,12 @@ struct of_clk_provider {
>  static LIST_HEAD(of_clk_providers);
>  static DEFINE_MUTEX(of_clk_lock);
>  
> +static struct clk *of_clk_simple_get(struct of_phandle_args *clkspec,
> +				     void *data)
> +{
> +	return data;
> +}
> +
>  /**
>   * of_clk_add_provider() - Register a clock provider for a node
>   * @np: Device node pointer associated with clock provider
> @@ -52,7 +58,10 @@ int of_clk_add_provider(struct device_node *np,
>  
>  	cp->node = of_node_get(np);
>  	cp->data = data;
> -	cp->get = clk_src_get;
> +	if (clk_src_get)
> +		cp->get = clk_src_get;
> +	else
> +		cp->get = of_clk_simple_get;

Personally, I would prefer callers to be explicit about the
translation functions they need, but it isn't a big enough concern for
me to make a big deal about it.

Acked-by: Grant Likely <grant.likely@secretlab.ca>

>  
>  	mutex_lock(&of_clk_lock);
>  	list_add(&cp->link, &of_clk_providers);
> @@ -183,11 +192,6 @@ void __init of_clk_init(const struct of_device_id *matches)
>  	}
>  }
>  
> -static struct clk *of_fixed_clk_get(struct of_phandle_args *a, void *data)
> -{
> -	return data;
> -}
> -
>  /**
>   * of_fixed_clk_setup() - Setup function for simple fixed rate clock
>   */
> @@ -204,5 +208,5 @@ void __init of_fixed_clk_setup(struct device_node *node)
>  
>  	clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate);
>  	if (clk)
> -		of_clk_add_provider(node, of_fixed_clk_get, clk);
> +		of_clk_add_provider(node, NULL, clk);
>  }
> -- 
> 1.7.5.4
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

  reply	other threads:[~2012-04-07  4:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-13 23:22 [PATCH 0/7] Highbank clock support using DT Rob Herring
2012-03-13 23:22 ` [PATCH 1/7] clk: fix orphan list iterator to be safe Rob Herring
2012-03-14  2:10   ` Turquette, Mike
2012-03-13 23:22 ` [PATCH 2/7] of: add clock providers Rob Herring
2012-03-14  7:07   ` Thierry Reding
2012-03-14  7:55   ` Shawn Guo
2012-04-07  4:18   ` Grant Likely
2012-04-07 19:04     ` Rob Herring
2012-04-09 11:55   ` Shawn Guo
2012-04-09 13:52     ` Rob Herring
2012-04-09 14:13       ` Shawn Guo
2012-04-09 14:34         ` Rob Herring
2012-04-09 23:42           ` Shawn Guo
2012-03-13 23:22 ` [PATCH 3/7] of: Add of_property_match_string() to find index into a string list Rob Herring
2012-04-07  4:22   ` Grant Likely
2012-03-13 23:22 ` [PATCH 4/7] dt/clock: Add handling for fixed clocks and a clock node setup iterator Rob Herring
2012-03-14  7:59   ` Shawn Guo
2012-03-14 13:26     ` Rob Herring
2012-03-14 13:45       ` Shawn Guo
2012-04-08 14:48     ` Rob Herring
2012-04-09  8:49       ` Shawn Guo
2012-04-09 14:18         ` Rob Herring
2012-04-09 23:27           ` Shawn Guo
2012-04-15  3:04             ` Rob Herring
2012-04-15  7:01               ` Shawn Guo
2012-03-13 23:22 ` [PATCH 5/7] dt/clock: add a simple provider get function Rob Herring
2012-04-07  4:26   ` Grant Likely [this message]
2012-03-13 23:22 ` [PATCH 6/7] dt/clock: add function to get parent clock name Rob Herring
2012-03-13 23:22 ` [PATCH 7/7] clk: add highbank clock support Rob Herring
2012-04-10  2:06   ` Shawn Guo
2012-04-10 13:17     ` Rob Herring

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=20120407042601.7642C3E303C@localhost \
    --to=grant.likely@secretlab.ca \
    --cc=linux-arm-kernel@lists.infradead.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).