summaryrefslogtreecommitdiff
path: root/sys/dev/hyperv
diff options
context:
space:
mode:
authornonaka <nonaka@NetBSD.org>2020-05-25 10:14:58 +0000
committernonaka <nonaka@NetBSD.org>2020-05-25 10:14:58 +0000
commit4274ee6381000dc1edfcf1139b5f2936a8b18b3c (patch)
tree71aa29ea3a95d4118391b6178427b9dbe3502c25 /sys/dev/hyperv
parentcf283744321816dcc37c183af40f6f261c0f7b64 (diff)
Use howmany() macro.
Diffstat (limited to 'sys/dev/hyperv')
-rw-r--r--sys/dev/hyperv/hvs.c6
-rw-r--r--sys/dev/hyperv/vmbus.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/hyperv/hvs.c b/sys/dev/hyperv/hvs.c
index 85ca3ed96dd..b7d74957a48 100644
--- a/sys/dev/hyperv/hvs.c
+++ b/sys/dev/hyperv/hvs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $ */
+/* $NetBSD: hvs.c,v 1.4 2020/05/25 10:14:58 nonaka Exp $ */
/* $OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $ */
/*-
@@ -37,7 +37,7 @@
/* #define HVS_DEBUG_IO */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.4 2020/05/25 10:14:58 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -180,7 +180,7 @@ union hvs_cmd {
#define HVS_RING_SIZE (20 * PAGE_SIZE)
#define HVS_MAX_CCB 128
-#define HVS_MAX_SGE (MAXPHYS / PAGE_SIZE + 1)
+#define HVS_MAX_SGE (howmany(MAXPHYS, PAGE_SIZE) + 1)
struct hvs_softc;
diff --git a/sys/dev/hyperv/vmbus.c b/sys/dev/hyperv/vmbus.c
index e410697942f..2d9111b98f9 100644
--- a/sys/dev/hyperv/vmbus.c
+++ b/sys/dev/hyperv/vmbus.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vmbus.c,v 1.8 2019/12/10 12:20:20 nonaka Exp $ */
+/* $NetBSD: vmbus.c,v 1.9 2020/05/25 10:14:58 nonaka Exp $ */
/* $OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $ */
/*-
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.8 2019/12/10 12:20:20 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.9 2020/05/25 10:14:58 nonaka Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1911,7 +1911,7 @@ vmbus_handle_alloc(struct vmbus_channel *ch, const struct hyperv_dma *dma,
/* Allocate additional gpadl_body structures if required */
if (left > 0) {
- ncmds = MAX(1, left / VMBUS_NPFNBODY + left % VMBUS_NPFNBODY);
+ ncmds = howmany(left, VMBUS_NPFNBODY);
bodylen = ncmds * VMBUS_MSG_DSIZE_MAX;
body = kmem_zalloc(bodylen, kmemflags);
if (body == NULL) {