malloc(9) -> kmem(9)
This commit is contained in:
parent
d24b629e09
commit
b950ff9afb
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $ */
|
||||
/* $NetBSD: wzero3_kbd.c,v 1.10 2020/11/21 21:25:33 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 2008, 2009, 2010 NONAKA Kimihiro <nonaka@netbsd.org>
|
||||
|
@ -26,13 +26,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.9 2019/11/10 21:16:27 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wzero3_kbd.c,v 1.10 2020/11/21 21:25:33 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
|
@ -288,10 +288,8 @@ wzero3kbd_attach(device_t parent, device_t self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
sc->sc_okeystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
sc->sc_keystat = malloc(sc->sc_nrow * sc->sc_ncolumn, M_DEVBUF,
|
||||
M_WAITOK | M_ZERO);
|
||||
sc->sc_okeystat = kmem_zalloc(sc->sc_nrow * sc->sc_ncolumn, KM_SLEEP);
|
||||
sc->sc_keystat = kmem_zalloc(sc->sc_nrow * sc->sc_ncolumn, KM_SLEEP);
|
||||
|
||||
sc->sc_if.hii_ctx = sc;
|
||||
sc->sc_if.hii_establish = wzero3kbd_input_establish;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $ */
|
||||
/* $NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -30,12 +30,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.16 2019/11/10 21:16:27 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.17 2020/11/21 21:25:33 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <machine/cpu.h>
|
||||
#include <arm/cpufunc.h>
|
||||
|
@ -63,7 +63,7 @@ softintr_establish(int level, void (*fun)(void *), void *arg)
|
|||
{
|
||||
struct softintr_handler *sh;
|
||||
|
||||
sh = malloc(sizeof(*sh), M_DEVBUF, M_WAITOK);
|
||||
sh = kmem_alloc(sizeof(*sh), KM_SLEEP);
|
||||
sh->sh_fun = fun;
|
||||
sh->sh_level = ipl_to_spl(level);
|
||||
sh->sh_arg = arg;
|
||||
|
@ -85,15 +85,16 @@ softintr_disestablish(void *cookie)
|
|||
SetCPSR(I32_bit, I32_bit & saved_cpsr);
|
||||
} else {
|
||||
SetCPSR(I32_bit, I32_bit & saved_cpsr);
|
||||
free(sh, M_DEVBUF);
|
||||
kmem_free(sh, sizeof(*sh));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
softintr_free(void *arg)
|
||||
{
|
||||
struct softintr_handler *sh = arg;
|
||||
|
||||
free(arg, M_DEVBUF);
|
||||
free(sh, sizeof(*sh));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
|
@ -30,12 +30,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.17 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: plum.c,v 1.18 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
@ -103,8 +103,7 @@ plum_attach(device_t parent, device_t self, void *aux)
|
|||
printf(": Plum2 #2\n");
|
||||
break;
|
||||
}
|
||||
sc->sc_pc = malloc(sizeof(struct plum_chipset_tag),
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
sc->sc_pc = kmem_zalloc(sizeof(struct plum_chipset_tag), KM_SLEEP);
|
||||
sc->sc_pc->pc_tc = ca->ca_tc;
|
||||
|
||||
/* Attach Plum devices */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -30,14 +30,14 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.15 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: plumiobus.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#define PLUMIOBUSDEBUG
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
@ -172,7 +172,7 @@ __plumiobus_subregion(bus_space_tag_t t, bus_addr_t ofs, bus_size_t size)
|
|||
{
|
||||
struct hpcmips_bus_space *hbs;
|
||||
|
||||
hbs = malloc(sizeof(*hbs), M_DEVBUF, M_WAITOK);
|
||||
hbs = kmem_alloc(sizeof(*hbs), KM_SLEEP);
|
||||
*hbs = *t;
|
||||
hbs->t_base += ofs;
|
||||
hbs->t_size = size;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $ */
|
||||
/* $NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 UCHIYAMA Yasushi
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.16 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: plumohci.c,v 1.15 2016/04/23 10:15:29 skrll Exp $");
|
|||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
/* busdma */
|
||||
#include <sys/mbuf.h>
|
||||
|
@ -247,7 +248,7 @@ __plumohci_dmamem_alloc(bus_dma_tag_t tx, bus_size_t size,
|
|||
|
||||
pmap_extract(pmap_kernel(), (vaddr_t)caddr, &paddr);
|
||||
|
||||
ps = malloc(sizeof(struct plumohci_shm), M_DEVBUF, M_NOWAIT);
|
||||
ps = kmem_intr_alloc(sizeof(struct plumohci_shm), KM_NOSLEEP);
|
||||
if (ps == 0)
|
||||
return 1;
|
||||
|
||||
|
@ -276,7 +277,7 @@ __plumohci_dmamem_free(bus_dma_tag_t tx, bus_dma_segment_t *segs, int nsegs)
|
|||
if (ps->ps_paddr == segs[0].ds_addr) {
|
||||
bus_space_free(sc->sc.iot, ps->ps_bsh, ps->ps_size);
|
||||
LIST_REMOVE(ps, ps_link);
|
||||
free(ps, M_DEVBUF);
|
||||
kmem_intr_free(ps, sizeof(*ps));
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ucbsnd.c,v 1.25 2016/12/17 03:46:52 riastradh Exp $ */
|
||||
/* $NetBSD: ucbsnd.c,v 1.26 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
|
@ -37,14 +37,14 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ucbsnd.c,v 1.25 2016/12/17 03:46:52 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ucbsnd.c,v 1.26 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include "opt_use_poll.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/endian.h>
|
||||
|
@ -658,7 +658,7 @@ ringbuf_allocate(struct ring_buf *rb, size_t blksize, int maxblk)
|
|||
rb->rb_blksize = blksize;
|
||||
rb->rb_maxblks = maxblk;
|
||||
#if notyet
|
||||
rb->rb_buf = (u_int32_t)malloc(rb->rb_bufsize, M_DEVBUF, M_WAITOK);
|
||||
rb->rb_buf = (u_int32_t)kmem_alloc(rb->rb_bufsize, KM_SLEEP);
|
||||
#else
|
||||
rb->rb_buf = (u_int32_t)dmabuf_static;
|
||||
#endif
|
||||
|
@ -668,8 +668,7 @@ ringbuf_allocate(struct ring_buf *rb, size_t blksize, int maxblk)
|
|||
}
|
||||
memset((char*)rb->rb_buf, 0, rb->rb_bufsize);
|
||||
#if notyet
|
||||
rb->rb_bufcnt = malloc(rb->rb_maxblks * sizeof(size_t), M_DEVBUF,
|
||||
M_WAITOK);
|
||||
rb->rb_bufcnt = kmem_alloc(rb->rb_maxblks * sizeof(size_t), KM_SLEEP);
|
||||
#else
|
||||
rb->rb_bufcnt = dmabufcnt_static;
|
||||
#endif
|
||||
|
@ -688,8 +687,8 @@ void
|
|||
ringbuf_deallocate(struct ring_buf *rb)
|
||||
{
|
||||
#if notyet
|
||||
free((void*)rb->rb_buf, M_DEVBUF);
|
||||
free(rb->rb_bufcnt, M_DEVBUF);
|
||||
kmem_free((void*)rb->rb_buf, rb->rb_bufsize);
|
||||
kmem_free(rb->rb_bufcnt, rb->rb_maxblks * sizeof(size_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $ */
|
||||
/* $NetBSD: bus_dma.c,v 1.40 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -31,12 +31,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.39 2015/06/11 08:22:09 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.40 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/kmem.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
#include <mips/cache.h>
|
||||
|
@ -77,6 +78,15 @@ struct bus_dma_tag_hpcmips hpcmips_default_bus_dma_tag = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
static size_t
|
||||
_bus_dmamap_mapsize(int const nsegments)
|
||||
{
|
||||
KASSERT(nsegments > 0);
|
||||
return sizeof(struct bus_dmamap_hpcmips) +
|
||||
sizeof(struct bus_dma_segment_hpcmips) * (nsegments - 1) +
|
||||
sizeof(bus_dma_segment_t) * nsegments;
|
||||
}
|
||||
|
||||
/*
|
||||
* Common function for DMA map creation. May be called by bus-specific
|
||||
* DMA map creation functions.
|
||||
|
@ -87,7 +97,6 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
{
|
||||
struct bus_dmamap_hpcmips *map;
|
||||
void *mapstore;
|
||||
size_t mapsize;
|
||||
|
||||
/*
|
||||
* Allocate and initialize the DMA map. The end of the map
|
||||
|
@ -98,14 +107,10 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
* of ALLOCNOW notifies others that we've reserved these resources,
|
||||
* and they are not to be freed.
|
||||
*/
|
||||
mapsize = sizeof(struct bus_dmamap_hpcmips) +
|
||||
sizeof(struct bus_dma_segment_hpcmips) * (nsegments - 1) +
|
||||
sizeof(bus_dma_segment_t) * nsegments;
|
||||
if ((mapstore = malloc(mapsize, M_DMAMAP,
|
||||
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
|
||||
if ((mapstore = kmem_zalloc(_bus_dmamap_mapsize(nsegments),
|
||||
(flags & BUS_DMA_NOWAIT) ? KM_NOSLEEP : KM_SLEEP)) == NULL)
|
||||
return (ENOMEM);
|
||||
|
||||
memset(mapstore, 0, mapsize);
|
||||
map = (struct bus_dmamap_hpcmips *)mapstore;
|
||||
map->_dm_size = size;
|
||||
map->_dm_segcnt = nsegments;
|
||||
|
@ -128,10 +133,12 @@ _hpcmips_bd_map_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
|
|||
* DMA map destruction functions.
|
||||
*/
|
||||
void
|
||||
_hpcmips_bd_map_destroy(bus_dma_tag_t t, bus_dmamap_t map)
|
||||
_hpcmips_bd_map_destroy(bus_dma_tag_t t, bus_dmamap_t bdm)
|
||||
{
|
||||
struct bus_dmamap_hpcmips *map =
|
||||
container_of(bdm, struct bus_dmamap_hpcmips, bdm);
|
||||
|
||||
free(map, M_DMAMAP);
|
||||
kmem_free(map, _bus_dmamap_mapsize(map->_dm_segcnt));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: tx39icu.c,v 1.37 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.37 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include "opt_vr41xx.h"
|
||||
#include "opt_tx39xx.h"
|
||||
|
@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: tx39icu.c,v 1.36 2019/11/10 21:16:28 chs Exp $");
|
|||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/cpu.h>
|
||||
|
||||
|
@ -507,7 +507,7 @@ tx39_irqhigh_establish(tx_chipset_tag_t tc, int set, int bit, int pri,
|
|||
/*
|
||||
* Add new entry to `pri' priority
|
||||
*/
|
||||
he = malloc(sizeof(struct txintr_high_entry), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
he = kmem_zalloc(sizeof(*he), KM_SLEEP);
|
||||
he->he_set = set;
|
||||
he->he_mask= (1 << bit);
|
||||
he->he_fun = ih_fun;
|
||||
|
@ -532,7 +532,7 @@ tx39_irqhigh_disestablish(tx_chipset_tag_t tc, int set, int bit, int pri)
|
|||
TAILQ_FOREACH(he, &sc->sc_he_head[pri], he_link) {
|
||||
if (he->he_set == set && he->he_mask == (1 << bit)) {
|
||||
TAILQ_REMOVE(&sc->sc_he_head[pri], he, he_link);
|
||||
free(he, M_DEVBUF);
|
||||
kmem_free(he, sizeof(*he));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +627,7 @@ tx39_poll_establish(tx_chipset_tag_t tc, int interval, int level,
|
|||
int s;
|
||||
void *ret;
|
||||
|
||||
p = malloc(sizeof(*p), M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
p = kmem_zalloc(sizeof(*p), KM_SLEEP);
|
||||
p->p_fun = ih_fun;
|
||||
p->p_arg = ih_arg;
|
||||
p->p_cnt = interval;
|
||||
|
@ -644,7 +644,7 @@ tx39_poll_establish(tx_chipset_tag_t tc, int interval, int level,
|
|||
printf("tx39_poll_establish: can't hook\n");
|
||||
|
||||
splx(s);
|
||||
free(p, M_DEVBUF);
|
||||
kmem_free(p, sizeof(*p));
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ tx39_poll_disestablish(tx_chipset_tag_t tc, void *arg)
|
|||
TAILQ_FOREACH(p, &sc->sc_p_head, p_link) {
|
||||
if (p->p_desc == desc) {
|
||||
TAILQ_REMOVE(&sc->sc_p_head, p, p_link);
|
||||
free(p, M_DEVBUF);
|
||||
kmem_free(p, sizeof(*p));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -709,7 +709,7 @@ tx39_poll_intr(void *arg)
|
|||
|
||||
disestablish:
|
||||
TAILQ_REMOVE(&sc->sc_p_head, p, p_link);
|
||||
free(p, M_DEVBUF);
|
||||
kmem_free(p, sizeof(*p));
|
||||
if (TAILQ_EMPTY(&sc->sc_p_head)) {
|
||||
sc->sc_polling = 0;
|
||||
tx_intr_disestablish(sc->sc_tc, sc->sc_poll_ih);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: txcom.c,v 1.49 2014/11/15 19:20:01 christos Exp $ */
|
||||
/* $NetBSD: txcom.c,v 1.50 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.49 2014/11/15 19:20:01 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.50 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include "opt_tx39uart_debug.h"
|
||||
|
||||
|
@ -38,7 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: txcom.c,v 1.49 2014/11/15 19:20:01 christos Exp $");
|
|||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/kauth.h>
|
||||
|
||||
#include <sys/proc.h> /* tsleep/wakeup */
|
||||
|
@ -215,12 +215,8 @@ txcom_attach(device_t parent, device_t self, void *aux)
|
|||
if (console) {
|
||||
sc->sc_chip = &txcom_chip;
|
||||
} else {
|
||||
if (!(sc->sc_chip = malloc(sizeof(struct txcom_chip),
|
||||
M_DEVBUF, M_WAITOK))) {
|
||||
printf(": can't allocate chip\n");
|
||||
return;
|
||||
}
|
||||
memset(sc->sc_chip, 0, sizeof(struct txcom_chip));
|
||||
sc->sc_chip = kmem_zalloc(sizeof(struct txcom_chip),
|
||||
KM_SLEEP);
|
||||
}
|
||||
|
||||
chip = sc->sc_chip;
|
||||
|
@ -233,11 +229,7 @@ txcom_attach(device_t parent, device_t self, void *aux)
|
|||
if (!console)
|
||||
txcom_reset(chip);
|
||||
|
||||
if (!(sc->sc_rbuf = malloc(TXCOM_RING_SIZE, M_DEVBUF, M_WAITOK))) {
|
||||
printf(": can't allocate buffer.\n");
|
||||
return;
|
||||
}
|
||||
memset(sc->sc_rbuf, 0, TXCOM_RING_SIZE);
|
||||
sc->sc_rbuf = kmem_zalloc(TXCOM_RING_SIZE, KM_SLEEP);
|
||||
|
||||
tp = tty_alloc();
|
||||
tp->t_oproc = txcomstart;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: flash_vrip.c,v 1.13 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
|
@ -34,13 +34,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.12 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: flash_vrip.c,v 1.13 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
|
@ -262,7 +262,7 @@ flash_attach(device_t parent, device_t self, void *aux)
|
|||
sc->sc_block_size = block_size;
|
||||
}
|
||||
|
||||
sc->sc_buf = malloc(sc->sc_block_size, M_DEVBUF, M_WAITOK);
|
||||
sc->sc_buf = kmem_alloc(sc->sc_block_size, KM_SLEEP);
|
||||
|
||||
sc->sc_write_buffer_size
|
||||
= 1 << (sc->sc_cfi_raw[CFI_MAX_WBUF_SIZE_REG0]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: vr4181giu.c,v 1.6 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2001
|
||||
|
@ -35,11 +35,11 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.5 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vr4181giu.c,v 1.6 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
|
@ -325,7 +325,7 @@ vr4181giu_intr_establish(
|
|||
|
||||
s = splhigh();
|
||||
|
||||
ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK);
|
||||
ih = kmem_alloc(sizeof *ih, KM_SLEEP);
|
||||
ih->ih_port = port;
|
||||
ih->ih_fun = ih_fun;
|
||||
ih->ih_arg = ih_arg;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: vrc4172gpio.c,v 1.15 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2001 TAKEMRUA Shin. All rights reserved.
|
||||
*
|
||||
|
@ -29,12 +29,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.14 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vrc4172gpio.c,v 1.15 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/bus.h>
|
||||
|
@ -498,7 +498,7 @@ vrc4172gpio_intr_establish(
|
|||
mask2 = (1 << (port % 8));
|
||||
intlv_reg = intlv_regs[port/8];
|
||||
|
||||
ih = malloc(sizeof(struct vrc4172gpio_intr_entry), M_DEVBUF, M_WAITOK);
|
||||
ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
|
||||
ih->ih_port = port;
|
||||
ih->ih_fun = ih_fun;
|
||||
ih->ih_arg = ih_arg;
|
||||
|
@ -589,7 +589,7 @@ vrc4172gpio_intr_disestablish(hpcio_chip_t hc, void *arg)
|
|||
TAILQ_FOREACH(ih, &sc->sc_intr_head[port], ih_link) {
|
||||
if (ih == ihe) {
|
||||
TAILQ_REMOVE(&sc->sc_intr_head[port], ih, ih_link);
|
||||
free(ih, M_DEVBUF);
|
||||
kmem_free(ih, sizeof(*ih));
|
||||
if (TAILQ_EMPTY(&sc->sc_intr_head[port])) {
|
||||
/* disable interrupt */
|
||||
sc->sc_intr_mask &= ~(1<<port);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $ */
|
||||
/* $NetBSD: vrgiu.c,v 1.44 2020/11/21 21:23:48 thorpej Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999-2001
|
||||
* Shin Takemura and PocketBSD Project. All rights reserved.
|
||||
|
@ -34,12 +34,12 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.43 2019/11/10 21:16:28 chs Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: vrgiu.c,v 1.44 2020/11/21 21:23:48 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/kmem.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
|
@ -534,7 +534,7 @@ vrgiu_intr_establish(
|
|||
|
||||
s = splhigh();
|
||||
|
||||
ih = malloc(sizeof(struct vrgiu_intr_entry), M_DEVBUF, M_WAITOK);
|
||||
ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
|
||||
DPRINTF(DEBUG_INTR, ("%s: port %d ", device_xname(sc->sc_dev), port));
|
||||
ih->ih_port = port;
|
||||
ih->ih_fun = ih_fun;
|
||||
|
@ -625,7 +625,7 @@ vrgiu_intr_disestablish(hpcio_chip_t hc, void *arg)
|
|||
TAILQ_FOREACH(ih, &sc->sc_intr_head[port], ih_link) {
|
||||
if (ih == ihe) {
|
||||
TAILQ_REMOVE(&sc->sc_intr_head[port], ih, ih_link);
|
||||
free(ih, M_DEVBUF);
|
||||
kmem_free(ih, sizeof(*ih));
|
||||
if (TAILQ_EMPTY(&sc->sc_intr_head[port])) {
|
||||
/* Disable interrupt */
|
||||
#ifdef WINCE_DEFAULT_SETTING
|
||||
|
|
Loading…
Reference in New Issue