Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/hp300 malloc(9) -> kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/9b7f77fb413e
branches:  trunk
changeset: 978344:9b7f77fb413e
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Nov 18 02:22:16 2020 +0000

description:
malloc(9) -> kmem(9)

diffstat:

 sys/arch/hp300/dev/hpib.c       |   8 ++++----
 sys/arch/hp300/dev/ppi.c        |  14 +++++++-------
 sys/arch/hp300/hp300/autoconf.c |  12 ++++++------
 sys/arch/hp300/hp300/intr.c     |  10 +++++-----
 4 files changed, 22 insertions(+), 22 deletions(-)

diffs (186 lines):

diff -r 8ba5a62a62fb -r 9b7f77fb413e sys/arch/hp300/dev/hpib.c
--- a/sys/arch/hp300/dev/hpib.c Wed Nov 18 02:04:29 2020 +0000
+++ b/sys/arch/hp300/dev/hpib.c Wed Nov 18 02:22:16 2020 +0000
@@ -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 @@
        /*
         * 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;
diff -r 8ba5a62a62fb -r 9b7f77fb413e sys/arch/hp300/dev/ppi.c
--- a/sys/arch/hp300/dev/ppi.c  Wed Nov 18 02:04:29 2020 +0000
+++ b/sys/arch/hp300/dev/ppi.c  Wed Nov 18 02:22:16 2020 +0000
@@ -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 @@
 #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 @@
        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 @@
                       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 @@
                               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);
diff -r 8ba5a62a62fb -r 9b7f77fb413e sys/arch/hp300/hp300/autoconf.c
--- a/sys/arch/hp300/hp300/autoconf.c   Wed Nov 18 02:04:29 2020 +0000
+++ b/sys/arch/hp300/hp300/autoconf.c   Wed Nov 18 02:22:16 2020 +0000
@@ -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 @@
 #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 @@
         * 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 @@
        /*
         * Didn't need the dev_data.
         */
-       free(dd, M_DEVBUF);
+       kmem_free(dd, sizeof(*dd));
        return;
 
  linkup:
@@ -677,7 +677,7 @@
        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));
        }
 }
 
diff -r 8ba5a62a62fb -r 9b7f77fb413e sys/arch/hp300/hp300/intr.c
--- a/sys/arch/hp300/hp300/intr.c       Wed Nov 18 02:04:29 2020 +0000
+++ b/sys/arch/hp300/hp300/intr.c       Wed Nov 18 02:22:16 2020 +0000
@@ -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 @@
        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 @@
        struct hp300_intrhand *ih = arg;
 
        LIST_REMOVE(ih, ih_q);
-       free(ih, M_DEVBUF);
+       kmem_free(ih, sizeof(*ih));
 }
 
 /*



Home | Main Index | Thread Index | Old Index