malloc(9) -> kmem(9)

This commit is contained in:
thorpej 2020-11-18 03:40:50 +00:00
parent 5586c60c5a
commit 4de82d111b
4 changed files with 18 additions and 21 deletions

View File

@ -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 @@ mainbus_attach(device_t parent, device_t self, void *aux)
*/
#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);

View File

@ -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 @@ setup_bebox_intr(void)
{
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;

View File

@ -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 @@ isrlink(int (*func)(void *), void *arg, int ipl, int priority)
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 @@ isrunlink(void *arg)
struct isr *isr = arg;
LIST_REMOVE(isr, isr_link);
free(isr, M_DEVBUF);
kmem_free(isr, sizeof(*isr));
}
#endif

View File

@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.20 2019/11/10 21:16:25 chs Exp $");
#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 @@ zs_config(struct zsc_softc *zsc, char *base)
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;