Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm malloc -> kmem



details:   https://anonhg.NetBSD.org/src/rev/787431b76c23
branches:  trunk
changeset: 370742:787431b76c23
user:      skrll <skrll%NetBSD.org@localhost>
date:      Tue Sep 27 06:12:58 2022 +0000

description:
malloc -> kmem

diffstat:

 sys/arch/arm/iomd/vidcaudio.c       |  15 +++++++++------
 sys/arch/arm/sunxi/sunxi_can.c      |   7 +++----
 sys/arch/arm/xscale/ixp425_if_npe.c |  12 +++++-------
 sys/arch/arm/xscale/ixp425_qmgr.c   |  12 ++++++------
 4 files changed, 23 insertions(+), 23 deletions(-)

diffs (186 lines):

diff -r 4e479730d694 -r 787431b76c23 sys/arch/arm/iomd/vidcaudio.c
--- a/sys/arch/arm/iomd/vidcaudio.c     Tue Sep 27 06:12:19 2022 +0000
+++ b/sys/arch/arm/iomd/vidcaudio.c     Tue Sep 27 06:12:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vidcaudio.c,v 1.61 2021/02/03 14:22:21 isaki Exp $     */
+/*     $NetBSD: vidcaudio.c,v 1.62 2022/09/27 06:14:41 skrll Exp $     */
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson
@@ -65,13 +65,13 @@
 
 #include <sys/param.h> /* proc.h */
 
-__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.61 2021/02/03 14:22:21 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.62 2022/09/27 06:14:41 skrll Exp $");
 
 #include <sys/audioio.h>
 #include <sys/conf.h>   /* autoconfig functions */
 #include <sys/device.h> /* device calls */
 #include <sys/errno.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/proc.h>  /* device calls */
 #include <sys/systm.h>
 
@@ -121,6 +121,7 @@
        vaddr_t sc_poffset;
        vaddr_t sc_pbufsize;
        paddr_t *sc_ppages;
+       size_t  sc_szppages;
        void    (*sc_pintr)(void *);
        void    *sc_parg;
        int     sc_pcountdown;
@@ -294,8 +295,9 @@
        DPRINTF(("DEBUG: vidcaudio_close called\n"));
        sc = addr;
        if (sc->sc_ppages != NULL) {
-               free(sc->sc_ppages, M_DEVBUF);
+               kmem_free(sc->sc_ppages, sc->sc_szppages * sizeof(paddr_t));
                sc->sc_ppages = NULL;
+               sc->sc_szppages = 0;
        }
 }
 
@@ -390,8 +392,9 @@
        sc->sc_pbufsize = (char *)end - (char *)start;
        npages = sc->sc_pbufsize >> PGSHIFT;
        if (sc->sc_ppages != NULL)
-               free(sc->sc_ppages, M_DEVBUF);
-       sc->sc_ppages = malloc(npages * sizeof(paddr_t), M_DEVBUF, M_WAITOK);
+               kmem_free(sc->sc_ppages, sc->sc_szppages);
+       sc->sc_szppages = npages * sizeof(paddr_t);
+       sc->sc_ppages = kmem_alloc(sc->sc_szppages, KM_SLEEP);
        if (sc->sc_ppages == NULL)
                return ENOMEM;
        for (i = 0; i < npages; i++)
diff -r 4e479730d694 -r 787431b76c23 sys/arch/arm/sunxi/sunxi_can.c
--- a/sys/arch/arm/sunxi/sunxi_can.c    Tue Sep 27 06:12:19 2022 +0000
+++ b/sys/arch/arm/sunxi/sunxi_can.c    Tue Sep 27 06:12:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunxi_can.c,v 1.11 2022/09/21 20:21:16 bouyer Exp $    */
+/*     $NetBSD: sunxi_can.c,v 1.12 2022/09/27 06:14:13 skrll Exp $     */
 
 /*-
  * Copyright (c) 2017,2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.11 2022/09/21 20:21:16 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_can.c,v 1.12 2022/09/27 06:14:13 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -232,8 +232,7 @@
        rnd_attach_source(&sc->sc_rnd_source, device_xname(self),
            RND_TYPE_NET, RND_FLAG_DEFAULT);
 #ifdef MBUFTRACE
-       ifp->if_mowner = malloc(sizeof(struct mowner), M_DEVBUF,
-           M_WAITOK | M_ZERO);
+       ifp->if_mowner = kmem_zalloc(sizeof(*ifp->if_mowner), KM_SLEEP);
        strlcpy(ifp->if_mowner->mo_name, ifp->if_xname,
                sizeof(ifp->if_mowner->mo_name));
        MOWNER_ATTACH(ifp->if_mowner);
diff -r 4e479730d694 -r 787431b76c23 sys/arch/arm/xscale/ixp425_if_npe.c
--- a/sys/arch/arm/xscale/ixp425_if_npe.c       Tue Sep 27 06:12:19 2022 +0000
+++ b/sys/arch/arm/xscale/ixp425_if_npe.c       Tue Sep 27 06:12:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_if_npe.c,v 1.52 2022/09/18 15:49:42 thorpej Exp $ */
+/*     $NetBSD: ixp425_if_npe.c,v 1.53 2022/09/27 06:13:42 skrll Exp $ */
 
 /*-
  * Copyright (c) 2006 Sam Leffler.  All rights reserved.
@@ -28,7 +28,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.52 2022/09/18 15:49:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.53 2022/09/27 06:13:42 skrll Exp $");
 
 /*
  * Intel XScale NPE Ethernet driver.
@@ -52,8 +52,8 @@
 #include <sys/kernel.h>
 #include <sys/device.h>
 #include <sys/callout.h>
+#include <sys/kmem.h>
 #include <sys/mbuf.h>
-#include <sys/malloc.h>
 #include <sys/socket.h>
 #include <sys/endian.h>
 #include <sys/ioctl.h>
@@ -468,9 +468,7 @@
                goto unmap_dmamem;
        }
 
-       /* XXX M_TEMP */
-       dma->buf = malloc(nbuf * sizeof(struct npebuf), M_TEMP,
-           M_WAITOK | M_ZERO);
+       dma->buf = kmem_zalloc(nbuf * sizeof(struct npebuf), KM_SLEEP);
        dma->buf_phys = dma->buf_map->dm_segs[0].ds_addr;
        for (i = 0; i < dma->nbuf; i++) {
                struct npebuf *npe = &dma->buf[i];
@@ -514,7 +512,7 @@
                bus_dmamap_destroy(sc->sc_dt, dma->buf_map);
        }
        if (dma->buf != NULL)
-               free(dma->buf, M_TEMP);
+               kmem_free(dma->buf, dma->nbuf * sizeof(struct npebuf));
        memset(dma, 0, sizeof(*dma));
 }
 #endif
diff -r 4e479730d694 -r 787431b76c23 sys/arch/arm/xscale/ixp425_qmgr.c
--- a/sys/arch/arm/xscale/ixp425_qmgr.c Tue Sep 27 06:12:19 2022 +0000
+++ b/sys/arch/arm/xscale/ixp425_qmgr.c Tue Sep 27 06:12:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_qmgr.c,v 1.11 2021/12/10 20:36:02 andvar Exp $  */
+/*     $NetBSD: ixp425_qmgr.c,v 1.12 2022/09/27 06:12:58 skrll Exp $   */
 
 /*-
  * Copyright (c) 2006 Sam Leffler, Errno Consulting
@@ -60,7 +60,7 @@
 */
 #include <sys/cdefs.h>
 /*__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_qmgr.c,v 1.1 2006/11/19 23:55:23 sam Exp $");*/
-__KERNEL_RCSID(0, "$NetBSD: ixp425_qmgr.c,v 1.11 2021/12/10 20:36:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_qmgr.c,v 1.12 2022/09/27 06:12:58 skrll Exp $");
 
 /*
  * Intel XScale Queue Manager support.
@@ -80,7 +80,7 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/time.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/resource.h>
 
 #include <sys/bus.h>
@@ -229,7 +229,7 @@
        sc->sc_dev = dev;
        sc->sc_iot = sa->sc_iot;
 #else
-       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_iot = iot;
 #endif
 
@@ -252,7 +252,7 @@
            ixpqmgr_intr, sc);
        if (sc->sc_ih[0] == NULL) {
                ixpqmgr_sc = NULL;
-               free(sc, M_DEVBUF);
+               kmem_free(sc, sizeof(*sc));
                return (NULL);
        }
        sc->sc_ih[1] = ixp425_intr_establish(IXP425_INT_QUE33_64, IPL_NET,
@@ -260,7 +260,7 @@
        if (sc->sc_ih[1] == NULL) {
                ixp425_intr_disestablish(sc->sc_ih[0]);
                ixpqmgr_sc = NULL;
-               free(sc, M_DEVBUF);
+               kmem_free(sc, sizeof(*sc));
                return (NULL);
        }
 #endif



Home | Main Index | Thread Index | Old Index