Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/isa malloc(9) -> kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/cc842cc968df
branches:  trunk
changeset: 370723:cc842cc968df
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 25 17:11:48 2022 +0000

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

diffstat:

 sys/dev/isa/elink.c     |  11 +++++------
 sys/dev/isa/fd.c        |  11 +++++------
 sys/dev/isa/pckbc_isa.c |   9 ++++-----
 sys/dev/isa/seagate.c   |   8 ++++----
 sys/dev/isa/wt.c        |  10 +++++-----
 5 files changed, 23 insertions(+), 26 deletions(-)

diffs (200 lines):

diff -r c0f9be13fb8f -r cc842cc968df sys/dev/isa/elink.c
--- a/sys/dev/isa/elink.c       Sun Sep 25 17:09:36 2022 +0000
+++ b/sys/dev/isa/elink.c       Sun Sep 25 17:11:48 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $   */
+/*     $NetBSD: elink.c,v 1.19 2022/09/25 17:11:48 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -34,13 +34,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.18 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink.c,v 1.19 2022/09/25 17:11:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+
 #include <sys/queue.h>
-
+#include <sys/kmem.h>
 #include <sys/bus.h>
 
 #include <dev/isa/elink.h>
@@ -84,8 +84,7 @@
                        goto out;
 
        /* Mark this bus so we don't do it again. */
-       er = (struct elink_done_reset *)malloc(sizeof(struct elink_done_reset),
-           M_DEVBUF, M_WAITOK);
+       er = kmem_alloc(sizeof(*er), KM_SLEEP);
        er->er_bus = bus;
        LIST_INSERT_HEAD(&elink_all_resets, er, er_link);
 
diff -r c0f9be13fb8f -r cc842cc968df sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Sun Sep 25 17:09:36 2022 +0000
+++ b/sys/dev/isa/fd.c  Sun Sep 25 17:11:48 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.116 2021/08/07 16:19:12 thorpej Exp $ */
+/*     $NetBSD: fd.c,v 1.117 2022/09/25 17:11:48 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.116 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.117 2022/09/25 17:11:48 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -107,7 +107,7 @@
 #include <sys/disk.h>
 #include <sys/buf.h>
 #include <sys/bufq.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/uio.h>
 #include <sys/syslog.h>
 #include <sys/queue.h>
@@ -1553,8 +1553,7 @@
                        return EINVAL;
                }
 
-               fd_formb = malloc(sizeof(struct ne7_fd_formb),
-                   M_TEMP, M_WAITOK);
+               fd_formb = kmem_alloc(sizeof(*fd_formb), KM_SLEEP);
                fd_formb->head = form_cmd->head;
                fd_formb->cyl = form_cmd->cylinder;
                fd_formb->transfer_rate = fd->sc_type->rate;
@@ -1578,7 +1577,7 @@
                }
 
                error = fdformat(dev, fd_formb, l);
-               free(fd_formb, M_TEMP);
+               kmem_free(fd_formb, sizeof(*fd_formb));
                return error;
 
        case FDIOCGETOPTS:              /* get drive options */
diff -r c0f9be13fb8f -r cc842cc968df sys/dev/isa/pckbc_isa.c
--- a/sys/dev/isa/pckbc_isa.c   Sun Sep 25 17:09:36 2022 +0000
+++ b/sys/dev/isa/pckbc_isa.c   Sun Sep 25 17:11:48 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc_isa.c,v 1.26 2014/04/03 23:49:47 mrg Exp $ */
+/* $NetBSD: pckbc_isa.c,v 1.27 2022/09/25 17:11:48 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.26 2014/04/03 23:49:47 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_isa.c,v 1.27 2022/09/25 17:11:48 thorpej Exp $");
 
 #include "opt_pckbc.h"
 
@@ -35,7 +35,7 @@
 #include <sys/kernel.h>
 #include <sys/proc.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/errno.h>
 #include <sys/queue.h>
 
@@ -190,8 +190,7 @@
                    bus_space_map(iot, IO_KBD + KBCMDP, 1, 0, &ioh_c))
                        panic("pckbc_attach: couldn't map");
 
-               t = malloc(sizeof(struct pckbc_internal), M_DEVBUF,
-                   M_WAITOK|M_ZERO);
+               t = kmem_zalloc(sizeof(*t), KM_SLEEP);
                t->t_iot = iot;
                t->t_ioh_d = ioh_d;
                t->t_ioh_c = ioh_c;
diff -r c0f9be13fb8f -r cc842cc968df sys/dev/isa/seagate.c
--- a/sys/dev/isa/seagate.c     Sun Sep 25 17:09:36 2022 +0000
+++ b/sys/dev/isa/seagate.c     Sun Sep 25 17:11:48 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: seagate.c,v 1.76 2021/08/07 16:19:12 thorpej Exp $     */
+/*     $NetBSD: seagate.c,v 1.77 2022/09/25 17:11:48 thorpej Exp $     */
 
 /*
  * ST01/02, Future Domain TMC-885, TMC-950 SCSI driver
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.76 2021/08/07 16:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.77 2022/09/25 17:11:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -76,7 +76,7 @@
 #include <sys/buf.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <sys/intr.h>
 #include <machine/pio.h>
@@ -808,7 +808,7 @@
                return;
        }
 
-       scb = malloc(sizeof(struct sea_scb), M_DEVBUF, M_NOWAIT|M_ZERO);
+       scb = kmem_zalloc(sizeof(*scb), KM_NOSLEEP);
        if (scb == NULL)
                return;
 
diff -r c0f9be13fb8f -r cc842cc968df sys/dev/isa/wt.c
--- a/sys/dev/isa/wt.c  Sun Sep 25 17:09:36 2022 +0000
+++ b/sys/dev/isa/wt.c  Sun Sep 25 17:11:48 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wt.c,v 1.88 2016/07/14 10:19:06 msaitoh Exp $  */
+/*     $NetBSD: wt.c,v 1.89 2022/09/25 17:11:48 thorpej Exp $  */
 
 /*
  * Streamer tape driver.
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.88 2016/07/14 10:19:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.89 2022/09/25 17:11:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -59,7 +59,7 @@
 #include <sys/kernel.h>
 #include <sys/buf.h>
 #include <sys/fcntl.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/ioctl.h>
 #include <sys/mtio.h>
 #include <sys/device.h>
@@ -438,7 +438,7 @@
                return ENXIO;
 
        sc->bsize = (minor(dev) & WT_BSIZE) ? 1024 : 512;
-       sc->buf = malloc(sc->bsize, M_TEMP, M_WAITOK);
+       sc->buf = kmem_alloc(sc->bsize, KM_SLEEP);
 
        sc->flags = TPINUSE;
        if (flag & FREAD)
@@ -490,7 +490,7 @@
 
 done:
        sc->flags &= TPREW | TPRMARK | TPSTART | TPTIMER;
-       free(sc->buf, M_TEMP);
+       kmem_free(sc->buf, sc->bsize);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index