login
Header Space

 
 

Re: [PATCH 1/3] Clocklib: add generic framework for managing clocks.

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Dmitry <dbaryshkov@...>
Cc: <linux-kernel@...>, <akpm@...>, <hskinnemoen@...>, <domen.puncer@...>, <lethal@...>, <tony@...>, <rmk+kernel@...>, <paul@...>
Date: Thursday, March 27, 2008 - 5:06 am

On Wed, 26 Mar 2008 19:52:34 +0300
Dmitry <dbaryshkov@gmail.com> wrote:


I think it would definitely help to combine some hooks into one.
enable/disable is one example, set_rate/round_rate is another.


Hmm. Missing documentation makes it harder to review this stuff...


If the only advantage is less code duplication, I'd say it's too much.
However...


...that is a good argument. External clock generators come to
mind...they can even be parents for other clocks.


Sure, but then I won't be able to use the suggested drivers that
depend on this stuff.

How about we try to slim things down a bit? Let's see...


I guess these are always required if we're going to do dynamic
registration...


This will probably be unused for most platforms, but I guess we need it
to get the advantage you're talking about.


Reference counting, probably need that too.


This one is redundant. Use getrate() instead.


Huh? A delay after enabling the clock? Why can't the enable() hook do
that if it's really necessary?


What's this for? I'm assuming it's necessary to couple clocks to
specific devices?


We probably need this.


Combine these into "mode" or something (with an extra parameter)


We need this one.


Combine these into one call with an extra "apply" parameter or
something. The underlying logic is pretty much the same apart from the
"actually write stuff to registers" step.


Remove this and let platforms extend the struct instead. They can use
container_of() to access the extra fields, which is faster too.


The result is something like this:

struct clk {
	struct list_head node;
	struct clk	*parent;

	const char	*name;
	struct module	*owner;

	int		users;

	int (*can_get)	(struct clk *, struct device *);
	int (*set_parent) (struct clk *, struct clk *);
	int (*mode)	(struct clk *, bool enabled);
	unsigned long (*getrate) (struct clk*);
	int (*setrate)	(struct clk *, unsigned long, bool apply);
};

which is 44 bytes, 12 bytes more than the avr32 version. That can
probably be explained by the "node" and "owner" fields, which really
are necessary in order to support dynamic registration of clocks.

Adding the "dev" and "index" fields takes us to 52 bytes, or 20 bytes
more. That's about 1.1K extra in total for 55 clocks, which is still a
bit much, but I can probably live with that.

Haavard
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/3] Clocklib: generic clocks framework, Dmitry Baryshkov, (Wed Mar 26, 11:49 am)
[PATCH 4/4] Clocklib: support ARM pxa sub-arch., Dmitry Baryshkov, (Wed Mar 26, 12:17 pm)
[PATCH 3/3] Clocklib: support sa1100 sub-arch., Dmitry Baryshkov, (Wed Mar 26, 11:53 am)
[PATCH 2/3] Clocklib: debugfs support, Dmitry Baryshkov, (Wed Mar 26, 11:52 am)
[PATCH 1/3] Clocklib: add generic framework for managing clo..., Dmitry Baryshkov, (Wed Mar 26, 11:52 am)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Wed Mar 26, 12:04 pm)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Sat Mar 29, 8:36 am)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Thu Mar 27, 5:06 am)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Thu Mar 27, 5:26 am)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Thu Mar 27, 5:53 am)
Re: [PATCH 1/3] Clocklib: add generic framework for managing..., Haavard Skinnemoen, (Thu Mar 27, 6:20 am)
speck-geostationary