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/serial/io_ti.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/serial/io_ti.c')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 39d71fdb5071..6afee30a6a5c 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -654,7 +654,7 @@ static void TIChasePort(struct edgeport_port *port, unsigned long timeout, int f | |||
654 | /* (TIIsTxActive doesn't seem to wait for the last byte) */ | 654 | /* (TIIsTxActive doesn't seem to wait for the last byte) */ |
655 | if ((baud_rate=port->baud_rate) == 0) | 655 | if ((baud_rate=port->baud_rate) == 0) |
656 | baud_rate = 50; | 656 | baud_rate = 50; |
657 | msleep(max(1,(10000+baud_rate-1)/baud_rate)); | 657 | msleep(max(1, DIV_ROUND_UP(10000, baud_rate))); |
658 | } | 658 | } |
659 | 659 | ||
660 | static int TIChooseConfiguration (struct usb_device *dev) | 660 | static int TIChooseConfiguration (struct usb_device *dev) |