Skip to content

Commit

Permalink
ARM: SAMSUNG: Do not allow get/set/round rate calls with no divider
Browse files Browse the repository at this point in the history
If the reg_div field is not set, then do not register clk_ops with the
get/set/round rate calls as these will fail to work.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
  • Loading branch information
Ben Dooks authored and Ben Dooks committed Jan 15, 2010
1 parent 2c2f69b commit fb6e76c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions arch/arm/plat-samsung/clock-clksrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,25 @@ static struct clk_ops clksrc_ops = {
.round_rate = s3c_roundrate_clksrc,
};

static struct clk_ops clksrc_ops_nodiv = {
.set_parent = s3c_setparent_clksrc,
};

void __init s3c_register_clksrc(struct clksrc_clk *clksrc, int size)
{
int ret;

WARN_ON(!clksrc->reg_div.reg && !clksrc->reg_src.reg);

for (; size > 0; size--, clksrc++) {
/* fill in the default functions */
if (!clksrc->clk.ops)
clksrc->clk.ops = &clksrc_ops;

if (!clksrc->clk.ops) {
if (!clksrc->reg_div.reg)
clksrc->clk.ops = &clksrc_ops_nodiv;
else
clksrc->clk.ops = &clksrc_ops;
}

/* setup the clocksource, but do not announce it
* as it may be re-set by the setup routines
Expand Down

0 comments on commit fb6e76c

Please sign in to comment.