Module Name: src
Committed By: skrll
Date: Thu Mar 5 08:35:17 UTC 2020
Modified Files:
src/sys/dev/usb: ehci.c
Log Message:
Use howmany. NFC.
To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/dev/usb/ehci.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.274 src/sys/dev/usb/ehci.c:1.275
--- src/sys/dev/usb/ehci.c:1.274 Fri Feb 21 12:41:29 2020
+++ src/sys/dev/usb/ehci.c Thu Mar 5 08:35:16 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.274 2020/02/21 12:41:29 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.275 2020/03/05 08:35:16 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.274 2020/02/21 12:41:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.275 2020/03/05 08:35:16 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -2913,7 +2913,7 @@ ehci_alloc_sqtd_chain(ehci_softc_t *sc,
KASSERT(alen != 0 || (!rd && (flags & USBD_FORCE_SHORT_XFER)));
size_t nsqtd = (!rd && (flags & USBD_FORCE_SHORT_XFER)) ? 1 : 0;
- nsqtd += ((alen + EHCI_PAGE_SIZE - 1) / EHCI_PAGE_SIZE);
+ nsqtd += howmany(alen, EHCI_PAGE_SIZE);
exfer->ex_sqtds = kmem_zalloc(sizeof(ehci_soft_qtd_t *) * nsqtd,
KM_SLEEP);
exfer->ex_nsqtd = nsqtd;
@@ -3061,7 +3061,7 @@ ehci_reset_sqtd_chain(ehci_softc_t *sc,
ehci_append_sqtd(sqtd, prev);
- if (((curlen + mps - 1) / mps) & 1) {
+ if (howmany(curlen, mps) & 1) {
tog ^= 1;
}
@@ -4582,7 +4582,7 @@ ehci_device_isoc_init(struct usbd_xfer *
}
ufrperframe = uimax(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
- frames = (xfer->ux_nframes + (ufrperframe - 1)) / ufrperframe;
+ frames = howmany(xfer->ux_nframes, ufrperframe);
for (i = 0, prev = NULL; i < frames; i++, prev = itd) {
itd = ehci_alloc_itd(sc);
@@ -4717,7 +4717,7 @@ ehci_device_isoc_transfer(struct usbd_xf
}
ufrperframe = uimax(1, USB_UFRAMES_PER_FRAME / (1 << (i - 1)));
- frames = (xfer->ux_nframes + (ufrperframe - 1)) / ufrperframe;
+ frames = howmany(xfer->ux_nframes, ufrperframe);
uframes = USB_UFRAMES_PER_FRAME / ufrperframe;
if (frames == 0) {