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(9) -> kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/8d8ba69aeff7
branches:  trunk
changeset: 946184:8d8ba69aeff7
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Nov 20 18:49:44 2020 +0000

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

diffstat:

 sys/arch/arm/xilinx/zynq_uart.c   |  12 ++++++------
 sys/arch/arm/xscale/becc_icu.c    |   8 ++++----
 sys/arch/arm/xscale/i80321_icu.c  |   8 ++++----
 sys/arch/arm/xscale/ixp425_intr.c |   8 ++++----
 sys/arch/arm/xscale/pxa2x0_gpio.c |  10 +++++-----
 sys/arch/arm/xscale/pxa2x0_lcd.c  |  12 ++++++------
 sys/arch/arm/zynq/zynq_uart.c     |  12 ++++++------
 7 files changed, 35 insertions(+), 35 deletions(-)

diffs (truncated from 301 to 300 lines):

diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xilinx/zynq_uart.c
--- a/sys/arch/arm/xilinx/zynq_uart.c   Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xilinx/zynq_uart.c   Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zynq_uart.c,v 1.2 2019/11/10 21:16:24 chs Exp $        */
+/*     $NetBSD: zynq_uart.c,v 1.3 2020/11/20 18:49:44 thorpej Exp $    */
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.2 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.3 2020/11/20 18:49:44 thorpej Exp $");
 
 #include "opt_soc.h"
 #include "opt_console.h"
@@ -126,7 +126,7 @@
 #include <sys/file.h>
 #include <sys/kauth.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/poll.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
@@ -412,8 +412,8 @@
        tp->t_hwiflow = zynquarthwiflow;
 
        sc->sc_tty = tp;
-       sc->sc_rbuf = malloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size,
-           M_DEVBUF, M_WAITOK);
+       sc->sc_rbuf = kmem_alloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size,
+           KM_SLEEP);
        sc->sc_rbuf_size = zynquart_rbuf_size;
        sc->sc_rbuf_in = sc->sc_rbuf_out = 0;
        sc->sc_txfifo_len = 64;
@@ -538,7 +538,7 @@
        }
 
        /* Free the receive buffer. */
-       free(sc->sc_rbuf, M_DEVBUF);
+       kmem_free(sc->sc_rbuf, sizeof(*sc->sc_rbuf) * sc->sc_rbuf_size);
 
        /* Detach and free the tty. */
        tty_detach(sc->sc_tty);
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xscale/becc_icu.c
--- a/sys/arch/arm/xscale/becc_icu.c    Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xscale/becc_icu.c    Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: becc_icu.c,v 1.14 2019/11/10 21:16:24 chs Exp $        */
+/*     $NetBSD: becc_icu.c,v 1.15 2020/11/20 18:49:45 thorpej Exp $    */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: becc_icu.c,v 1.14 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: becc_icu.c,v 1.15 2020/11/20 18:49:45 thorpej Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define        EVBARM_SPL_NOINLINE
@@ -48,7 +48,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/bus.h>
 #include <sys/intr.h>
 
@@ -293,7 +293,7 @@
        if (irq < 0 || irq > NIRQ)
                panic("becc_intr_establish: IRQ %d out of range", irq);
 
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+       ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
        ih->ih_ipl = ipl;
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xscale/i80321_icu.c
--- a/sys/arch/arm/xscale/i80321_icu.c  Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xscale/i80321_icu.c  Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i80321_icu.c,v 1.25 2019/11/10 21:16:24 chs Exp $      */
+/*     $NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $  */
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.25 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define        EVBARM_SPL_NOINLINE
@@ -48,7 +48,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -309,7 +309,7 @@
        if (irq < 0 || irq > NIRQ)
                panic("i80321_intr_establish: IRQ %d out of range", irq);
 
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+       ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
        ih->ih_ipl = ipl;
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xscale/ixp425_intr.c
--- a/sys/arch/arm/xscale/ixp425_intr.c Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xscale/ixp425_intr.c Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ixp425_intr.c,v 1.27 2019/11/10 21:16:24 chs Exp $ */
+/*     $NetBSD: ixp425_intr.c,v 1.28 2020/11/20 18:49:45 thorpej Exp $ */
 
 /*
  * Copyright (c) 2003
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixp425_intr.c,v 1.27 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixp425_intr.c,v 1.28 2020/11/20 18:49:45 thorpej Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define        EVBARM_SPL_NOINLINE
@@ -74,7 +74,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <sys/bus.h>
 #include <machine/intr.h>
@@ -343,7 +343,7 @@
               irq, ipl, (uint32_t) func, (uint32_t) arg);
 #endif
 
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+       ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
        ih->ih_ipl = ipl;
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xscale/pxa2x0_gpio.c
--- a/sys/arch/arm/xscale/pxa2x0_gpio.c Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_gpio.c Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pxa2x0_gpio.c,v 1.18 2019/11/10 21:16:24 chs Exp $     */
+/*     $NetBSD: pxa2x0_gpio.c,v 1.19 2020/11/20 18:49:45 thorpej Exp $ */
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.18 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_gpio.c,v 1.19 2020/11/20 18:49:45 thorpej Exp $");
 
 #include "gpio.h"
 #include "opt_pxa2x0_gpio.h"
@@ -44,7 +44,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <machine/intr.h>
 #include <sys/bus.h>
@@ -280,7 +280,7 @@
        if (sc->sc_handlers[gpio] != NULL)
                panic("pxa2x0_gpio_intr_establish: illegal shared interrupt");
 
-       gh = malloc(sizeof(struct gpio_irq_handler), M_DEVBUF, M_WAITOK);
+       gh = kmem_alloc(sizeof(*gh), KM_SLEEP);
        gh->gh_func = func;
        gh->gh_arg = arg;
        gh->gh_spl = spl;
@@ -365,7 +365,7 @@
 #endif
        }
 
-       free(gh, M_DEVBUF);
+       kmem_free(gh, sizeof(*gh));
 }
 
 static int
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/xscale/pxa2x0_lcd.c
--- a/sys/arch/arm/xscale/pxa2x0_lcd.c  Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/xscale/pxa2x0_lcd.c  Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pxa2x0_lcd.c,v 1.37 2019/11/10 21:16:24 chs Exp $ */
+/* $NetBSD: pxa2x0_lcd.c,v 1.38 2020/11/20 18:49:45 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002  Genetec Corporation.  All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.37 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.38 2020/11/20 18:49:45 thorpej Exp $");
 
 #include "opt_pxa2x0_lcd.h"
 
@@ -46,7 +46,7 @@
 #include <sys/systm.h>
 #include <sys/conf.h>
 #include <sys/uio.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>                        /* for cold */
 
 #include <uvm/uvm_extern.h>
@@ -515,7 +515,7 @@
                return EINVAL;
        }
 
-       scr = malloc(sizeof(*scr), M_DEVBUF, M_WAITOK | M_ZERO);
+       scr = kmem_zalloc(sizeof(*scr), KM_SLEEP);
        scr->nsegs = 0;
        scr->depth = depth;
        scr->buf_size = size;
@@ -627,7 +627,7 @@
                        bus_dmamem_unmap(dma_tag, scr->buf_va, size);
                if (scr->nsegs)
                        bus_dmamem_free(dma_tag, scr->segs, scr->nsegs);
-               free(scr, M_DEVBUF);
+               kmem_free(scr, sizeof(*scr));
        }
        *scrpp = NULL;
        return error;
@@ -850,7 +850,7 @@
                bus_dmamem_unmap(sc->dma_tag, scr->buf_va, scr->map_size);
        if (scr->nsegs > 0)
                bus_dmamem_free(sc->dma_tag, scr->segs, scr->nsegs);
-       free(scr, M_DEVBUF);
+       kmem_free(scr, sizeof(*scr));
 }
 
 int
diff -r 87526a71eb79 -r 8d8ba69aeff7 sys/arch/arm/zynq/zynq_uart.c
--- a/sys/arch/arm/zynq/zynq_uart.c     Fri Nov 20 18:34:45 2020 +0000
+++ b/sys/arch/arm/zynq/zynq_uart.c     Fri Nov 20 18:49:44 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zynq_uart.c,v 1.3 2019/11/10 21:16:24 chs Exp $        */
+/*     $NetBSD: zynq_uart.c,v 1.4 2020/11/20 18:51:31 thorpej Exp $    */
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -96,7 +96,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.3 2019/11/10 21:16:24 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zynq_uart.c,v 1.4 2020/11/20 18:51:31 thorpej Exp $");
 
 #include "opt_zynq.h"
 #include "opt_zynquart.h"
@@ -133,7 +133,7 @@
 #include <sys/kernel.h>
 #include <sys/syslog.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/timepps.h>
 #include <sys/vnode.h>
 #include <sys/kauth.h>
@@ -422,8 +422,8 @@
        tp->t_hwiflow = zynquarthwiflow;
 
        sc->sc_tty = tp;
-       sc->sc_rbuf = malloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size,
-           M_DEVBUF, M_WAITOK);
+       sc->sc_rbuf = kmem_alloc(sizeof (*sc->sc_rbuf) * zynquart_rbuf_size,
+           KM_SLEEP);
        sc->sc_rbuf_size = zynquart_rbuf_size;
        sc->sc_rbuf_in = sc->sc_rbuf_out = 0;
        sc->sc_txfifo_len = 64;
@@ -553,7 +553,7 @@
        }
 
        /* Free the receive buffer. */
-       free(sc->sc_rbuf, M_DEVBUF);
+       kmem_free(sc->sc_rbuf, sizeof(*sc->sc_rbuf) * sc->sc_rbuf_size);
 
        /* Detach and free the tty. */



Home | Main Index | Thread Index | Old Index