Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mac68k malloc(9) -> kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/c4b7b8b9855b
branches:  trunk
changeset: 1017249:c4b7b8b9855b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Dec 19 21:48:04 2020 +0000

description:
malloc(9) -> kmem(9)

diffstat:

 sys/arch/mac68k/dev/macfb.c       |  11 ++++++-----
 sys/arch/mac68k/nubus/cpi_nubus.c |  10 +++++-----
 sys/arch/mac68k/obio/iwm_fd.c     |  17 +++++++++--------
 3 files changed, 20 insertions(+), 18 deletions(-)

diffs (140 lines):

diff -r fecefe2b6d7e -r c4b7b8b9855b sys/arch/mac68k/dev/macfb.c
--- a/sys/arch/mac68k/dev/macfb.c       Sat Dec 19 21:46:40 2020 +0000
+++ b/sys/arch/mac68k/dev/macfb.c       Sat Dec 19 21:48:04 2020 +0000
@@ -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 @@
 #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 @@
                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 @@
                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;
diff -r fecefe2b6d7e -r c4b7b8b9855b sys/arch/mac68k/nubus/cpi_nubus.c
--- a/sys/arch/mac68k/nubus/cpi_nubus.c Sat Dec 19 21:46:40 2020 +0000
+++ b/sys/arch/mac68k/nubus/cpi_nubus.c Sat Dec 19 21:48:04 2020 +0000
@@ -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 @@
                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 @@
        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;
 }
diff -r fecefe2b6d7e -r c4b7b8b9855b sys/arch/mac68k/obio/iwm_fd.c
--- a/sys/arch/mac68k/obio/iwm_fd.c     Sat Dec 19 21:46:40 2020 +0000
+++ b/sys/arch/mac68k/obio/iwm_fd.c     Sat Dec 19 21:48:04 2020 +0000
@@ -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 @@
 #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 @@
        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 @@
        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



Home | Main Index | Thread Index | Old Index