diff options
author | Tero Kristo <t-kristo@ti.com> | 2019-10-02 15:06:09 +0300 |
---|---|---|
committer | Tero Kristo <t-kristo@ti.com> | 2019-10-31 15:32:34 +0200 |
commit | a229965cfeab8ea8bb79086d6f59ac9a57de66fe (patch) | |
tree | bef6891c234f8da021b6e966b9ce53f7159e0f9a /drivers/clk/ti/divider.c | |
parent | fbbc18591585bf74031dd6474b2937f87063e959 (diff) | |
download | linux-stable-a229965cfeab8ea8bb79086d6f59ac9a57de66fe.tar.gz linux-stable-a229965cfeab8ea8bb79086d6f59ac9a57de66fe.tar.bz2 linux-stable-a229965cfeab8ea8bb79086d6f59ac9a57de66fe.zip |
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>
Diffstat (limited to 'drivers/clk/ti/divider.c')
-rw-r--r-- | drivers/clk/ti/divider.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/clk/ti/divider.c b/drivers/clk/ti/divider.c index 1b181f89ddc6..2c53096b7229 100644 --- a/drivers/clk/ti/divider.c +++ b/drivers/clk/ti/divider.c @@ -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; } |