From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7mfW-0005eh-Nv for qemu-devel@nongnu.org; Tue, 31 May 2016 12:37:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7mfT-0003R1-0g for qemu-devel@nongnu.org; Tue, 31 May 2016 12:37:25 -0400 From: Laurent Vivier Date: Tue, 31 May 2016 18:36:00 +0200 Message-Id: <1464712565-14857-12-git-send-email-lvivier@redhat.com> In-Reply-To: <1464712565-14857-1-git-send-email-lvivier@redhat.com> References: <1464712565-14857-1-git-send-email-lvivier@redhat.com> Subject: [Qemu-devel] [PATCH 11/16] usb: Use DIV_ROUND_UP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-trivial@nongnu.org, qemu-devel@nongnu.org Cc: Laurent Vivier , Gerd Hoffmann 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 --- hw/usb/redirect.c | 6 +++--- 1 file 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)) { -- 2.5.5