From: benh@kernel.crashing.org (Benjamin Herrenschmidt)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC,PATCH 1/7] arm: add a common struct clk
Date: Tue, 12 Jan 2010 19:50:36 +1100 [thread overview]
Message-ID: <1263286236.724.205.camel@pasglop> (raw)
In-Reply-To: <4B4C2C27.6030306@st.com>
On Tue, 2010-01-12 at 09:00 +0100, Francesco VIRLINZI wrote:
> struct clk_operations {
> int (*init)(struct clk *); /* used on clk_register and
> during resume from hibernation */
> ...
> }
I believe this is unnecessary.
The way I see things, the struct clk is provided by clk_get() in one of
two ways:
- Some static structure the platform is keeping around. In that case
there should be nothing to do for init. In addition, regarding
suspend/resume, those core clocks are way too sensitive beasts to be
left to the generic PM framework. They are likely to require being
turned on/off in a specific sequence or need specific re-init on resume
that only the platform code knows about, so I would leave all of that
there (for SoC clocks at least)
- Via calling into a "clock provider" which instanciate the struct clk
(or returns a pre-instanciated one). That could be using the device-tree
based infrastructure that I proposed for powerpc and that Jeremy is
attempting to use on ARM, clkdev, or some other mechanism the platform
provides. In this case, the provider's get() method is your init (or
rather whtever it does to instanciate a clock) and is private to a given
"subclass" of struct clk. Again, whatever is needed for suspend/resume
also remains into the realm of that specific implementation of a struct
clk.
> struct clk {
> const struct clk_operations *ops;
> spinlock_t lock; /* to serialize the clk_operations */
> const *name;
> int id;
> unsigned long rate; /* used when ops->get_rate is
> NULL */
> };
Here again. Things like lock, name, id, ... are really unnecessary in
many cases and I'd happily leave them to the specific details of a given
struct clk "subclass".
If one wants to find a way to "expose" struct clk in the system into
sysfs or something like that, and as such as a name etc... I would
recommend keeping that a specific CONFIG option which can be disabled as
while I was teasing folks a bit on the "bloat" argument for adding a
couple of function pointers, your proposal would grow the footprint a
lot more significantly.
Besides, the overhead of a spinlock might be utterly uncecessary for a
few clk implementations so why add it to all ?
Cheers,
Ben.
next prev parent reply other threads:[~2010-01-12 8:50 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-07 23:44 [RFC,PATCH 1/7] arm: add a common struct clk Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 5/7] arm/realview: use generic " Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 2/7] arm: generic support for fixed-rate clocks Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 7/7] arm/icst307: remove icst307_ps_to_vco Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 4/7] arm/versatile: remove oscoff from clk_versatile Jeremy Kerr
2010-01-07 23:44 ` [RFC,PATCH 3/7] arm/versatile: use generic struct clk Jeremy Kerr
2010-01-07 23:44 ` [RFC, PATCH 6/7] arm/icst307: use common struct clk, unify realview and versatile clocks Jeremy Kerr
2010-01-08 1:11 ` H Hartley Sweeten
2010-01-08 1:35 ` Jeremy Kerr
2010-01-08 0:30 ` [RFC,PATCH 1/7] arm: add a common struct clk H Hartley Sweeten
2010-01-08 1:20 ` Jeremy Kerr
2010-01-08 3:26 ` Jeremy Kerr
2010-01-08 9:42 ` Russell King - ARM Linux
2010-01-08 10:01 ` Benjamin Herrenschmidt
2010-01-08 11:18 ` Russell King - ARM Linux
2010-01-08 11:45 ` Benjamin Herrenschmidt
2010-01-08 12:59 ` Russell King - ARM Linux
2010-01-08 19:45 ` Benjamin Herrenschmidt
2010-01-11 3:37 ` Jeremy Kerr
2010-01-12 8:00 ` Francesco VIRLINZI
2010-01-12 8:50 ` Benjamin Herrenschmidt [this message]
2010-01-08 16:25 ` H Hartley Sweeten
2010-01-08 19:33 ` Benjamin Herrenschmidt
2010-01-08 1:17 ` Benjamin Herrenschmidt
2010-01-08 1:38 ` Jeremy Kerr
2010-01-11 5:38 ` Jeremy Kerr
2010-01-11 10:46 ` Mark Brown
2010-01-11 19:48 ` Benjamin Herrenschmidt
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=1263286236.724.205.camel@pasglop \
--to=benh@kernel.crashing.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).