From: cavokz@gmail.com (Domenico Andreoli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: Allocate and add clock lookups from clk_register()
Date: Fri, 13 Apr 2012 13:16:04 +0200 [thread overview]
Message-ID: <20120413111604.GA20977@glitch> (raw)
In-Reply-To: <9fa570d09d94cdc4892b4e413ef3a0edc6f9dcef.1334298848.git.viresh.kumar@st.com>
On Fri, Apr 13, 2012 at 12:04:57PM +0530, Viresh Kumar wrote:
> clock lookups are required for few clocks for which we do clk_get() or
> clk_get_sys(). Adding clock lookups for them with new clock framework, would
> mean a lot of code for each platform. Simplify this by doing this allocation and
> addition to global list in clk_register() only.
>
> This is done on request by the caller, i.e. only if user passes valid pointers
> in "dev_id" OR "con_id" fields.
>
> A lot of changes at other places/files/comments are also required, that i would
> do separately. This is the initial version to get initial feedback.
>
> Pointer to original discussion:
> http://www.spinics.net/lists/arm-kernel/msg169133.html
>
> Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
> ---
> drivers/clk/clk.c | 33 ++++++++++++++++++++++++++-------
> include/linux/clk-provider.h | 4 +++-
> 2 files changed, 29 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 2bcce5a..16ce136 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -1373,19 +1375,36 @@ struct clk *clk_register(struct device *dev, const char *name,
> }
> }
>
> ret = __clk_init(dev, clk);
> - if (!ret)
> - return clk;
> + if (ret)
> + goto free_parents;
> +
> + if (dev_id || con_id) {
> + struct clk_lookup *lookup;
> +
> + lookup = clkdev_alloc(clk, dev_id, con_id);
> + if (!lookup) {
> + ret = ENODEV;
> + goto free_parents;
> + }
> +
> + clkdev_add(lookup);
> +
> + if (cl)
> + *cl = lookup;
> + }
> +
> + return clk;
Basically this is the amount of code you want to save all around, right?
Why can't be this moved in a different function? So only who wants to
register the lookup will invoke it after clk_register().
cheers,
Domenico
next prev parent reply other threads:[~2012-04-13 11:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-13 6:34 [PATCH] clk: Allocate and add clock lookups from clk_register() Viresh Kumar
2012-04-13 8:56 ` Richard Zhao
2012-04-13 9:25 ` Viresh Kumar
2012-04-13 10:01 ` Sascha Hauer
2012-04-13 10:10 ` Viresh Kumar
2012-04-13 10:30 ` Russell King - ARM Linux
2012-04-13 11:16 ` Domenico Andreoli [this message]
2012-04-16 3:48 ` Viresh Kumar
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=20120413111604.GA20977@glitch \
--to=cavokz@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.