From: jeremy.kerr@canonical.com (Jeremy Kerr)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC,PATCH 1/2] Add a common struct clk
Date: Fri, 10 Sep 2010 10:10:55 +0800 [thread overview]
Message-ID: <1284084655.2877.23.camel@pororo> (raw)
In-Reply-To: <20100613222349.GD31045@fluff.org.uk>
Hi Ben,
> > > > +#define INIT_CLK(name, o) \
> > > > + { .ops = &o, .enable_count = 0, \
> > > > + .mutex = __MUTEX_INITIALIZER(name.mutex) }
> > >
> > > how about doing the mutex initinitialisation at registration
> > > time, will save a pile of non-zero code in the image to mess up
> > > the compression.
> >
> > I've just yesterday added the following to my tree, to allow dynamic
> > initialisation:
> >
> > static inline void clk_init(struct clk *clk, const struct clk_ops *ops)
> > {
> > clk->ops = ops;
> > clk->enable_count = 0;
> > mutex_init(&clk->mutex);
> > }
> >
> > So we can do this either way.
>
> the above is in my view better.
After implementing this, it turns out it won't work - we don't have
access to all clocks in order to do the mutex init (thanks to Jason Hui
for pointing this out).
At present, I'm calling clk_init_common() (which initialises the mutex)
from clkdev_add, but there are clocks that don't get initialised. For
example:
struct clk_fixed parent_clk = INIT_CLK(32768);
struct clk_foo child_clk = INIT_CLK_FOO(parent.clk);
struct clk_lookup lookup = {
.dev_id = "foo",
.clk = child_clk,
};
function platform_clk_init(void)
{
clkdev_add(lookup);
}
In this case, the child_clk's mutex will get initialised, but
parent_clk's won't. We can't walk the parents of child_clk and
initialise, as we may re-initialise the mutexes of parents with > 1
child.
Now, we *could* do the clk_common_init() from board-specific code, and
require that that code guarantees to call clk_common_init() on every
clock defined. I think that's a recipe for pain, as there will
undoubtedly be clocks missed, causing an oops when the clock is first
used.
So I think the solution will have to be to do the mutex initialisation
statically. I'm planning to leave clk_common_init() available for clocks
initalised at runtime, but it will no longer be called automatically
from core code.
Any thoughts?
Cheers,
Jeremy
next prev parent reply other threads:[~2010-09-10 2:10 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 7:30 [RFC,PATCH 0/2] Common struct clk implementation, v4 Jeremy Kerr
2010-06-04 7:30 ` [RFC,PATCH 2/2] clk: Generic support for fixed-rate clocks Jeremy Kerr
2010-06-04 7:30 ` [RFC,PATCH 1/2] Add a common struct clk Jeremy Kerr
2010-06-11 4:20 ` Ben Dooks
2010-06-11 6:50 ` Benjamin Herrenschmidt
2010-06-11 7:57 ` Jeremy Kerr
2010-06-11 8:14 ` Lothar Waßmann
2010-06-11 9:18 ` Jeremy Kerr
2010-06-11 9:23 ` Lothar Waßmann
2010-06-11 9:58 ` Uwe Kleine-König
2010-06-11 10:08 ` Lothar Waßmann
2010-06-11 10:50 ` Jeremy Kerr
2010-06-12 5:14 ` Benjamin Herrenschmidt
2010-06-14 6:39 ` Lothar Waßmann
2010-06-14 6:40 ` Uwe Kleine-König
2010-06-14 6:52 ` Lothar Waßmann
2010-06-14 9:34 ` Uwe Kleine-König
2010-06-16 21:14 ` Ben Dooks
2010-06-16 21:13 ` Ben Dooks
2010-06-14 9:22 ` Benjamin Herrenschmidt
2010-06-14 9:30 ` Lothar Waßmann
2010-06-14 9:43 ` Uwe Kleine-König
2010-06-16 21:16 ` Ben Dooks
2010-06-16 23:33 ` Benjamin Herrenschmidt
2010-06-13 22:27 ` Ben Dooks
2010-06-11 14:11 ` Uwe Kleine-König
2010-06-12 5:12 ` Benjamin Herrenschmidt
2010-06-12 5:10 ` Benjamin Herrenschmidt
2010-06-13 22:25 ` Ben Dooks
2010-06-13 22:23 ` Ben Dooks
2010-06-14 3:10 ` Jeremy Kerr
2010-09-10 2:10 ` Jeremy Kerr [this message]
2010-06-14 10:18 ` Jeremy Kerr
-- strict thread matches above, loose matches on Subject: below --
2010-06-02 11:56 [RFC,PATCH 0/2] Common struct clk implementation, v3 Jeremy Kerr
2010-06-02 11:56 ` [RFC,PATCH 1/2] Add a common struct clk Jeremy Kerr
2010-06-02 12:03 ` Ben Dooks
2010-06-03 3:21 ` Jeremy Kerr
2010-06-03 8:13 ` Ben Dooks
2010-06-03 10:24 ` Jeremy Kerr
2010-06-03 11:05 ` Russell King - ARM Linux
2010-06-04 0:06 ` Ben Dooks
2010-06-04 1:43 ` Jeremy Kerr
2010-06-04 1:40 ` Jeremy Kerr
2010-06-03 21:09 ` Ryan Mallon
2010-06-03 23:45 ` Ben Dooks
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=1284084655.2877.23.camel@pororo \
--to=jeremy.kerr@canonical.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox