From: Laurent Vivier Date: Tue, 31 May 2016 16:36:00 +0000 (+0200) Subject: usb: Use DIV_ROUND_UP X-Git-Tag: qemu-xen-4.8.0-rc1~227^2~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=66c68a12ae688d16c4037cbe730109108edaf84c;p=qemu-xen.git 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 Signed-off-by: Laurent Vivier Signed-off-by: Michael Tokarev --- diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 8d8054037f..8ec8484349 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)) {