malloc(9) -> kmem(9)

This commit is contained in:
thorpej 2020-11-18 02:22:16 +00:00
parent 6f97a7c12d
commit 5586c60c5a
4 changed files with 22 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpib.c,v 1.40 2019/11/10 21:16:27 chs Exp $ */
/* $NetBSD: hpib.c,v 1.41 2020/11/18 02:22:16 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -65,12 +65,12 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.40 2019/11/10 21:16:27 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.41 2020/11/18 02:22:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/device.h>
#include <hp300/dev/dmavar.h>
@ -161,7 +161,7 @@ hpibbusattach(device_t parent, device_t self, void *aux)
/*
* Initialize the DMA queue entry.
*/
sc->sc_dq = malloc(sizeof(struct dmaqueue), M_DEVBUF, M_WAITOK);
sc->sc_dq = kmem_alloc(sizeof(struct dmaqueue), KM_SLEEP);
sc->sc_dq->dq_softc = sc;
sc->sc_dq->dq_start = hpibstart;
sc->sc_dq->dq_done = hpibdone;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ppi.c,v 1.47 2018/09/03 16:29:24 riastradh Exp $ */
/* $NetBSD: ppi.c,v 1.48 2020/11/18 02:22:16 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.47 2018/09/03 16:29:24 riastradh Exp $");
__KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.48 2020/11/18 02:22:16 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: ppi.c,v 1.47 2018/09/03 16:29:24 riastradh Exp $");
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/proc.h>
#include <sys/uio.h>
@ -299,7 +299,7 @@ ppirw(dev_t dev, struct uio *uio)
int s, s2, len, cnt;
char *cp;
int error = 0, gotdata = 0;
int buflen, ctlr, slave;
int ctlr, slave;
char *buf;
if (uio->uio_resid == 0)
@ -314,8 +314,8 @@ ppirw(dev_t dev, struct uio *uio)
dev, uio, uio->uio_rw == UIO_READ ? 'R' : 'W',
sc->sc_burst, sc->sc_timo, uio->uio_resid);
#endif
buflen = uimin(sc->sc_burst, uio->uio_resid);
buf = (char *)malloc(buflen, M_DEVBUF, M_WAITOK);
const int buflen = uimin(sc->sc_burst, uio->uio_resid);
buf = kmem_alloc(buflen, KM_SLEEP);
sc->sc_flags |= PPIF_UIO;
if (sc->sc_timo > 0) {
sc->sc_flags |= PPIF_TIMO;
@ -442,7 +442,7 @@ again:
len-cnt);
#endif
}
free(buf, M_DEVBUF);
kmem_free(buf, buflen);
#ifdef DEBUG
if (ppidebug & (PDB_FOLLOW|PDB_IO))
printf("ppirw: return %d, resid %d\n", error, uio->uio_resid);

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.107 2019/11/10 21:16:27 chs Exp $ */
/* $NetBSD: autoconf.c,v 1.108 2020/11/18 02:22:16 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc.
@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.107 2019/11/10 21:16:27 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.108 2020/11/18 02:22:16 thorpej Exp $");
#include "dvbox.h"
#include "gbox.h"
@ -108,7 +108,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.107 2019/11/10 21:16:27 chs Exp $");
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/disklabel.h>
#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/extent.h>
#include <sys/mount.h>
#include <sys/queue.h>
@ -395,7 +395,7 @@ device_register(device_t dev, void *aux)
* we can mount as root.
*/
dd = malloc(sizeof(struct dev_data), M_DEVBUF, M_WAITOK | M_ZERO);
dd = kmem_zalloc(sizeof(*dd), KM_SLEEP);
dd->dd_dev = dev;
/*
@ -439,7 +439,7 @@ device_register(device_t dev, void *aux)
/*
* Didn't need the dev_data.
*/
free(dd, M_DEVBUF);
kmem_free(dd, sizeof(*dd));
return;
linkup:
@ -677,7 +677,7 @@ setbootdev(void)
for (dd = LIST_FIRST(&dev_data_list); dd != NULL; ) {
cdd = dd;
dd = LIST_NEXT(dd, dd_list);
free(cdd, M_DEVBUF);
kmem_free(cdd, sizeof(*cdd));
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.43 2019/11/10 21:16:27 chs Exp $ */
/* $NetBSD: intr.c,v 1.44 2020/11/18 02:22:16 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997, 1999 The NetBSD Foundation, Inc.
@ -34,13 +34,13 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.43 2019/11/10 21:16:27 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.44 2020/11/18 02:22:16 thorpej Exp $");
#define _HP300_INTR_H_PRIVATE
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kmem.h>
#include <sys/vmmeter.h>
#include <sys/cpu.h>
#include <sys/intr.h>
@ -108,7 +108,7 @@ intr_establish(int (*func)(void *), void *arg, int ipl, int priority)
if ((ipl < 0) || (ipl >= NISR))
panic("intr_establish: bad ipl %d", ipl);
newih = malloc(sizeof(struct hp300_intrhand), M_DEVBUF, M_WAITOK);
newih = kmem_alloc(sizeof(*newih), KM_SLEEP);
newih->ih_fn = func;
newih->ih_arg = arg;
newih->ih_ipl = ipl;
@ -168,7 +168,7 @@ intr_disestablish(void *arg)
struct hp300_intrhand *ih = arg;
LIST_REMOVE(ih, ih_q);
free(ih, M_DEVBUF);
kmem_free(ih, sizeof(*ih));
}
/*