Module Name:    src
Committed By:   thorpej
Date:           Sat Dec 19 21:48:04 UTC 2020

Modified Files:
        src/sys/arch/mac68k/dev: macfb.c
        src/sys/arch/mac68k/nubus: cpi_nubus.c
        src/sys/arch/mac68k/obio: iwm_fd.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/mac68k/dev/macfb.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mac68k/nubus/cpi_nubus.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/mac68k/obio/iwm_fd.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/mac68k/dev/macfb.c
diff -u src/sys/arch/mac68k/dev/macfb.c:1.20 src/sys/arch/mac68k/dev/macfb.c:1.21
--- src/sys/arch/mac68k/dev/macfb.c:1.20	Sat Oct 27 17:17:59 2012
+++ src/sys/arch/mac68k/dev/macfb.c	Sat Dec 19 21:48:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: macfb.c,v 1.20 2012/10/27 17:17:59 chs Exp $ */
+/* $NetBSD: macfb.c,v 1.21 2020/12/19 21:48:04 thorpej Exp $ */
 /*
  * Copyright (c) 1998 Matt DeBergalis
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.20 2012/10/27 17:17:59 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.21 2020/12/19 21:48:04 thorpej Exp $");
 
 #include "opt_wsdisplay_compat.h"
 #include "grf.h"
@@ -41,7 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: macfb.c,v 1.
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <machine/cpu.h>
 #include <machine/bus.h>
@@ -206,7 +206,8 @@ macfb_attach(device_t parent, device_t s
 		sc->sc_dc = &macfb_console_dc;
 		sc->nscreens = 1;
 	} else {
-		sc->sc_dc = malloc(sizeof(struct macfb_devconfig), M_DEVBUF, M_WAITOK);
+		sc->sc_dc = kmem_alloc(sizeof(struct macfb_devconfig),
+		    KM_SLEEP);
 		sc->sc_dc->dc_vaddr = (vaddr_t)gm->fbbase;
 		sc->sc_dc->dc_paddr = ga->ga_phys;
 		sc->sc_dc->dc_size = gm->fbsize;
@@ -373,7 +374,7 @@ init_itefont(void)
 		return;
 	itefont_initted = 1;
 
-	/* XXX but we cannot use malloc here... */
+	/* XXX but we cannot use kmem_alloc here... */
 	gallant19.width = 6;
 	gallant19.height = 10;
 	gallant19.ascent = 0;

Index: src/sys/arch/mac68k/nubus/cpi_nubus.c
diff -u src/sys/arch/mac68k/nubus/cpi_nubus.c:1.10 src/sys/arch/mac68k/nubus/cpi_nubus.c:1.11
--- src/sys/arch/mac68k/nubus/cpi_nubus.c:1.10	Mon Sep  3 16:29:25 2018
+++ src/sys/arch/mac68k/nubus/cpi_nubus.c	Sat Dec 19 21:48:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpi_nubus.c,v 1.10 2018/09/03 16:29:25 riastradh Exp $	*/
+/*	$NetBSD: cpi_nubus.c,v 1.11 2020/12/19 21:48:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008 Hauke Fath
@@ -25,12 +25,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.10 2018/09/03 16:29:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpi_nubus.c,v 1.11 2020/12/19 21:48:04 thorpej Exp $");
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/event.h>
 #include <sys/callout.h>
 #include <sys/conf.h>
@@ -392,7 +392,7 @@ cpi_open(dev_t device, int flag, int mod
 		printf("\tcpi_open() allocating printer buffer...\n");
 	
 	/* Allocate the driver's line buffer */
-	sc->sc_printbuf = malloc(CPI_BUFSIZE, M_DEVBUF, M_WAITOK);
+	sc->sc_printbuf = kmem_alloc(CPI_BUFSIZE, KM_SLEEP);
 	sc->sc_bufbytes = 0;
 	sc->sc_lpstate = LP_OPEN;
 
@@ -441,7 +441,7 @@ cpi_close(dev_t device, int flag, int mo
 	z8536_reg_set(sc->sc_bst, sc->sc_bsh, Z8536_PCSRA, PCSR_CLR_IP_IUS);
 
 	sc->sc_lpstate = LP_INITIAL;
-	free(sc->sc_printbuf, M_DEVBUF);
+	kmem_free(sc->sc_printbuf, CPI_BUFSIZE);
 	
 	return 0;
 }

Index: src/sys/arch/mac68k/obio/iwm_fd.c
diff -u src/sys/arch/mac68k/obio/iwm_fd.c:1.57 src/sys/arch/mac68k/obio/iwm_fd.c:1.58
--- src/sys/arch/mac68k/obio/iwm_fd.c:1.57	Tue Nov 12 13:17:43 2019
+++ src/sys/arch/mac68k/obio/iwm_fd.c	Sat Dec 19 21:48:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: iwm_fd.c,v 1.57 2019/11/12 13:17:43 msaitoh Exp $	*/
+/*	$NetBSD: iwm_fd.c,v 1.58 2020/12/19 21:48:04 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998 Hauke Fath.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.57 2019/11/12 13:17:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1.58 2020/12/19 21:48:04 thorpej Exp $");
 
 #include "locators.h"
 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: iwm_fd.c,v 1
 #include <sys/kernel.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/device.h>
 #include <sys/event.h>
 
@@ -669,9 +669,11 @@ fdclose(dev_t dev, int flags, int devTyp
 	fdType = minor(dev) % MAXPARTITIONS;
 	fd = iwm->fd[fdUnit];
 	/* release cylinder cache memory */
-	if (fd->cbuf != NULL)
-		     free(fd->cbuf, M_DEVBUF);
-	
+	if (fd->cbuf != NULL) {
+		     kmem_free(fd->cbuf,
+		         IWM_MAX_GCR_SECTORS * fd->currentType->sectorSize);
+	}
+
 	partitionMask = (1 << fdType);
 
 	/* Set state flag. */
@@ -1636,8 +1638,7 @@ initCylinderCache(fd_softc_t *fd)
 	secsize = fd->currentType->sectorSize;
 	fd->cachedSide = 0;
 	
-	fd->cbuf = (unsigned char *) malloc(IWM_MAX_GCR_SECTORS
-	    * secsize, M_DEVBUF, M_WAITOK);
+	fd->cbuf = kmem_alloc(IWM_MAX_GCR_SECTORS * secsize, KM_SLEEP);
 	if (NULL == fd->cbuf) 
 		err = ENOMEM;
 	else

Reply via email to