Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/c9cbb437fb95
branches:  trunk
changeset: 1016452:c9cbb437fb95
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Nov 21 15:36:36 2020 +0000

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

diffstat:

 sys/arch/evbmips/gdium/gdium_intr.c       |  10 +++++-----
 sys/arch/evbmips/loongson/loongson_intr.c |  10 +++++-----
 sys/arch/evbmips/malta/malta_intr.c       |  10 +++++-----
 sys/arch/evbmips/malta/pci/pcib.c         |  10 +++++-----
 sys/arch/evbppc/explora/dev/fb_elb.c      |   9 ++++-----
 sys/arch/evbppc/explora/dev/pckbc_elb.c   |   9 ++++-----
 sys/arch/evbppc/pmppc/dev/cpc_mainbus.c   |  12 +++++-------
 sys/arch/evbppc/pmppc/pic_cpc700.c        |   8 ++++----
 sys/arch/evbppc/virtex/design_gsrd1.c     |  11 ++++++-----
 sys/arch/evbppc/walnut/dev/pckbc_pbus.c   |   9 ++++-----
 10 files changed, 47 insertions(+), 51 deletions(-)

diffs (truncated from 402 to 300 lines):

diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbmips/gdium/gdium_intr.c
--- a/sys/arch/evbmips/gdium/gdium_intr.c       Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbmips/gdium/gdium_intr.c       Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $       */
+/*     $NetBSD: gdium_intr.c,v 1.10 2020/11/21 15:36:36 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.9 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdium_intr.c,v 1.10 2020/11/21 15:36:36 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -50,7 +50,7 @@
 #include <sys/device.h>
 #include <sys/intr.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 
 #include <mips/locore.h>
@@ -239,7 +239,7 @@
 
        KASSERT(irq == irqmap->irqidx);
 
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO);
+       ih = kmem_zalloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
        ih->ih_irq = irq;
@@ -290,7 +290,7 @@
 
        splx(s);
 
-       free(ih, M_DEVBUF);
+       kmem_free(ih, sizeof(*ih));
 }
 
 void
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbmips/loongson/loongson_intr.c
--- a/sys/arch/evbmips/loongson/loongson_intr.c Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbmips/loongson/loongson_intr.c Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $      */
+/*      $NetBSD: loongson_intr.c,v 1.8 2020/11/21 15:36:36 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: loongson_intr.c,v 1.8 2020/11/21 15:36:36 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -39,7 +39,7 @@
 #include <sys/cpu.h>
 #include <sys/intr.h>
 #include <sys/bus.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <mips/mips3_clock.h>
 #include <machine/locore.h>
@@ -295,7 +295,7 @@
        KASSERT(irq < BONITO_NINTS);
        DPRINTF(("loongson_intr_establish %d %p", irq, func));
 
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK|M_ZERO);
+       ih = kmem_zalloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
        ih->ih_irq = irq;
@@ -327,7 +327,7 @@
            !BONITO_IRQ_IS_ISA(ih->ih_irq))
                REGVAL(BONITO_INTENCLR) = (1 << ih->ih_irq);
        splx(s);
-       free(ih, M_DEVBUF);
+       kmem_free(ih, sizeof(*ih));
 }
 
 const char *
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbmips/malta/malta_intr.c
--- a/sys/arch/evbmips/malta/malta_intr.c       Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbmips/malta/malta_intr.c       Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $      */
+/*     $NetBSD: malta_intr.c,v 1.27 2020/11/21 15:36:36 thorpej Exp $  */
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -40,14 +40,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.26 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malta_intr.c,v 1.27 2020/11/21 15:36:36 thorpej Exp $");
 
 #define        __INTR_PRIVATE
 
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 #include <sys/cpu.h>
 
@@ -206,7 +206,7 @@
        struct evbmips_intrhand *ih;
        int s;
        
-       ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+       ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
        ih->ih_func = func;
        ih->ih_arg = arg;
 
@@ -241,7 +241,7 @@
        
        splx(s);
 
-       free(ih, M_DEVBUF);
+       kmem_free(ih, sizeof(*ih));
 }
 
 void
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbmips/malta/pci/pcib.c
--- a/sys/arch/evbmips/malta/pci/pcib.c Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbmips/malta/pci/pcib.c Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcib.c,v 1.19 2019/11/10 21:16:26 chs Exp $    */
+/*     $NetBSD: pcib.c,v 1.20 2020/11/21 15:36:36 thorpej Exp $        */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,13 +36,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.19 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcib.c,v 1.20 2020/11/21 15:36:36 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -508,7 +508,7 @@
                return (NULL);
        }
 
-       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_irq = irq;
@@ -551,7 +551,7 @@
 
        splx(s);
 
-       free(ih, M_DEVBUF);
+       kmem_free(ih, sizeof(*ih));
 }
 
 static int
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbppc/explora/dev/fb_elb.c
--- a/sys/arch/evbppc/explora/dev/fb_elb.c      Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbppc/explora/dev/fb_elb.c      Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fb_elb.c,v 1.13 2011/07/01 19:02:32 dyoung Exp $       */
+/*     $NetBSD: fb_elb.c,v 1.14 2020/11/21 15:42:20 thorpej Exp $      */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.13 2011/07/01 19:02:32 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fb_elb.c,v 1.14 2020/11/21 15:42:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
 #include <sys/device.h>
 #include <sys/ioctl.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 
 #include <dev/wscons/wsconsio.h>
@@ -143,8 +143,7 @@
                sc->sc_fb = &console_dev;
                sc->sc_fb->fb_ri.ri_flg &= ~RI_NO_AUTO;
        } else {
-               sc->sc_fb = malloc(sizeof(struct fb_dev), M_DEVBUF, M_WAITOK);
-               memset(sc->sc_fb, 0, sizeof(struct fb_dev));
+               sc->sc_fb = kmem_zalloc(sizeof(struct fb_dev), KM_SLEEP);
        }
 
        sc->sc_fb->fb_iot = eaa->elb_bt;
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbppc/explora/dev/pckbc_elb.c
--- a/sys/arch/evbppc/explora/dev/pckbc_elb.c   Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbppc/explora/dev/pckbc_elb.c   Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pckbc_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $     */
+/*     $NetBSD: pckbc_elb.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $    */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,13 +30,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.7 2011/07/01 19:02:32 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_elb.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
 #include <sys/device.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <sys/bus.h>
 
@@ -88,8 +88,7 @@
                t = &pckbc_consdata;
                pckbc_console_attached = 1;
        } else {
-               t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
-               memset(t, 0, sizeof(struct pckbc_internal));
+               t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
        }
 
        t->t_iot = eaa->elb_bt;
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbppc/pmppc/dev/cpc_mainbus.c
--- a/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c   Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbppc/pmppc/dev/cpc_mainbus.c   Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $      */
+/*     $NetBSD: cpc_mainbus.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $  */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpc_mainbus.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/extent.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 
 #include <sys/bus.h>
@@ -78,11 +78,9 @@
 {
        struct genppc_pci_chipset_businfo *pbi;
 
-       genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF,
-           M_WAITOK);
+       genppc_pct = kmem_alloc(sizeof(struct genppc_pci_chipset), KM_SLEEP);
        pmppc_pci_get_chipset_tag(genppc_pct);
-       pbi = malloc(sizeof(struct genppc_pci_chipset_businfo),
-           M_DEVBUF, M_WAITOK);
+       pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo), KM_SLEEP);
        pbi->pbi_properties = prop_dictionary_create();
        KASSERT(pbi->pbi_properties != NULL);
        SIMPLEQ_INIT(&genppc_pct->pc_pbi);
diff -r 3d841aceda06 -r c9cbb437fb95 sys/arch/evbppc/pmppc/pic_cpc700.c
--- a/sys/arch/evbppc/pmppc/pic_cpc700.c        Sat Nov 21 15:32:52 2020 +0000
+++ b/sys/arch/evbppc/pmppc/pic_cpc700.c        Sat Nov 21 15:36:36 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $ */
+/* $NetBSD: pic_cpc700.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,10 +30,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.7 2019/11/10 21:16:26 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_cpc700.c,v 1.8 2020/11/21 15:42:20 thorpej Exp $");



Home | Main Index | Thread Index | Old Index