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/f657fbe34a00
branches:  trunk
changeset: 946142:f657fbe34a00
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Nov 18 03:40:50 2020 +0000

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

diffstat:

 sys/arch/bebox/bebox/mainbus.c   |  12 +++++-------
 sys/arch/bebox/bebox/pic_bebox.c |   8 ++++----
 sys/arch/cesfic/cesfic/isr.c     |  10 +++++-----
 sys/arch/cesfic/dev/zs.c         |   9 ++++-----
 4 files changed, 18 insertions(+), 21 deletions(-)

diffs (151 lines):

diff -r 35019bc20b96 -r f657fbe34a00 sys/arch/bebox/bebox/mainbus.c
--- a/sys/arch/bebox/bebox/mainbus.c    Wed Nov 18 02:22:16 2020 +0000
+++ b/sys/arch/bebox/bebox/mainbus.c    Wed Nov 18 03:40:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.32 2020/07/07 03:38:46 thorpej Exp $     */
+/*     $NetBSD: mainbus.c,v 1.33 2020/11/18 03:46:25 thorpej Exp $     */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,12 +31,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.32 2020/07/07 03:38:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33 2020/11/18 03:46:25 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <machine/autoconf.h>
 #include <sys/bus.h>
@@ -123,12 +123,10 @@
         */
 
 #if NPCI > 0
-       genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF,
-           M_WAITOK);
+       genppc_pct = kmem_alloc(sizeof(struct genppc_pci_chipset), KM_SLEEP);
        bebox_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);
 
diff -r 35019bc20b96 -r f657fbe34a00 sys/arch/bebox/bebox/pic_bebox.c
--- a/sys/arch/bebox/bebox/pic_bebox.c  Wed Nov 18 02:22:16 2020 +0000
+++ b/sys/arch/bebox/bebox/pic_bebox.c  Wed Nov 18 03:40:50 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $ */
+/* $NetBSD: pic_bebox.c,v 1.12 2020/11/18 03:46:25 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,12 +30,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.12 2020/11/18 03:46:25 thorpej Exp $");
 
 #include "opt_multiprocessor.h"
 
 #include <sys/param.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/kernel.h>
 
 #include <uvm/uvm_extern.h>
@@ -57,7 +57,7 @@
 {
        struct pic_ops *pic;
 
-       pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK);
+       pic = kmem_alloc(sizeof(struct pic_ops), KM_SLEEP);
        pic->pic_numintrs = 32;
        pic->pic_cookie = (void *)BEBOX_REG;
        pic->pic_enable_irq = bebox_enable_irq;
diff -r 35019bc20b96 -r f657fbe34a00 sys/arch/cesfic/cesfic/isr.c
--- a/sys/arch/cesfic/cesfic/isr.c      Wed Nov 18 02:22:16 2020 +0000
+++ b/sys/arch/cesfic/cesfic/isr.c      Wed Nov 18 03:40:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isr.c,v 1.17 2019/11/10 21:16:25 chs Exp $     */
+/*     $NetBSD: isr.c,v 1.18 2020/11/18 03:40:50 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -34,12 +34,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.17 2019/11/10 21:16:25 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.18 2020/11/18 03:40:50 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/queue.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/vmmeter.h>
 #include <sys/cpu.h>
 
@@ -76,7 +76,7 @@
        if ((ipl < 0) || (ipl >= NISR))
                panic("isrlink: bad ipl %d", ipl);
 
-       newisr = malloc(sizeof(struct isr), M_DEVBUF, M_WAITOK);
+       newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
        newisr->isr_func = func;
        newisr->isr_arg = arg;
        newisr->isr_ipl = ipl;
@@ -144,7 +144,7 @@
        struct isr *isr = arg;
 
        LIST_REMOVE(isr, isr_link);
-       free(isr, M_DEVBUF);
+       kmem_free(isr, sizeof(*isr));
 }
 #endif
 
diff -r 35019bc20b96 -r f657fbe34a00 sys/arch/cesfic/dev/zs.c
--- a/sys/arch/cesfic/dev/zs.c  Wed Nov 18 02:22:16 2020 +0000
+++ b/sys/arch/cesfic/dev/zs.c  Wed Nov 18 03:40:50 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs.c,v 1.20 2019/11/10 21:16:25 chs Exp $      */
+/*     $NetBSD: zs.c,v 1.21 2020/11/18 03:40:50 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.20 2019/11/10 21:16:25 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.21 2020/11/18 03:40:50 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -48,7 +48,7 @@
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/proc.h>
 #include <sys/tty.h>
 #include <sys/time.h>
@@ -123,8 +123,7 @@
                if (zsc_args.hwflags & ZS_HWFLAG_CONSOLE) {
                        cs = &zs_conschan_store;
                } else {
-                       cs = malloc(sizeof(struct zs_chanstate),
-                                   M_DEVBUF, M_WAITOK | M_ZERO);
+                       cs = kmem_zalloc(sizeof(*cs), KM_SLEEP);
                        if(channel==0){
                                cs->cs_reg_csr  = base + 7;
                                cs->cs_reg_data = base + 15;



Home | Main Index | Thread Index | Old Index