aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:36:00 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:25 +0300
commit66c68a12ae688d16c4037cbe730109108edaf84c (patch)
treec0acfb5d9dfdc7ee49d31443bb3e4884285fde50 /hw/usb
parentdf5d1c17b6d9a436a3fcedcc16fa6fb8d28d2f07 (diff)
downloadqemu-66c68a12ae688d16c4037cbe730109108edaf84c.zip
qemu-66c68a12ae688d16c4037cbe730109108edaf84c.tar.gz
qemu-66c68a12ae688d16c4037cbe730109108edaf84c.tar.bz2
usb: Use DIV_ROUND_UP
Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d). This patch is the result of coccinelle script scripts/coccinelle/round.cocci CC: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/redirect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 8d80540..8ec8484 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -542,9 +542,9 @@ static void usbredir_handle_iso_data(USBRedirDevice *dev, USBPacket *p,
start_iso.pkts_per_urb = 32;
}
- start_iso.no_urbs = (dev->endpoint[EP2I(ep)].bufpq_target_size +
- start_iso.pkts_per_urb - 1) /
- start_iso.pkts_per_urb;
+ start_iso.no_urbs = DIV_ROUND_UP(
+ dev->endpoint[EP2I(ep)].bufpq_target_size,
+ start_iso.pkts_per_urb);
/* Output endpoints pre-fill only 1/2 of the packets, keeping the rest
as overflow buffer. Also see the usbredir protocol documentation */
if (!(ep & USB_DIR_IN)) {