Mike,
These are a couple of fixes I found while testing my
OMAP clock port.
regards,
Rajendra
Rajendra Nayak (2):
clk: cache parent clocks only for muxes
clk: Allow late cache allocation for clk->parents
drivers/clk/clk.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
caching parent clocks makes sense only when a clock has more
than one parent (mux clocks).
Avoid doing this for every other clock.
Signed-off-by: Rajendra Nayak <redacted>
---
drivers/clk/clk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
Parent clocks for muxes are cached in clk->parents to
avoid frequent lookups, however the cache allocation happens
only during clock registeration and later clk_set_parent()
assumes a cache space available and allocated.
This is not entirely true for platforms which do early clock
registerations wherein the cache allocation using kzalloc
could fail during clock registeration.
Allow cache allocation to happen later as part of clk_set_parent()
to help such cases and avoid crashes assuming a cache being
available.
While here also replace existing kmalloc() with kzalloc()
in the file.
Signed-off-by: Rajendra Nayak <redacted>
---
drivers/clk/clk.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
@@ -1065,9 +1065,13 @@ static int __clk_set_parent(struct clk *clk, struct clk *parent)old_parent=clk->parent;/* find index of new parent clock using cached parent ptrs */-for(i=0;i<clk->num_parents;i++)-if(clk->parents[i]==parent)-break;+if(clk->parents)+for(i=0;i<clk->num_parents;i++)+if(clk->parents[i]==parent)+break;+else+clk->parents=kzalloc((sizeof(structclk*)*clk->num_parents),+GFP_KERNEL);/**findindexofnewparentclockusingstringnamecomparison
From: Russell King - ARM Linux <hidden> Date: 2012-06-06 10:48:09
On Wed, Jun 06, 2012 at 02:41:30PM +0530, Rajendra Nayak wrote:
quoted hunk
caching parent clocks makes sense only when a clock has more
than one parent (mux clocks).
Avoid doing this for every other clock.
Signed-off-by: Rajendra Nayak <redacted>
---
drivers/clk/clk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
You don't need the additional parens here. Please learn the C precedence
rules. Additional unnecessary parens can make expressions much harder
to read.
From: Mike Turquette <hidden> Date: 2012-06-12 19:04:57
On 20120606-11:47, Russell King - ARM Linux wrote:
On Wed, Jun 06, 2012 at 02:41:30PM +0530, Rajendra Nayak wrote:
quoted
caching parent clocks makes sense only when a clock has more
than one parent (mux clocks).
Avoid doing this for every other clock.
Signed-off-by: Rajendra Nayak <redacted>
---
drivers/clk/clk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
You don't need the additional parens here. Please learn the C precedence
rules. Additional unnecessary parens can make expressions much harder
to read.
Rajendra,
I've taken this patch into clk-next for testing. I've fixed up the
extra parens locally, so no need for a resend.
Regards,
Mike
From: Mike Turquette <hidden> Date: 2012-06-12 19:07:35
On 20120606-14:41, Rajendra Nayak wrote:
Parent clocks for muxes are cached in clk->parents to
avoid frequent lookups, however the cache allocation happens
only during clock registeration and later clk_set_parent()
assumes a cache space available and allocated.
This is not entirely true for platforms which do early clock
registerations wherein the cache allocation using kzalloc
could fail during clock registeration.
Allow cache allocation to happen later as part of clk_set_parent()
to help such cases and avoid crashes assuming a cache being
available.
While here also replace existing kmalloc() with kzalloc()
in the file.
Signed-off-by: Rajendra Nayak <redacted>
I've taken this patch into clk-next for testing.
Thanks,
Mike
On Wednesday 13 June 2012 12:34 AM, Mike Turquette wrote:
On 20120606-11:47, Russell King - ARM Linux wrote:
quoted
On Wed, Jun 06, 2012 at 02:41:30PM +0530, Rajendra Nayak wrote:
quoted
caching parent clocks makes sense only when a clock has more
than one parent (mux clocks).
Avoid doing this for every other clock.
Signed-off-by: Rajendra Nayak<redacted>
---
drivers/clk/clk.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
You don't need the additional parens here. Please learn the C precedence
rules. Additional unnecessary parens can make expressions much harder
to read.
Rajendra,
I've taken this patch into clk-next for testing. I've fixed up the
extra parens locally, so no need for a resend.