Module Name:    src
Committed By:   thorpej
Date:           Mon Jan  4 17:42:29 UTC 2021

Modified Files:
        src/sys/arch/mips/atheros: ar_intr.c
        src/sys/arch/mips/atheros/dev: arspi.c athflash.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/atheros/ar_intr.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mips/atheros/dev/arspi.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/atheros/dev/athflash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/atheros/ar_intr.c
diff -u src/sys/arch/mips/atheros/ar_intr.c:1.6 src/sys/arch/mips/atheros/ar_intr.c:1.7
--- src/sys/arch/mips/atheros/ar_intr.c:1.6	Sun Nov 10 21:16:29 2019
+++ src/sys/arch/mips/atheros/ar_intr.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $ */
+/* $NetBSD: ar_intr.c,v 1.7 2021/01/04 17:42:29 thorpej Exp $ */
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
  * Copyright (c) 2006 Garrett D'Amore.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.6 2019/11/10 21:16:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 1.7 2021/01/04 17:42:29 thorpej Exp $");
 
 #define __INTR_PRIVATE
 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: ar_intr.c,v 
 #include <sys/intr.h>
 #include <sys/cpu.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <mips/cpuregs.h>
 #include <mips/locore.h>
@@ -110,7 +110,7 @@ genath_cpu_intr_establish(int intr, int 
 {
 	struct atheros_intrhand	*ih;
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = intr;
@@ -138,7 +138,7 @@ genath_cpu_intr_disestablish(void *arg)
 	LIST_REMOVE(ih, ih_q);
 
 	splx(s);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 static void *
@@ -150,7 +150,7 @@ genath_misc_intr_establish(int irq, int 
 	int s;
 
 
-	ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK);
+	ih = kmem_alloc(sizeof(*ih), KM_SLEEP);
 	ih->ih_func = func;
 	ih->ih_arg = arg;
 	ih->ih_irq = irq;
@@ -188,7 +188,7 @@ genath_misc_intr_disestablish(void *arg)
 	}
 
 	splx(s);
-	free(ih, M_DEVBUF);
+	kmem_free(ih, sizeof(*ih));
 }
 
 

Index: src/sys/arch/mips/atheros/dev/arspi.c
diff -u src/sys/arch/mips/atheros/dev/arspi.c:1.12 src/sys/arch/mips/atheros/dev/arspi.c:1.13
--- src/sys/arch/mips/atheros/dev/arspi.c:1.12	Tue Aug 13 17:03:11 2019
+++ src/sys/arch/mips/atheros/dev/arspi.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: arspi.c,v 1.12 2019/08/13 17:03:11 tnn Exp $ */
+/* $NetBSD: arspi.c,v 1.13 2021/01/04 17:42:29 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.12 2019/08/13 17:03:11 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.13 2021/01/04 17:42:29 thorpej Exp $");
 
 #include "locators.h"
 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: arspi.c,v 1.
 #include <sys/device.h>
 #include <sys/errno.h>
 #include <sys/kernel.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/proc.h>
 #include <sys/systm.h>
 
@@ -260,8 +260,9 @@ arspi_transfer(void *cookie, struct spi_
 	st->st_busprivate = NULL;
 	if ((rv = arspi_make_job(st)) != 0) {
 		if (st->st_busprivate) {
-			free(st->st_busprivate, M_DEVBUF);
+			struct arspi_job *job = st->st_busprivate;
 			st->st_busprivate = NULL;
+			kmem_free(job, sizeof(*job));
 		}
 		spi_done(st, rv);
 		return rv;
@@ -382,7 +383,7 @@ arspi_done(struct arspi_softc *sc, int e
 			sc->sc_transfer = NULL;
 			st->st_busprivate = NULL;
 			spi_done(st, err);
-			free(job, M_DEVBUF);
+			kmem_free(job, sizeof(*job));
 		}
 	}
 done:
@@ -470,10 +471,7 @@ arspi_make_job(struct spi_transfer *st)
 	uint8_t byte;
 	int i, rv;
 
-	job = malloc(sizeof (struct arspi_job), M_DEVBUF, M_ZERO);
-	if (job == NULL) {
-		return ENOMEM;
-	}
+	job = kmem_zalloc(sizeof (struct arspi_job), KM_SLEEP);
 
 	st->st_busprivate = job;
 

Index: src/sys/arch/mips/atheros/dev/athflash.c
diff -u src/sys/arch/mips/atheros/dev/athflash.c:1.11 src/sys/arch/mips/atheros/dev/athflash.c:1.12
--- src/sys/arch/mips/atheros/dev/athflash.c:1.11	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/mips/atheros/dev/athflash.c	Mon Jan  4 17:42:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $ */
+/* $NetBSD: athflash.c,v 1.12 2021/01/04 17:42:29 thorpej Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -82,13 +82,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.11 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athflash.c,v 1.12 2021/01/04 17:42:29 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>
 
@@ -251,7 +251,7 @@ flash_attach(device_t parent, device_t s
 	sc->sc_size = flash_ids[i].flash_size;
 	sc->sc_sector_size = flash_ids[i].sector_size;
 
-	sc->sc_buf = malloc(sc->sc_sector_size, M_DEVBUF, M_WAITOK);
+	sc->sc_buf = kmem_alloc(sc->sc_sector_size, KM_SLEEP);
 
 	printf("\n");
 }

Reply via email to