]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: drivers: use DIV_ROUND_UP
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Wed, 8 Oct 2014 17:26:01 +0000 (22:56 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Oct 2014 02:29:19 +0000 (10:29 +0800)
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>
drivers/staging/comedi/drivers/s626.c

index 0e7621e890c3ab1a00e70d51b9f76cef032e13a0..bc07450580574549f3b3413c7350b6f74a3e9f92 100644 (file)
@@ -1976,7 +1976,7 @@ static int s626_ns_to_timer(unsigned int *nanosec, unsigned int flags)
                divider = (*nanosec) / base;
                break;
        case CMDF_ROUND_UP:
-               divider = (*nanosec + base - 1) / base;
+               divider = DIV_ROUND_UP(*nanosec, base);
                break;
        }