diff options
author | Julia Lawall <julia@diku.dk> | 2008-03-04 18:25:11 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-25 00:16:39 -0400 |
commit | dfa5ec79d28300b0d1fdeafbeebf0a6b721edc38 (patch) | |
tree | bd379b8bd572186c9274e31e5c3ab3b829512106 /drivers/usb/misc/usbtest.c | |
parent | 3d71fe0bb29a3fbffdbe69dd0696927b6a23dd4e (diff) |
USB: 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@
@@
#include <linux/kernel.h>
@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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/usbtest.c')
-rw-r--r-- | drivers/usb/misc/usbtest.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index b6b5b2affad1..17100471e461 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -1404,7 +1404,7 @@ static struct urb *iso_alloc_urb ( | |||
1404 | return NULL; | 1404 | return NULL; |
1405 | maxp = 0x7ff & le16_to_cpu(desc->wMaxPacketSize); | 1405 | maxp = 0x7ff & le16_to_cpu(desc->wMaxPacketSize); |
1406 | maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); | 1406 | maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); |
1407 | packets = (bytes + maxp - 1) / maxp; | 1407 | packets = DIV_ROUND_UP(bytes, maxp); |
1408 | 1408 | ||
1409 | urb = usb_alloc_urb (packets, GFP_KERNEL); | 1409 | urb = usb_alloc_urb (packets, GFP_KERNEL); |
1410 | if (!urb) | 1410 | if (!urb) |