Skip to content

Commit a229965

Browse files
author
Tero Kristo
committed
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 <[email protected]> Tested-by: Adam Ford <[email protected]>
1 parent fbbc185 commit a229965

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

drivers/clk/ti/clkctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
383383

384384
if (ti_clk_parse_divider_data((int *)div_data->dividers, 0,
385385
div_data->max_div, div_flags,
386-
&div->width, &div->table)) {
386+
div)) {
387387
pr_err("%s: Data parsing for %pOF:%04x:%d failed\n", __func__,
388388
node, offset, data->bit);
389389
kfree(div);

drivers/clk/ti/clock.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ void ti_clk_latch(struct clk_omap_reg *reg, s8 shift);
220220
struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup);
221221

222222
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
223-
u8 flags, u8 *width,
224-
const struct clk_div_table **table);
223+
u8 flags, struct clk_omap_divider *div);
225224

226225
int ti_clk_get_reg_addr(struct device_node *node, int index,
227226
struct clk_omap_reg *reg);

drivers/clk/ti/divider.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ static struct clk *_register_divider(struct device_node *node,
338338
}
339339

340340
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
341-
u8 flags, u8 *width,
342-
const struct clk_div_table **table)
341+
u8 flags, struct clk_omap_divider *divider)
343342
{
344343
int valid_div = 0;
345344
u32 val;
@@ -363,8 +362,7 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
363362
val++;
364363
}
365364

366-
*width = fls(val);
367-
*table = NULL;
365+
divider->width = fls(val);
368366

369367
return 0;
370368
}
@@ -382,24 +380,22 @@ int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
382380
num_dividers = i;
383381

384382
tmp = kcalloc(valid_div + 1, sizeof(*tmp), GFP_KERNEL);
385-
if (!tmp) {
386-
*table = ERR_PTR(-ENOMEM);
383+
if (!tmp)
387384
return -ENOMEM;
388-
}
389385

390386
valid_div = 0;
391-
*width = 0;
387+
divider->width = 0;
392388

393389
for (i = 0; i < num_dividers; i++)
394390
if (div_table[i] > 0) {
395391
tmp[valid_div].div = div_table[i];
396392
tmp[valid_div].val = i;
397393
valid_div++;
398-
*width = i;
394+
divider->width = i;
399395
}
400396

401-
*width = fls(*width);
402-
*table = tmp;
397+
divider->width = fls(divider->width);
398+
divider->table = tmp;
403399

404400
return 0;
405401
}

0 commit comments

Comments
 (0)