Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hyperv Use howmany() macro.



details:   https://anonhg.NetBSD.org/src/rev/ed63e9c4152b
branches:  trunk
changeset: 933358:ed63e9c4152b
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Mon May 25 10:14:58 2020 +0000

description:
Use howmany() macro.

diffstat:

 sys/dev/hyperv/hvs.c   |  6 +++---
 sys/dev/hyperv/vmbus.c |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 52a5f88a1593 -r ed63e9c4152b sys/dev/hyperv/hvs.c
--- a/sys/dev/hyperv/hvs.c      Mon May 25 09:45:40 2020 +0000
+++ b/sys/dev/hyperv/hvs.c      Mon May 25 10:14:58 2020 +0000
@@ -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 @@
 
 #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 -r 52a5f88a1593 -r ed63e9c4152b sys/dev/hyperv/vmbus.c
--- a/sys/dev/hyperv/vmbus.c    Mon May 25 09:45:40 2020 +0000
+++ b/sys/dev/hyperv/vmbus.c    Mon May 25 10:14:58 2020 +0000
@@ -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 @@
 
        /* 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) {



Home | Main Index | Thread Index | Old Index