summaryrefslogtreecommitdiff
path: root/arch/mips/alchemy/common/clock.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/alchemy/common/clock.c')
-rw-r--r--arch/mips/alchemy/common/clock.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/mips/alchemy/common/clock.c b/arch/mips/alchemy/common/clock.c
index 6c8996e20a7d..62a7304ff35f 100644
--- a/arch/mips/alchemy/common/clock.c
+++ b/arch/mips/alchemy/common/clock.c
@@ -154,7 +154,7 @@ static struct clk __init *alchemy_clk_setup_cpu(const char *parent_name,
struct clk_hw *h;
struct clk *clk;
- h = kzalloc(sizeof(*h), GFP_KERNEL);
+ h = kzalloc_obj(*h);
if (!h)
return ERR_PTR(-ENOMEM);
@@ -211,30 +211,34 @@ static int alchemy_clk_aux_setr(struct clk_hw *hw,
return 0;
}
-static long alchemy_clk_aux_roundr(struct clk_hw *hw,
- unsigned long rate,
- unsigned long *parent_rate)
+static int alchemy_clk_aux_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
{
struct alchemy_auxpll_clk *a = to_auxpll_clk(hw);
unsigned long mult;
- if (!rate || !*parent_rate)
+ if (!req->rate || !req->best_parent_rate) {
+ req->rate = 0;
+
return 0;
+ }
- mult = rate / (*parent_rate);
+ mult = req->rate / req->best_parent_rate;
if (mult && (mult < 7))
mult = 7;
if (mult > a->maxmult)
mult = a->maxmult;
- return (*parent_rate) * mult;
+ req->rate = req->best_parent_rate * mult;
+
+ return 0;
}
static const struct clk_ops alchemy_clkops_aux = {
.recalc_rate = alchemy_clk_aux_recalc,
.set_rate = alchemy_clk_aux_setr,
- .round_rate = alchemy_clk_aux_roundr,
+ .determine_rate = alchemy_clk_aux_determine_rate,
};
static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,
@@ -245,7 +249,7 @@ static struct clk __init *alchemy_clk_setup_aux(const char *parent_name,
struct clk *c;
struct alchemy_auxpll_clk *a;
- a = kzalloc(sizeof(*a), GFP_KERNEL);
+ a = kzalloc_obj(*a);
if (!a)
return ERR_PTR(-ENOMEM);
@@ -771,7 +775,7 @@ static int __init alchemy_clk_init_fgens(int ctype)
}
id.flags = CLK_SET_RATE_PARENT | CLK_GET_RATE_NOCACHE;
- a = kcalloc(6, sizeof(*a), GFP_KERNEL);
+ a = kzalloc_objs(*a, 6);
if (!a)
return -ENOMEM;
@@ -992,7 +996,7 @@ static int __init alchemy_clk_setup_imux(int ctype)
return -ENODEV;
}
- a = kcalloc(6, sizeof(*a), GFP_KERNEL);
+ a = kzalloc_objs(*a, 6);
if (!a)
return -ENOMEM;