mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-17 16:15:18 +00:00
clk: ti: divider: cleanup ti_clk_parse_divider_data API
Cleanup the ti_clk_parse_divider_data to pass the divider data struct directly instead of individual values of it. This makes it easier to modify the implementation later on. Signed-off-by: Tero Kristo <t-kristo@ti.com> Tested-by: Adam Ford <aford173@gmail.com>
This commit is contained in:
parent
fbbc185915
commit
a229965cfe
3 changed files with 9 additions and 14 deletions
|
@ -383,7 +383,7 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
|
|||
|
||||
if (ti_clk_parse_divider_data((int *)div_data->dividers, 0,
|
||||
div_data->max_div, div_flags,
|
||||
&div->width, &div->table)) {
|
||||
div)) {
|
||||
pr_err("%s: Data parsing for %pOF:%04x:%d failed\n", __func__,
|
||||
node, offset, data->bit);
|
||||
kfree(div);
|
||||
|
|
|
@ -220,8 +220,7 @@ void ti_clk_latch(struct clk_omap_reg *reg, s8 shift);
|
|||
struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup);
|
||||
|
||||
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
|
||||
u8 flags, u8 *width,
|
||||
const struct clk_div_table **table);
|
||||
u8 flags, struct clk_omap_divider *div);
|
||||
|
||||
int ti_clk_get_reg_addr(struct device_node *node, int index,
|
||||
struct clk_omap_reg *reg);
|
||||
|
|
|
@ -338,8 +338,7 @@ static struct clk *_register_divider(struct device_node *node,
|
|||
}
|
||||
|
||||
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
|
||||
u8 flags, u8 *width,
|
||||
const struct clk_div_table **table)
|
||||
u8 flags, struct clk_omap_divider *divider)
|
||||
{
|
||||
int valid_div = 0;
|
||||
u32 val;
|
||||
|
@ -363,8 +362,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
|
|||
val++;
|
||||
}
|
||||
|
||||
*width = fls(val);
|
||||
*table = NULL;
|
||||
divider->width = fls(val);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -382,24 +380,22 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
|
|||
num_dividers = i;
|
||||
|
||||
tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL);
|
||||
if (!tmp) {
|
||||
*table = ERR_PTR(-ENOMEM);
|
||||
if (!tmp)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
valid_div = 0;
|
||||
*width = 0;
|
||||
divider->width = 0;
|
||||
|
||||
for (i = 0; i < num_dividers; i++)
|
||||
if (div_table[i] > 0) {
|
||||
tmp[valid_div].div = div_table[i];
|
||||
tmp[valid_div].val = i;
|
||||
valid_div++;
|
||||
*width = i;
|
||||
divider->width = i;
|
||||
}
|
||||
|
||||
*width = fls(*width);
|
||||
*table = tmp;
|
||||
divider->width = fls(divider->width);
|
||||
divider->table = tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue