diff options
author | Julia Lawall <julia@diku.dk> | 2008-08-20 19:44:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:51 -0400 |
commit | e9e24cee67bf71b929b646387f286e907cbde5fc (patch) | |
tree | fd3be5482d9a17cd5df69ca8e0cd0ba5c0d4cb5c /drivers/media/video/bw-qcam.c | |
parent | 95908ece60443ceb188fccf021d62823de8e6f0c (diff) |
V4L/DVB (8729): Use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.
An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <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: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/bw-qcam.c')
-rw-r--r-- | drivers/media/video/bw-qcam.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 6e39e253ce53..01f07707827f 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -495,7 +495,7 @@ static void qc_set(struct qcam_device *q) | |||
495 | val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * | 495 | val2 = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * |
496 | q->transfer_scale; | 496 | q->transfer_scale; |
497 | } | 497 | } |
498 | val = (val + val2 - 1) / val2; | 498 | val = DIV_ROUND_UP(val, val2); |
499 | qc_command(q, 0x13); | 499 | qc_command(q, 0x13); |
500 | qc_command(q, val); | 500 | qc_command(q, val); |
501 | 501 | ||
@@ -651,7 +651,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
651 | transperline = q->width * q->bpp; | 651 | transperline = q->width * q->bpp; |
652 | divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * | 652 | divisor = (((q->port_mode & QC_MODE_MASK) == QC_BIDIR) ? 24 : 8) * |
653 | q->transfer_scale; | 653 | q->transfer_scale; |
654 | transperline = (transperline + divisor - 1) / divisor; | 654 | transperline = DIV_ROUND_UP(transperline, divisor); |
655 | 655 | ||
656 | for (i = 0, yield = yieldlines; i < linestotrans; i++) | 656 | for (i = 0, yield = yieldlines; i < linestotrans; i++) |
657 | { | 657 | { |