Source-Changes-HG archive

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

[src/trunk]: src/sys/dev malloc -> kmem_alloc



details:   https://anonhg.NetBSD.org/src/rev/aaef2e00f2e0
branches:  trunk
changeset: 335368:aaef2e00f2e0
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Jan 04 19:24:11 2015 +0000

description:
malloc -> kmem_alloc

diffstat:

 sys/dev/firmload.c |  16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diffs (69 lines):

diff -r b6b068c3baca -r aaef2e00f2e0 sys/dev/firmload.c
--- a/sys/dev/firmload.c        Sun Jan 04 18:52:04 2015 +0000
+++ b/sys/dev/firmload.c        Sun Jan 04 19:24:11 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: firmload.c,v 1.19 2014/03/25 16:19:13 christos Exp $   */
+/*     $NetBSD: firmload.c,v 1.20 2015/01/04 19:24:11 pooka Exp $      */
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.19 2014/03/25 16:19:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: firmload.c,v 1.20 2015/01/04 19:24:11 pooka Exp $");
 
 /*
  * The firmload API provides an interface for device drivers to access
@@ -40,7 +40,7 @@
 #include <sys/param.h>
 #include <sys/fcntl.h>
 #include <sys/filedesc.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/namei.h>
 #include <sys/systm.h>
 #include <sys/sysctl.h>
@@ -50,8 +50,6 @@
 
 #include <dev/firmload.h>
 
-MALLOC_DEFINE(M_DEVFIRM, "devfirm", "device firmware buffers");
-
 struct firmware_handle {
        struct vnode    *fh_vp;
        off_t            fh_size;
@@ -61,14 +59,14 @@
 firmware_handle_alloc(void)
 {
 
-       return (malloc(sizeof(struct firmware_handle), M_DEVFIRM, M_WAITOK));
+       return (kmem_alloc(sizeof(struct firmware_handle), KM_SLEEP));
 }
 
 static void
 firmware_handle_free(firmware_handle_t fh)
 {
 
-       free(fh, M_DEVFIRM);
+       kmem_free(fh, sizeof(*fh));
 }
 
 #if !defined(FIRMWARE_PATHS)
@@ -336,7 +334,7 @@
 firmware_malloc(size_t size)
 {
 
-       return (malloc(size, M_DEVFIRM, M_WAITOK));
+       return (kmem_alloc(size, KM_SLEEP));
 }
 
 /*
@@ -349,5 +347,5 @@
 firmware_free(void *v, size_t size)
 {
 
-       free(v, M_DEVFIRM);
+       kmem_free(v, size);
 }



Home | Main Index | Thread Index | Old Index