From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] sh: clkfwk: Changed the init function
Date: Fri, 13 Mar 2009 16:31:17 +0000 [thread overview]
Message-ID: <20090313163117.GD31657@game.jcrosoft.org> (raw)
In-Reply-To: <49BA1505.7000500@st.com>
On 09:34 Fri 13 Mar , Francesco VIRLINZI wrote:
> Sorry I forgot the timers..
> Here the right patch
> Regards
> Francesco
> Francesco VIRLINZI ha scritto:
>> Hi all
>>
>> This patch changes the init field in the clk_ops structure.
>> Moreover it changes how the init function is used.
>> Now it's called during registration and if something was wrong the
>> clock isn't registered.
>>
>> Regards
>> Francesco
>
> >From 942219bb95734329c858587806e49895bae29208 Mon Sep 17 00:00:00 2001
> From: Francesco Virlinzi <francesco.virlinzi@st.com>
> Date: Fri, 13 Mar 2009 09:32:45 +0100
> Subject: [PATCH] sh: clkfwk: Changed the init field to return a value
>
> This patch changes the clk_ops.init function pointer
> to return a value.
> Moreover it change the clk_register function to call
> always the clk_ops.init function to initilize the clock
> if there is an error the clock _isn't_ registered.
>
> Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
> ---
> arch/sh/include/asm/clock.h | 2 +-
> arch/sh/kernel/cpu/clock.c | 18 +++++-------------
> arch/sh/kernel/cpu/sh2/clock-sh7619.c | 3 ++-
> arch/sh/kernel/cpu/sh2a/clock-sh7201.c | 3 ++-
> arch/sh/kernel/cpu/sh2a/clock-sh7203.c | 3 ++-
> arch/sh/kernel/cpu/sh2a/clock-sh7206.c | 3 ++-
> arch/sh/kernel/cpu/sh3/clock-sh3.c | 3 ++-
> arch/sh/kernel/cpu/sh3/clock-sh7705.c | 3 ++-
> arch/sh/kernel/cpu/sh3/clock-sh7706.c | 3 ++-
> arch/sh/kernel/cpu/sh3/clock-sh7709.c | 3 ++-
> arch/sh/kernel/cpu/sh3/clock-sh7712.c | 3 ++-
> arch/sh/kernel/cpu/sh4/clock-sh4-202.c | 3 ++-
> arch/sh/kernel/cpu/sh4/clock-sh4.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7722.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7763.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7770.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7780.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7785.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-sh7786.c | 3 ++-
> arch/sh/kernel/cpu/sh4a/clock-shx3.c | 3 ++-
> arch/sh/kernel/cpu/sh5/clock-sh5.c | 3 ++-
> arch/sh/kernel/timers/timer-cmt.c | 3 ++-
> arch/sh/kernel/timers/timer-mtu2.c | 3 ++-
> arch/sh/kernel/timers/timer-tmu.c | 3 ++-
> 24 files changed, 50 insertions(+), 36 deletions(-)
>
> diff --git a/arch/sh/include/asm/clock.h b/arch/sh/include/asm/clock.h
> index 2f6c962..f7a5899 100644
> --- a/arch/sh/include/asm/clock.h
> +++ b/arch/sh/include/asm/clock.h
> @@ -10,7 +10,7 @@
> struct clk;
>
> struct clk_ops {
> - void (*init)(struct clk *clk);
> + int (*init)(struct clk *clk);
> void (*enable)(struct clk *clk);
> void (*disable)(struct clk *clk);
> void (*recalc)(struct clk *clk);
> diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
> index e2d2451..87a54b5 100644
> --- a/arch/sh/kernel/cpu/clock.c
> +++ b/arch/sh/kernel/cpu/clock.c
> @@ -92,17 +92,6 @@ static void propagate_rate(struct clk *clk)
>
> static int __clk_enable(struct clk *clk)
> {
> - /*
> - * See if this is the first time we're enabling the clock, some
> - * clocks that are always enabled still require "special"
> - * initialization. This is especially true if the clock mode
> - * changes and the clock needs to hunt for the proper set of
> - * divisors to use before it can effectively recalc.
> - */
> - if (unlikely(atomic_read(&clk->kref.refcount) = 1))
> - if (clk->ops && clk->ops->init)
> - clk->ops->init(clk);
> -
> kref_get(&clk->kref);
>
> if (clk->flags & CLK_ALWAYS_ENABLED)
> @@ -167,6 +156,11 @@ EXPORT_SYMBOL_GPL(clk_disable);
>
> int clk_register(struct clk *clk)
> {
> +
> + if (clk->ops && clk->ops->init)
> + if (clk->ops->init(clk))
> + return -EINVAL;
> +
why do you check the return if all clk_init will always return 0; ?
IMHO if clk-ops is NULL return directly instead of recheck it later
Best Regards,
J.
next prev parent reply other threads:[~2009-03-13 16:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 8:10 [PATCH] sh: clkfwk: Changed the init function Francesco VIRLINZI
2009-03-13 8:34 ` Francesco VIRLINZI
2009-03-13 16:31 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2009-03-16 5:24 ` Francesco VIRLINZI
2009-03-16 11:13 ` Paul Mundt
2009-03-16 12:39 ` Francesco VIRLINZI
2009-03-16 12:45 ` Paul Mundt
2009-03-19 8:24 ` Francesco VIRLINZI
2009-04-07 8:25 ` Francesco VIRLINZI
2009-04-07 20:27 ` Jean-Christophe PLAGNIOL-VILLARD
2009-05-14 3:40 ` Paul Mundt
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=20090313163117.GD31657@game.jcrosoft.org \
--to=plagnioj@jcrosoft.com \
--cc=linux-sh@vger.kernel.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