提交 97996da1 编写于 作者: T Tapasweni Pathak 提交者: Greg Kroah-Hartman

staging: comedi: drivers: 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: NTapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 583bea6c
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册