Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen/xen Move to kmem_zalloc() instead of malloc().
details: https://anonhg.NetBSD.org/src/rev/6e067ed3fc2a
branches: trunk
changeset: 771895:6e067ed3fc2a
user: cherry <cherry%NetBSD.org@localhost>
date: Wed Dec 07 12:31:51 2011 +0000
description:
Move to kmem_zalloc() instead of malloc().
diffstat:
sys/arch/xen/xen/evtchn.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diffs (82 lines):
diff -r 3c77f883f18d -r 6e067ed3fc2a sys/arch/xen/xen/evtchn.c
--- a/sys/arch/xen/xen/evtchn.c Wed Dec 07 09:08:00 2011 +0000
+++ b/sys/arch/xen/xen/evtchn.c Wed Dec 07 12:31:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: evtchn.c,v 1.56 2011/11/19 17:13:39 cherry Exp $ */
+/* $NetBSD: evtchn.c,v 1.57 2011/12/07 12:31:51 cherry Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.56 2011/11/19 17:13:39 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.57 2011/12/07 12:31:51 cherry Exp $");
#include "opt_xen.h"
#include "isa.h"
@@ -66,7 +66,7 @@
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/proc.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
#include <sys/reboot.h>
#include <sys/mutex.h>
@@ -561,7 +561,7 @@
}
if (event_set_handler(evtch, pirq_interrupt, ih, level, evname) != 0) {
- free(ih, M_DEVBUF);
+ kmem_free(ih, sizeof (struct iplsource));
return NULL;
}
@@ -659,8 +659,7 @@
printf("event_set_handler evtch %d handler %p level %d\n", evtch,
handler, level);
#endif
- ih = malloc(sizeof (struct intrhand), M_DEVBUF,
- M_WAITOK|M_ZERO);
+ ih = kmem_zalloc(sizeof (struct intrhand), KM_NOSLEEP);
if (ih == NULL)
panic("can't allocate fixed interrupt source");
@@ -685,8 +684,8 @@
/* register handler for event channel */
if (evtsource[evtch] == NULL) {
- evts = malloc(sizeof (struct evtsource),
- M_DEVBUF, M_WAITOK|M_ZERO);
+ evts = kmem_zalloc(sizeof (struct evtsource),
+ KM_NOSLEEP);
if (evts == NULL)
panic("can't allocate fixed interrupt source");
@@ -742,8 +741,8 @@
KASSERT(ci == ih->ih_cpu);
if (ci->ci_isources[level] == NULL) {
- ipls = malloc(sizeof (struct iplsource),
- M_DEVBUF, M_WAITOK|M_ZERO);
+ ipls = kmem_zalloc(sizeof (struct iplsource),
+ KM_NOSLEEP);
if (ipls == NULL)
panic("can't allocate fixed interrupt source");
ipls->ipl_recurse = xenev_stubs[level].ist_recurse;
@@ -795,11 +794,11 @@
if (ih == NULL)
panic("event_remove_handler");
*ihp = ih->ih_ipl_next;
- free(ih, M_DEVBUF);
+ kmem_free(ih, sizeof (struct iplsource));
if (evts->ev_handlers == NULL) {
xen_atomic_clear_bit(&ci->ci_evtmask[0], evtch);
evcnt_detach(&evts->ev_evcnt);
- free(evts, M_DEVBUF);
+ kmem_free(evts, sizeof (struct evtsource));
evtsource[evtch] = NULL;
} else {
intr_calculatemasks(evts, evtch, ci);
Home |
Main Index |
Thread Index |
Old Index