diff options
author | Bhaktipriya Shridhar <bhaktipriya96@gmail.com> | 2016-03-10 00:03:49 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-10 19:34:22 -0800 |
commit | df6ba4f16170838482319f40ce1a2b280b9e80f3 (patch) | |
tree | 38eea43a96575bea45381eb7c532150ac391c5a6 /drivers/staging/comedi | |
parent | 44b8c793fc0d63060c6c87f0af4f9b367e2ec4fc (diff) |
staging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)
Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r-- | drivers/staging/comedi/drivers/amplc_pci230.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index d1fe88a6133f..907c39cc89d7 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -642,7 +642,7 @@ static unsigned int pci230_divide_ns(uint64_t ns, unsigned int timebase, case CMDF_ROUND_DOWN: break; case CMDF_ROUND_UP: - div += (rem + timebase - 1) / timebase; + div += DIV_ROUND_UP(rem, timebase); break; } return div > UINT_MAX ? UINT_MAX : (unsigned int)div; |