diff options
author | Tapasweni Pathak <tapaswenipathak@gmail.com> | 2014-10-08 22:56:15 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-10-20 10:29:19 +0800 |
commit | ffceca8c1739938b58cdc5ce375d33a13150f7af (patch) | |
tree | 1beaa5776920b29c4b45568938b191b563181abb /drivers/staging/iio | |
parent | 97996da1787d55cda95fd4209a4affbef9346c53 (diff) | |
download | talos-op-linux-ffceca8c1739938b58cdc5ce375d33a13150f7af.tar.gz talos-op-linux-ffceca8c1739938b58cdc5ce375d33a13150f7af.zip |
staging: iio: adc: use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
Coccinelle script used :
// <smpl>
@haskernel@
@@
@depends on haskernel@
expression n,d;
@@
(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)
@depends on haskernel@
expression n,d;
@@
- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>
Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/adc/spear_adc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/iio/adc/spear_adc.c b/drivers/staging/iio/adc/spear_adc.c index c5492ba50751..67a364c2e794 100644 --- a/drivers/staging/iio/adc/spear_adc.c +++ b/drivers/staging/iio/adc/spear_adc.c @@ -98,7 +98,7 @@ static void spear_adc_set_clk(struct spear_adc_state *st, u32 val) u32 clk_high, clk_low, count; u32 apb_clk = clk_get_rate(st->clk); - count = (apb_clk + val - 1) / val; + count = DIV_ROUND_UP(apb_clk, val); clk_low = count / 2; clk_high = count - clk_low; st->current_clk = apb_clk / count; |