diff --git a/sys/arch/mac68k/dev/macfb.c b/sys/arch/mac68k/dev/macfb.c index 03ea87c87ff2..3fbcdc211dde 100644 --- a/sys/arch/mac68k/dev/macfb.c +++ b/sys/arch/mac68k/dev/macfb.c @@ -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 -__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.20 2012/10/27 17:17:59 chs Exp $"); #include #include #include -#include +#include #include #include @@ -206,7 +206,8 @@ macfb_attach(device_t parent, device_t self, void *aux) 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; diff --git a/sys/arch/mac68k/nubus/cpi_nubus.c b/sys/arch/mac68k/nubus/cpi_nubus.c index f0623c96a432..f0d7136e1feb 100644 --- a/sys/arch/mac68k/nubus/cpi_nubus.c +++ b/sys/arch/mac68k/nubus/cpi_nubus.c @@ -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 -__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 #include #include #include -#include +#include #include #include #include @@ -392,7 +392,7 @@ cpi_open(dev_t device, int flag, int mode, struct lwp *l) 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 mode, struct lwp *l) 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 --git a/sys/arch/mac68k/obio/iwm_fd.c b/sys/arch/mac68k/obio/iwm_fd.c index 3102b224d7d2..8828ffe800df 100644 --- a/sys/arch/mac68k/obio/iwm_fd.c +++ b/sys/arch/mac68k/obio/iwm_fd.c @@ -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 -__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.57 2019/11/12 13:17:43 msaitoh Exp $"); #include #include #include -#include +#include #include #include @@ -669,9 +669,11 @@ fdclose(dev_t dev, int flags, int devType, struct lwp *l) 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