Module Name: src Committed By: riastradh Date: Sat Oct 15 19:55:37 UTC 2022
Modified Files: src/sys/dev/pci: virtio.c Log Message: virtio(4): Use howmany from sys/param.h instead of open-coding it. howmany will divide by VIRTIO_PAGE_SIZE instead of doing & ~(VIRTIO_PAGE_SIZE - 1), but it's a constant 4096 so this should make no difference in the compiled output except possibly at -O0. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pci/virtio.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/pci/virtio.c diff -u src/sys/dev/pci/virtio.c:1.59 src/sys/dev/pci/virtio.c:1.60 --- src/sys/dev/pci/virtio.c:1.59 Sat Oct 15 19:53:27 2022 +++ src/sys/dev/pci/virtio.c Sat Oct 15 19:55:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: virtio.c,v 1.59 2022/10/15 19:53:27 riastradh Exp $ */ +/* $NetBSD: virtio.c,v 1.60 2022/10/15 19:55:37 riastradh Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.59 2022/10/15 19:53:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.60 2022/10/15 19:55:37 riastradh Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -760,8 +760,7 @@ virtio_alloc_vq(struct virtio_softc *sc, { int vq_size, allocsize1, allocsize2, allocsize3, allocsize = 0; int rsegs, r, hdrlen; -#define VIRTQUEUE_ALIGN(n) (((n) + (VIRTIO_PAGE_SIZE - 1)) & \ - ~(VIRTIO_PAGE_SIZE - 1)) +#define VIRTQUEUE_ALIGN(n) howmany(n, VIRTIO_PAGE_SIZE) /* Make sure callers allocate vqs in order */ KASSERT(sc->sc_nvqs == index);