Module Name: src Committed By: skrll Date: Fri May 15 06:26:44 UTC 2020
Modified Files: src/sys/dev/usb: usb_mem.c Log Message: Use howmany. NFC. To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/dev/usb/usb_mem.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/usb_mem.c diff -u src/sys/dev/usb/usb_mem.c:1.76 src/sys/dev/usb/usb_mem.c:1.77 --- src/sys/dev/usb/usb_mem.c:1.76 Sun Apr 5 20:59:38 2020 +++ src/sys/dev/usb/usb_mem.c Fri May 15 06:26:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_mem.c,v 1.76 2020/04/05 20:59:38 skrll Exp $ */ +/* $NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.76 2020/04/05 20:59:38 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.77 2020/05/15 06:26:44 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -152,7 +152,7 @@ usb_block_allocmem(bus_dma_tag_t tag, si /* Caller wants one segment */ b->nsegs = 1; else - b->nsegs = (size + (PAGE_SIZE-1)) / PAGE_SIZE; + b->nsegs = howmany(size, PAGE_SIZE); b->segs = kmem_alloc(b->nsegs * sizeof(*b->segs), KM_SLEEP); b->nsegs_alloc = b->nsegs;