linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/3] clk: abstract parent cache
Date: Mon, 13 May 2013 13:01:23 -0700	[thread overview]
Message-ID: <20130513200123.10068.57183@quantum> (raw)
In-Reply-To: <1366388904-13903-2-git-send-email-james.hogan@imgtec.com>

Quoting James Hogan (2013-04-19 09:28:22)
> Abstract access to the clock parent cache by defining
> __clk_get_parent_by_index(clk, index). This allows access to parent
> clocks from clock drivers.
> 
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> ---
>  drivers/clk/clk.c            | 21 ++++++++++++++-------
>  include/linux/clk-provider.h |  1 +
>  2 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index ed87b24..79d5deb 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -415,6 +415,19 @@ struct clk *__clk_get_parent(struct clk *clk)
>         return !clk ? NULL : clk->parent;
>  }
>  
> +struct clk *__clk_get_parent_by_index(struct clk *clk, u8 index)

This looks good, but in the next version can you remove the double
underscore?  I'm getting rid of a lot of those double underscore
helpers now that the reentrancy patch is merged and I think this is a
reasonable top-level API for a clock provider to have.

Thanks,
Mike

> +{
> +       if (!clk || index >= clk->num_parents)
> +               return NULL;
> +       else if (!clk->parents)
> +               return __clk_lookup(clk->parent_names[index]);
> +       else if (!clk->parents[index])
> +               return clk->parents[index] =
> +                       __clk_lookup(clk->parent_names[index]);
> +       else
> +               return clk->parents[index];
> +}
> +
>  unsigned int __clk_get_enable_count(struct clk *clk)
>  {
>         return !clk ? 0 : clk->enable_count;
> @@ -1150,13 +1163,7 @@ static struct clk *__clk_init_parent(struct clk *clk)
>                         kzalloc((sizeof(struct clk*) * clk->num_parents),
>                                         GFP_KERNEL);
>  
> -       if (!clk->parents)
> -               ret = __clk_lookup(clk->parent_names[index]);
> -       else if (!clk->parents[index])
> -               ret = clk->parents[index] =
> -                       __clk_lookup(clk->parent_names[index]);
> -       else
> -               ret = clk->parents[index];
> +       ret = __clk_get_parent_by_index(clk, index);
>  
>  out:
>         return ret;
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index 7f197d7..4e0b634 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -347,6 +347,7 @@ const char *__clk_get_name(struct clk *clk);
>  struct clk_hw *__clk_get_hw(struct clk *clk);
>  u8 __clk_get_num_parents(struct clk *clk);
>  struct clk *__clk_get_parent(struct clk *clk);
> +struct clk *__clk_get_parent_by_index(struct clk *clk, u8 index);
>  unsigned int __clk_get_enable_count(struct clk *clk);
>  unsigned int __clk_get_prepare_count(struct clk *clk);
>  unsigned long __clk_get_rate(struct clk *clk);
> -- 
> 1.8.1.2

  reply	other threads:[~2013-05-13 20:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 16:28 [PATCH v2 0/3] clk: implement remuxing during set_rate James Hogan
2013-04-19 16:28 ` [PATCH v2 1/3] clk: abstract parent cache James Hogan
2013-05-13 20:01   ` Mike Turquette [this message]
2013-04-19 16:28 ` [PATCH v2 2/3] clk: add support for clock reparent on set_rate James Hogan
2013-05-09 20:01   ` Stephen Boyd
2013-05-10 10:41     ` James Hogan
2013-05-14 18:13   ` Mike Turquette
2013-05-14 20:35     ` James Hogan
2013-04-19 16:28 ` [PATCH v2 3/3] clk: clk-mux: implement remuxing " James Hogan
2013-05-08 23:36 ` [PATCH v2 0/3] clk: implement remuxing during set_rate Stephen Boyd
2013-05-09  3:50   ` Saravana Kannan
2013-05-09  9:02   ` James Hogan
2013-05-09 19:48     ` Stephen Boyd
2013-05-10 10:43       ` James Hogan
2013-05-13 19:57 ` Mike Turquette
2013-05-13 21:30   ` James Hogan
2013-05-14 16:59     ` Mike Turquette
2013-05-14 21:01       ` James Hogan
2013-05-14 22:15         ` Mike Turquette
2013-05-16  4:11 ` Saravana Kannan
2013-05-16  9:25   ` James Hogan

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=20130513200123.10068.57183@quantum \
    --to=mturquette@linaro.org \
    --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).