Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 malloc(9) -> kmem(9) -- just the simple, st...



details:   https://anonhg.NetBSD.org/src/rev/d87952ebbcfd
branches:  trunk
changeset: 979639:d87952ebbcfd
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jan 04 14:48:51 2021 +0000

description:
malloc(9) -> kmem(9) -- just the simple, straightforward conversions for now.

diffstat:

 sys/arch/sparc64/dev/cbus.c         |   6 ++--
 sys/arch/sparc64/dev/central.c      |   7 +++--
 sys/arch/sparc64/dev/ebus.c         |   7 +++--
 sys/arch/sparc64/dev/ebus_mainbus.c |   8 +++---
 sys/arch/sparc64/dev/fdc.c          |  13 +++++------
 sys/arch/sparc64/dev/fhc.c          |   7 +++--
 sys/arch/sparc64/dev/pckbc_ebus.c   |   9 +++----
 sys/arch/sparc64/dev/psycho.c       |  36 ++++++++++++----------------------
 sys/arch/sparc64/dev/pyro.c         |  20 +++++++++---------
 sys/arch/sparc64/dev/sbus.c         |  10 ++++----
 sys/arch/sparc64/dev/upa.c          |   6 ++--
 sys/arch/sparc64/dev/vbus.c         |   5 ++-
 sys/arch/sparc64/dev/vpci.c         |  20 +++++++++---------
 sys/arch/sparc64/dev/vrtc.c         |   6 ++--
 sys/arch/sparc64/sparc64/machdep.c  |  38 ++++++++++++++++++++----------------
 15 files changed, 97 insertions(+), 101 deletions(-)

diffs (truncated from 798 to 300 lines):

diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/cbus.c
--- a/sys/arch/sparc64/dev/cbus.c       Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/cbus.c       Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cbus.c,v 1.3 2019/11/10 21:16:33 chs Exp $     */
+/*     $NetBSD: cbus.c,v 1.4 2021/01/04 14:48:51 thorpej Exp $ */
 /*     $OpenBSD: cbus.c,v 1.15 2015/09/27 11:29:20 kettenis Exp $      */
 /*
  * Copyright (c) 2008 Mark Kettenis
@@ -18,7 +18,7 @@
 
 #include <sys/param.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 
 #include <machine/autoconf.h>
@@ -238,7 +238,7 @@
 {
        struct sparc_bus_space_tag *bt;
 
-       bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO);
+       bt = kmem_zalloc(sizeof(*bt), KM_SLEEP);
        bt->cookie = sc;
        bt->parent = parent;
        bt->sparc_bus_map = parent->sparc_bus_map;
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/central.c
--- a/sys/arch/sparc64/dev/central.c    Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/central.c    Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: central.c,v 1.4 2019/11/10 21:16:33 chs Exp $  */
+/*     $NetBSD: central.c,v 1.5 2021/01/04 14:48:51 thorpej Exp $      */
 /*     $OpenBSD: central.c,v 1.7 2010/11/11 17:58:23 miod Exp $        */
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: central.c,v 1.4 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: central.c,v 1.5 2021/01/04 14:48:51 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -37,6 +37,7 @@
 #include <sys/device.h>
 #include <sys/conf.h>
 #include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/bus.h>
 
 #include <machine/autoconf.h>
@@ -153,7 +154,7 @@
 {
        struct sparc_bus_space_tag *bt;
 
-       bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO);
+       bt = kmem_zalloc(sizeof(*bt), KM_SLEEP);
        bt->cookie = sc;
        bt->parent = sc->sc_bt;
 #if 0
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/ebus.c
--- a/sys/arch/sparc64/dev/ebus.c       Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/ebus.c       Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus.c,v 1.64 2019/11/10 21:16:33 chs Exp $    */
+/*     $NetBSD: ebus.c,v 1.65 2021/01/04 14:48:51 thorpej Exp $        */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.64 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus.c,v 1.65 2021/01/04 14:48:51 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -60,6 +60,7 @@
 #include <sys/errno.h>
 #include <sys/extent.h>
 #include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 #include <sys/time.h>
 
@@ -365,7 +366,7 @@
 {
        bus_space_tag_t bt;
 
-       bt = malloc(sizeof(struct sparc_bus_space_tag), M_DEVBUF, M_WAITOK | M_ZERO);
+       bt = kmem_zalloc(sizeof(*bt), KM_SLEEP);
        bt->cookie = sc;
        bt->parent = sc->sc_memtag;
        bt->type = type;
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/ebus_mainbus.c
--- a/sys/arch/sparc64/dev/ebus_mainbus.c       Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/ebus_mainbus.c       Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ebus_mainbus.c,v 1.17 2019/11/10 21:16:33 chs Exp $    */
+/*     $NetBSD: ebus_mainbus.c,v 1.18 2021/01/04 14:48:51 thorpej Exp $        */
 /*     $OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $   */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.17 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ebus_mainbus.c,v 1.18 2021/01/04 14:48:51 thorpej Exp $");
 
 #ifdef DEBUG
 #define        EDB_PROM        0x01
@@ -38,7 +38,7 @@
 #include <sys/device.h>
 #include <sys/errno.h>
 #include <sys/extent.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 #include <sys/time.h>
 
@@ -186,7 +186,7 @@
 {
        struct sparc_bus_space_tag *bt;
 
-       bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO);
+       bt = kmem_zalloc(sizeof(*bt), KM_SLEEP);
        bt->cookie = sc;
        bt->parent = parent;
        bt->type = type;
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/fdc.c
--- a/sys/arch/sparc64/dev/fdc.c        Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/fdc.c        Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdc.c,v 1.48 2019/11/10 21:16:33 chs Exp $     */
+/*     $NetBSD: fdc.c,v 1.49 2021/01/04 14:48:51 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.48 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.49 2021/01/04 14:48:51 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -119,7 +119,7 @@
 #include <sys/fdio.h>
 #include <sys/buf.h>
 #include <sys/bufq.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/proc.h>
 #include <sys/uio.h>
 #include <sys/stat.h>
@@ -2287,8 +2287,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;
@@ -2312,7 +2311,7 @@
                }
 
                error = fdformat(dev, fd_formb, l->l_proc);
-               free(fd_formb, M_TEMP);
+               kmem_free(fd_formb, sizeof(*fd_formb));
                return error;
 
        case FDIOCGETOPTS:              /* get drive options */
@@ -2542,7 +2541,7 @@
 
        dev = makedev(54,0);    /* XXX */
 
-       addr = malloc(FDMICROROOTSIZE, M_DEVBUF, M_WAITOK);
+       addr = kmem_alloc(FDMICROROOTSIZE, KM_SLEEP);
        *addrp = addr;
 
        if (fdopen(dev, 0, S_IFCHR, NULL))
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/fhc.c
--- a/sys/arch/sparc64/dev/fhc.c        Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/fhc.c        Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fhc.c,v 1.6 2019/11/10 21:16:33 chs Exp $      */
+/*     $NetBSD: fhc.c,v 1.7 2021/01/04 14:48:51 thorpej Exp $  */
 /*     $OpenBSD: fhc.c,v 1.17 2010/11/11 17:58:23 miod Exp $   */
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.6 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.7 2021/01/04 14:48:51 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -37,6 +37,7 @@
 #include <sys/device.h>
 #include <sys/conf.h>
 #include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/bus.h>
 
 #include <machine/autoconf.h>
@@ -163,7 +164,7 @@
 {
        struct sparc_bus_space_tag *bt;
 
-       bt = malloc(sizeof(*bt), M_DEVBUF, M_WAITOK | M_ZERO);
+       bt = kmem_zalloc(sizeof(*bt), KM_SLEEP);
        bt->cookie = sc;
        bt->parent = sc->sc_bt;
        bt->type = 0;   /* XXX asi? */
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/pckbc_ebus.c
--- a/sys/arch/sparc64/dev/pckbc_ebus.c Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/pckbc_ebus.c Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $ */
+/*     $NetBSD: pckbc_ebus.c,v 1.4 2021/01/04 14:48:51 thorpej Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,13 +28,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.3 2018/10/13 20:11:48 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc_ebus.c,v 1.4 2021/01/04 14:48:51 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/device.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/bus.h>
 #include <sys/intr.h>
 
@@ -154,8 +154,7 @@
                        return;
                }
 
-               t = malloc(sizeof(struct pckbc_internal), M_DEVBUF, M_WAITOK);
-               memset(t, 0, sizeof(struct pckbc_internal));
+               t = kmem_zalloc(sizeof(struct pckbc_internal), KM_SLEEP);
                t->t_iot = iot;
                t->t_ioh_d = ioh_d;
                t->t_ioh_c = ioh_c;
diff -r 0239a92865fc -r d87952ebbcfd sys/arch/sparc64/dev/psycho.c
--- a/sys/arch/sparc64/dev/psycho.c     Mon Jan 04 05:35:14 2021 +0000
+++ b/sys/arch/sparc64/dev/psycho.c     Mon Jan 04 14:48:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: psycho.c,v 1.128 2019/11/10 21:16:33 chs Exp $ */
+/*     $NetBSD: psycho.c,v 1.129 2021/01/04 14:48:51 thorpej Exp $     */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.128 2019/11/10 21:16:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.129 2021/01/04 14:48:51 thorpej Exp $");
 
 #include "opt_ddb.h"
 
@@ -81,7 +81,7 @@
 #include <sys/device.h>
 #include <sys/errno.h>
 #include <sys/extent.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/systm.h>
 #include <sys/time.h>
 #include <sys/reboot.h>
@@ -463,8 +463,7 @@
        /*
         * Allocate our psycho_pbm
         */
-       pp = sc->sc_psycho_this = malloc(sizeof *pp, M_DEVBUF,
-                                        M_WAITOK | M_ZERO);
+       pp = sc->sc_psycho_this = kmem_zalloc(sizeof *pp, KM_SLEEP);
        pp->pp_sc = sc;
 
        /* grab the psycho ranges */
@@ -580,8 +579,7 @@
                 * Allocate bus node, this contains a prom node per bus.
                 */
                pp->pp_pc->spc_busnode =
-                   malloc(sizeof(*pp->pp_pc->spc_busnode), M_DEVBUF,



Home | Main Index | Thread Index | Old Index