Module Name: src Committed By: thorpej Date: Wed Nov 18 02:22:17 UTC 2020
Modified Files: src/sys/arch/hp300/dev: hpib.c ppi.c src/sys/arch/hp300/hp300: autoconf.c intr.c Log Message: malloc(9) -> kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/hp300/dev/hpib.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/hp300/dev/ppi.c cvs rdiff -u -r1.107 -r1.108 src/sys/arch/hp300/hp300/autoconf.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/hp300/hp300/intr.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/hp300/dev/hpib.c diff -u src/sys/arch/hp300/dev/hpib.c:1.40 src/sys/arch/hp300/dev/hpib.c:1.41 --- src/sys/arch/hp300/dev/hpib.c:1.40 Sun Nov 10 21:16:27 2019 +++ src/sys/arch/hp300/dev/hpib.c Wed Nov 18 02:22:16 2020 @@ -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 /* * 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; Index: src/sys/arch/hp300/dev/ppi.c diff -u src/sys/arch/hp300/dev/ppi.c:1.47 src/sys/arch/hp300/dev/ppi.c:1.48 --- src/sys/arch/hp300/dev/ppi.c:1.47 Mon Sep 3 16:29:24 2018 +++ src/sys/arch/hp300/dev/ppi.c Wed Nov 18 02:22:16 2020 @@ -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 #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); Index: src/sys/arch/hp300/hp300/autoconf.c diff -u src/sys/arch/hp300/hp300/autoconf.c:1.107 src/sys/arch/hp300/hp300/autoconf.c:1.108 --- src/sys/arch/hp300/hp300/autoconf.c:1.107 Sun Nov 10 21:16:27 2019 +++ src/sys/arch/hp300/hp300/autoconf.c Wed Nov 18 02:22:16 2020 @@ -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 #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)); } } Index: src/sys/arch/hp300/hp300/intr.c diff -u src/sys/arch/hp300/hp300/intr.c:1.43 src/sys/arch/hp300/hp300/intr.c:1.44 --- src/sys/arch/hp300/hp300/intr.c:1.43 Sun Nov 10 21:16:27 2019 +++ src/sys/arch/hp300/hp300/intr.c Wed Nov 18 02:22:16 2020 @@ -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 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)); } /*