Module Name:    src
Committed By:   thorpej
Date:           Sat Nov 21 21:23:49 UTC 2020

Modified Files:
        src/sys/arch/hpcmips/dev: plum.c plumiobus.c plumohci.c ucbsnd.c
        src/sys/arch/hpcmips/hpcmips: bus_dma.c
        src/sys/arch/hpcmips/tx: tx39icu.c txcom.c
        src/sys/arch/hpcmips/vr: flash_vrip.c vr4181giu.c vrc4172gpio.c vrgiu.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/hpcmips/dev/plum.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/hpcmips/dev/plumiobus.c \
    src/sys/arch/hpcmips/dev/plumohci.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/hpcmips/dev/ucbsnd.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/hpcmips/hpcmips/bus_dma.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/hpcmips/tx/tx39icu.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/hpcmips/tx/txcom.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/hpcmips/vr/flash_vrip.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/hpcmips/vr/vr4181giu.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hpcmips/vr/vrc4172gpio.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hpcmips/vr/vrgiu.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/arch/hpcmips/dev/plum.c
diff -u src/sys/arch/hpcmips/dev/plum.c:1.17 src/sys/arch/hpcmips/dev/plum.c:1.18
--- src/sys/arch/hpcmips/dev/plum.c:1.17	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/dev/plum.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $ */
+/*	$NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -103,8 +103,7 @@ plum_attach(device_t parent, device_t se
 		printf(": Plum2 #2\n");
 		break;
 	}
-	sc->sc_pc = malloc(sizeof(struct plum_chipset_tag),
-	    M_DEVBUF, M_WAITOK | M_ZERO);
+	sc->sc_pc = kmem_zalloc(sizeof(struct plum_chipset_tag), KM_SLEEP);
 	sc->sc_pc->pc_tc = ca->ca_tc;
 	
 	/* Attach Plum devices */

Index: src/sys/arch/hpcmips/dev/plumiobus.c
diff -u src/sys/arch/hpcmips/dev/plumiobus.c:1.15 src/sys/arch/hpcmips/dev/plumiobus.c:1.16
--- src/sys/arch/hpcmips/dev/plumiobus.c:1.15	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/dev/plumiobus.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $ */
+/*	$NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -30,14 +30,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
 
 #define PLUMIOBUSDEBUG
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -172,7 +172,7 @@ __plumiobus_subregion(bus_space_tag_t t,
 {
 	struct hpcmips_bus_space *hbs;
 	
-	hbs = malloc(sizeof(*hbs), M_DEVBUF, M_WAITOK);
+	hbs = kmem_alloc(sizeof(*hbs), KM_SLEEP);
 	*hbs = *t;
 	hbs->t_base += ofs;
 	hbs->t_size = size;
Index: src/sys/arch/hpcmips/dev/plumohci.c
diff -u src/sys/arch/hpcmips/dev/plumohci.c:1.15 src/sys/arch/hpcmips/dev/plumohci.c:1.16
--- src/sys/arch/hpcmips/dev/plumohci.c:1.15	Sat Apr 23 10:15:29 2016
+++ src/sys/arch/hpcmips/dev/plumohci.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $ */
+/*	$NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: plumohci.c,v
 #include <sys/device.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
+#include <sys/kmem.h>
 
 /* busdma */
 #include <sys/mbuf.h>
@@ -247,7 +248,7 @@ __plumohci_dmamem_alloc(bus_dma_tag_t tx
 
 	pmap_extract(pmap_kernel(), (vaddr_t)caddr, &paddr);
 
-	ps = malloc(sizeof(struct plumohci_shm), M_DEVBUF, M_NOWAIT);
+	ps = kmem_intr_alloc(sizeof(struct plumohci_shm), KM_NOSLEEP);
 	if (ps == 0)
 		return 1;
 
@@ -276,7 +277,7 @@ __plumohci_dmamem_free(bus_dma_tag_t tx,
 		if (ps->ps_paddr == segs[0].ds_addr) {
 			bus_space_free(sc->sc.iot, ps->ps_bsh, ps->ps_size);
 			LIST_REMOVE(ps, ps_link);
-			free(ps, M_DEVBUF);
+			kmem_intr_free(ps, sizeof(*ps));
 
 			return;
 		}

Index: src/sys/arch/hpcmips/dev/ucbsnd.c
diff -u src/sys/arch/hpcmips/dev/ucbsnd.c:1.25 src/sys/arch/hpcmips/dev/ucbsnd.c:1.26
--- src/sys/arch/hpcmips/dev/ucbsnd.c:1.25	Sat Dec 17 03:46:52 2016
+++ src/sys/arch/hpcmips/dev/ucbsnd.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucbsnd.c,v 1.25 2016/12/17 03:46:52 riastradh Exp $ */
+/*	$NetBSD: ucbsnd.c,v 1.26 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -37,14 +37,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ucbsnd.c,v 1.25 2016/12/17 03:46:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucbsnd.c,v 1.26 2020/11/21 21:23:48 thorpej Exp $");
 
 #include "opt_use_poll.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/conf.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/device.h>
 #include <sys/proc.h>
 #include <sys/endian.h>
@@ -658,7 +658,7 @@ ringbuf_allocate(struct ring_buf *rb, si
 	rb->rb_blksize = blksize;
 	rb->rb_maxblks = maxblk;
 #if notyet
-	rb->rb_buf = (u_int32_t)malloc(rb->rb_bufsize, M_DEVBUF, M_WAITOK);
+	rb->rb_buf = (u_int32_t)kmem_alloc(rb->rb_bufsize, KM_SLEEP);
 #else
 	rb->rb_buf = (u_int32_t)dmabuf_static;
 #endif
@@ -668,8 +668,7 @@ ringbuf_allocate(struct ring_buf *rb, si
 	}
 	memset((char*)rb->rb_buf, 0, rb->rb_bufsize);
 #if notyet
-	rb->rb_bufcnt = malloc(rb->rb_maxblks * sizeof(size_t), M_DEVBUF,
-	    M_WAITOK);
+	rb->rb_bufcnt = kmem_alloc(rb->rb_maxblks * sizeof(size_t), KM_SLEEP);
 #else
 	rb->rb_bufcnt = dmabufcnt_static;
 #endif
@@ -688,8 +687,8 @@ void
 ringbuf_deallocate(struct ring_buf *rb)
 {
 #if notyet
-	free((void*)rb->rb_buf, M_DEVBUF);
-	free(rb->rb_bufcnt, M_DEVBUF);
+	kmem_free((void*)rb->rb_buf, rb->rb_bufsize);
+	kmem_free(rb->rb_bufcnt, rb->rb_maxblks * sizeof(size_t));
 #endif
 }
 

Index: src/sys/arch/hpcmips/hpcmips/bus_dma.c
diff -u src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.39 src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.40
--- src/sys/arch/hpcmips/hpcmips/bus_dma.c:1.39	Thu Jun 11 08:22:09 2015
+++ src/sys/arch/hpcmips/hpcmips/bus_dma.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.40 2020/11/21 21:23:48 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,12 +31,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.40 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/mbuf.h>
 #include <sys/proc.h>
+#include <sys/kmem.h>
 
 #include <uvm/uvm_extern.h>
 #include <mips/cache.h>
@@ -77,6 +78,15 @@ struct bus_dma_tag_hpcmips hpcmips_defau
 	NULL,
 };
 
+static size_t
+_bus_dmamap_mapsize(int const nsegments)
+{ 
+	KASSERT(nsegments > 0);
+	return sizeof(struct bus_dmamap_hpcmips) +
+	    sizeof(struct bus_dma_segment_hpcmips) * (nsegments - 1) +
+	    sizeof(bus_dma_segment_t) * nsegments;
+}
+
 /*
  * Common function for DMA map creation.  May be called by bus-specific
  * DMA map creation functions.
@@ -87,7 +97,6 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, 
 {
 	struct bus_dmamap_hpcmips *map;
 	void *mapstore;
-	size_t mapsize;
 
 	/*
 	 * Allocate and initialize the DMA map.  The end of the map
@@ -98,14 +107,10 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, 
 	 * of ALLOCNOW notifies others that we've reserved these resources,
 	 * and they are not to be freed.
 	 */
-	mapsize = sizeof(struct bus_dmamap_hpcmips) +
-	    sizeof(struct bus_dma_segment_hpcmips) * (nsegments - 1) +
-	    sizeof(bus_dma_segment_t) * nsegments;
-	if ((mapstore = malloc(mapsize, M_DMAMAP,
-	    (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
+	if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
+	    (flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
 		return (ENOMEM);
 
-	memset(mapstore, 0, mapsize);
 	map = (struct bus_dmamap_hpcmips *)mapstore;
 	map->_dm_size = size;
 	map->_dm_segcnt = nsegments;
@@ -128,10 +133,12 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, 
  * DMA map destruction functions.
  */
 void
-_hpcmips_bd_map_destroy(bus_dma_tag_t t, bus_dmamap_t map)
+_hpcmips_bd_map_destroy(bus_dma_tag_t t, bus_dmamap_t bdm)
 {
+	struct bus_dmamap_hpcmips *map =
+	    container_of(bdm, struct bus_dmamap_hpcmips, bdm);
 
-	free(map, M_DMAMAP);
+	kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
 }
 
 /*

Index: src/sys/arch/hpcmips/tx/tx39icu.c
diff -u src/sys/arch/hpcmips/tx/tx39icu.c:1.36 src/sys/arch/hpcmips/tx/tx39icu.c:1.37
--- src/sys/arch/hpcmips/tx/tx39icu.c:1.36	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/tx/tx39icu.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $ */
+/*	$NetBSD: tx39icu.c,v 1.37 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.37 2020/11/21 21:23:48 thorpej Exp $");
 
 #include "opt_vr41xx.h"
 #include "opt_tx39xx.h"
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/queue.h>
 #include <sys/cpu.h>
 
@@ -507,7 +507,7 @@ tx39_irqhigh_establish(tx_chipset_tag_t 
 	/*
 	 *	Add new entry to `pri' priority
 	 */
-	he = malloc(sizeof(struct txintr_high_entry), M_DEVBUF, M_WAITOK | M_ZERO);
+	he = kmem_zalloc(sizeof(*he), KM_SLEEP);
 	he->he_set = set;
 	he->he_mask= (1 << bit);
 	he->he_fun = ih_fun;
@@ -532,7 +532,7 @@ tx39_irqhigh_disestablish(tx_chipset_tag
 	TAILQ_FOREACH(he, &sc->sc_he_head[pri], he_link) {
 		if (he->he_set == set && he->he_mask == (1 << bit)) {
 			TAILQ_REMOVE(&sc->sc_he_head[pri], he, he_link);
-			free(he, M_DEVBUF);
+			kmem_free(he, sizeof(*he));
 			break;
 		}
 	}
@@ -627,7 +627,7 @@ tx39_poll_establish(tx_chipset_tag_t tc,
 	int s;
 	void *ret;
 	
-	p = malloc(sizeof(*p), M_DEVBUF, M_WAITOK | M_ZERO);
+	p = kmem_zalloc(sizeof(*p), KM_SLEEP);
 	p->p_fun = ih_fun;
 	p->p_arg = ih_arg;
 	p->p_cnt = interval;
@@ -644,7 +644,7 @@ tx39_poll_establish(tx_chipset_tag_t tc,
 			printf("tx39_poll_establish: can't hook\n");
 
 			splx(s);
-			free(p, M_DEVBUF);
+			kmem_free(p, sizeof(*p));
 			return (0);
 		}
 	}
@@ -672,7 +672,7 @@ tx39_poll_disestablish(tx_chipset_tag_t 
 	TAILQ_FOREACH(p, &sc->sc_p_head, p_link) {
 		if (p->p_desc == desc) {
 			TAILQ_REMOVE(&sc->sc_p_head, p, p_link);
-			free(p, M_DEVBUF);
+			kmem_free(p, sizeof(*p));
 			break;
 		}
 	}
@@ -709,7 +709,7 @@ tx39_poll_intr(void *arg)
 
  disestablish:
 	TAILQ_REMOVE(&sc->sc_p_head, p, p_link);
-	free(p, M_DEVBUF);
+	kmem_free(p, sizeof(*p));
 	if (TAILQ_EMPTY(&sc->sc_p_head)) {
 		sc->sc_polling = 0;
 		tx_intr_disestablish(sc->sc_tc, sc->sc_poll_ih);

Index: src/sys/arch/hpcmips/tx/txcom.c
diff -u src/sys/arch/hpcmips/tx/txcom.c:1.49 src/sys/arch/hpcmips/tx/txcom.c:1.50
--- src/sys/arch/hpcmips/tx/txcom.c:1.49	Sat Nov 15 19:20:01 2014
+++ src/sys/arch/hpcmips/tx/txcom.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: txcom.c,v 1.49 2014/11/15 19:20:01 christos Exp $ */
+/*	$NetBSD: txcom.c,v 1.50 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.49 2014/11/15 19:20:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.50 2020/11/21 21:23:48 thorpej Exp $");
 
 #include "opt_tx39uart_debug.h"
 
@@ -38,7 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kauth.h>
 
 #include <sys/proc.h> /* tsleep/wakeup */
@@ -215,12 +215,8 @@ txcom_attach(device_t parent, device_t s
 	if (console) {
 		sc->sc_chip = &txcom_chip;
 	} else {
-		if (!(sc->sc_chip = malloc(sizeof(struct txcom_chip),
-		    M_DEVBUF, M_WAITOK))) {
-			printf(": can't allocate chip\n");
-			return;
-		}
-		memset(sc->sc_chip, 0, sizeof(struct txcom_chip));
+		sc->sc_chip = kmem_zalloc(sizeof(struct txcom_chip),
+		    KM_SLEEP);
 	}
 
 	chip = sc->sc_chip;
@@ -233,11 +229,7 @@ txcom_attach(device_t parent, device_t s
 	if (!console)
 		txcom_reset(chip);
 
-	if (!(sc->sc_rbuf = malloc(TXCOM_RING_SIZE, M_DEVBUF, M_WAITOK))) {
-		printf(": can't allocate buffer.\n");
-		return;
-	}
-	memset(sc->sc_rbuf, 0, TXCOM_RING_SIZE);
+	sc->sc_rbuf = kmem_zalloc(TXCOM_RING_SIZE, KM_SLEEP);
 
 	tp = tty_alloc();
 	tp->t_oproc = txcomstart;

Index: src/sys/arch/hpcmips/vr/flash_vrip.c
diff -u src/sys/arch/hpcmips/vr/flash_vrip.c:1.12 src/sys/arch/hpcmips/vr/flash_vrip.c:1.13
--- src/sys/arch/hpcmips/vr/flash_vrip.c:1.12	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/vr/flash_vrip.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $ */
+/* $NetBSD: flash_vrip.c,v 1.13 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,13 +34,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.13 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
 
@@ -262,7 +262,7 @@ flash_attach(device_t parent, device_t s
 			sc->sc_block_size = block_size;
 	}
 	
-	sc->sc_buf = malloc(sc->sc_block_size, M_DEVBUF, M_WAITOK);
+	sc->sc_buf = kmem_alloc(sc->sc_block_size, KM_SLEEP);
 
 	sc->sc_write_buffer_size
 		= 1 << (sc->sc_cfi_raw[CFI_MAX_WBUF_SIZE_REG0]

Index: src/sys/arch/hpcmips/vr/vr4181giu.c
diff -u src/sys/arch/hpcmips/vr/vr4181giu.c:1.5 src/sys/arch/hpcmips/vr/vr4181giu.c:1.6
--- src/sys/arch/hpcmips/vr/vr4181giu.c:1.5	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/vr/vr4181giu.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $ */
+/* $NetBSD: vr4181giu.c,v 1.6 2020/11/21 21:23:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,11 +35,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.6 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/queue.h>
 #include <sys/systm.h>
 
@@ -325,7 +325,7 @@ vr4181giu_intr_establish(
 
 	s = splhigh();
 
-	ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof *ih, KM_SLEEP);
 	ih->ih_port = port;
 	ih->ih_fun = ih_fun;
 	ih->ih_arg = ih_arg;

Index: src/sys/arch/hpcmips/vr/vrc4172gpio.c
diff -u src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.14 src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.15
--- src/sys/arch/hpcmips/vr/vrc4172gpio.c:1.14	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/vr/vrc4172gpio.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $	*/
+/*	$NetBSD: vrc4172gpio.c,v 1.15 2020/11/21 21:23:48 thorpej Exp $	*/
 /*-
  * Copyright (c) 2001 TAKEMRUA Shin. All rights reserved.
  *
@@ -29,12 +29,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.15 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/queue.h>
 #include <sys/reboot.h>
 #include <machine/bus.h>
@@ -498,7 +498,7 @@ vrc4172gpio_intr_establish(
 	mask2 = (1 << (port % 8));
 	intlv_reg = intlv_regs[port/8];
 
-	ih = malloc(sizeof(struct vrc4172gpio_intr_entry), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_port = port;
 	ih->ih_fun = ih_fun;
 	ih->ih_arg = ih_arg;
@@ -589,7 +589,7 @@ vrc4172gpio_intr_disestablish(hpcio_chip
 	TAILQ_FOREACH(ih, &sc->sc_intr_head[port], ih_link) {
 		if (ih == ihe) {
 			TAILQ_REMOVE(&sc->sc_intr_head[port], ih, ih_link);
-			free(ih, M_DEVBUF);
+			kmem_free(ih, sizeof(*ih));
 			if (TAILQ_EMPTY(&sc->sc_intr_head[port])) {
 				/* disable interrupt */
 				sc->sc_intr_mask &= ~(1<<port);

Index: src/sys/arch/hpcmips/vr/vrgiu.c
diff -u src/sys/arch/hpcmips/vr/vrgiu.c:1.43 src/sys/arch/hpcmips/vr/vrgiu.c:1.44
--- src/sys/arch/hpcmips/vr/vrgiu.c:1.43	Sun Nov 10 21:16:28 2019
+++ src/sys/arch/hpcmips/vr/vrgiu.c	Sat Nov 21 21:23:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $	*/
+/*	$NetBSD: vrgiu.c,v 1.44 2020/11/21 21:23:48 thorpej Exp $	*/
 /*-
  * Copyright (c) 1999-2001
  *         Shin Takemura and PocketBSD Project. All rights reserved.
@@ -34,12 +34,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.44 2020/11/21 21:23:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/queue.h>
 #include <sys/reboot.h>
 
@@ -534,7 +534,7 @@ vrgiu_intr_establish(
 
 	s = splhigh();
 
-	ih = malloc(sizeof(struct vrgiu_intr_entry), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	DPRINTF(DEBUG_INTR, ("%s: port %d ", device_xname(sc->sc_dev), port));
 	ih->ih_port = port;
 	ih->ih_fun = ih_fun;
@@ -625,7 +625,7 @@ vrgiu_intr_disestablish(hpcio_chip_t hc,
 	TAILQ_FOREACH(ih, &sc->sc_intr_head[port], ih_link) {
 		if (ih == ihe) {
 			TAILQ_REMOVE(&sc->sc_intr_head[port], ih, ih_link);
-			free(ih, M_DEVBUF);
+			kmem_free(ih, sizeof(*ih));
 			if (TAILQ_EMPTY(&sc->sc_intr_head[port])) {
 				/* Disable interrupt */
 #ifdef WINCE_DEFAULT_SETTING

Reply via email to