USB: use DIV_ROUND_UP
authorJulia Lawall <julia@diku.dk>
Tue, 4 Mar 2008 23:25:11 +0000 (15:25 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 25 Apr 2008 04:16:39 +0000 (21:16 -0700)
commitdfa5ec79d28300b0d1fdeafbeebf0a6b721edc38
treebd379b8bd572186c9274e31e5c3ab3b829512106
parent3d71fe0bb29a3fbffdbe69dd0696927b6a23dd4e
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>
drivers/usb/host/r8a66597-hcd.c
drivers/usb/misc/usbtest.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/io_ti.c