Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/cavium/dev malloc(9) -> kmem(9)



details:   https://anonhg.NetBSD.org/src/rev/b80bed6d1b7d
branches:  trunk
changeset: 949191:b80bed6d1b7d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jan 04 17:22:59 2021 +0000

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

diffstat:

 sys/arch/mips/cavium/dev/octeon_asx.c |   8 ++++----
 sys/arch/mips/cavium/dev/octeon_fpa.c |  12 +++++-------
 sys/arch/mips/cavium/dev/octeon_gmx.c |  10 +++++-----
 sys/arch/mips/cavium/dev/octeon_ipd.c |  11 ++++-------
 sys/arch/mips/cavium/dev/octeon_pip.c |  11 ++++-------
 sys/arch/mips/cavium/dev/octeon_pko.c |  11 ++++-------
 6 files changed, 26 insertions(+), 37 deletions(-)

diffs (212 lines):

diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_asx.c
--- a/sys/arch/mips/cavium/dev/octeon_asx.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_asx.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $    */
+/*     $NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.4 2020/06/23 05:14:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_asx.c,v 1.5 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <mips/cavium/octeonvar.h>
 #include <mips/cavium/dev/octeon_asxreg.h>
 #include <mips/cavium/dev/octeon_asxvar.h>
@@ -43,7 +43,7 @@
        struct octasx_softc *sc;
        int status;
 
-       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        if (sc == NULL)
                panic("can't allocate memory: %s", __func__);
 
diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_fpa.c
--- a/sys/arch/mips/cavium/dev/octeon_fpa.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_fpa.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $    */
+/*     $NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -29,12 +29,12 @@
 #undef FPADEBUG
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.8 2020/06/23 05:14:18 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_fpa.c,v 1.9 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/types.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 
 #include <sys/bus.h>
 #include <machine/locore.h>
@@ -113,10 +113,8 @@
        paddr_t paddr;
 
        nsegs = 1/* XXX */;
-       fb = malloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs, M_DEVBUF,
-           M_WAITOK | M_ZERO);
-       if (fb == NULL)
-               return 1;
+       fb = kmem_zalloc(sizeof(*fb) + sizeof(*fb->fb_dma_segs) * nsegs,
+           KM_SLEEP);
        fb->fb_poolno = poolno;
        fb->fb_size = size;
        fb->fb_nelems = nelems;
diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_gmx.c
--- a/sys/arch/mips/cavium/dev/octeon_gmx.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_gmx.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $   */
+/*     $NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $  */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.15 2020/06/23 05:17:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_gmx.c,v 1.16 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -36,7 +36,7 @@
 #include <sys/device.h>
 #include <sys/lock.h>
 #include <sys/cdefs.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/syslog.h>
 
 #include <mips/locore.h>
@@ -218,8 +218,8 @@
 
        octgmx_init(sc);
 
-       sc->sc_ports = malloc(sizeof(*sc->sc_ports) * sc->sc_nports, M_DEVBUF,
-           M_WAITOK | M_ZERO);
+       sc->sc_ports = kmem_zalloc(sizeof(*sc->sc_ports) * sc->sc_nports,
+           KM_SLEEP);
 
        for (i = 0; i < sc->sc_nports; i++) {
                port = GMX_PORT_NUM(sc->sc_unitno, i);
diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_ipd.c
--- a/sys/arch/mips/cavium/dev/octeon_ipd.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_ipd.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $    */
+/*     $NetBSD: octeon_ipd.c,v 1.8 2021/01/04 17:22:59 thorpej Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.7 2020/06/23 05:15:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_ipd.c,v 1.8 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/mbuf.h>
 #include <mips/locore.h>
 #include <mips/cavium/octeonvar.h>
@@ -56,10 +56,7 @@
        struct octipd_softc *sc;
        int status;
 
-       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
-       if (sc == NULL)
-               panic("can't allocate memory: %s", __func__);
-
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_port = aa->aa_port;
        sc->sc_regt = aa->aa_regt;
        sc->sc_first_mbuff_skip = aa->aa_first_mbuff_skip;
diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_pip.c
--- a/sys/arch/mips/cavium/dev/octeon_pip.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pip.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_pip.c,v 1.9 2020/07/16 11:49:37 jmcneill Exp $  */
+/*     $NetBSD: octeon_pip.c,v 1.10 2021/01/04 17:22:59 thorpej Exp $  */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.9 2020/07/16 11:49:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_pip.c,v 1.10 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <sys/syslog.h>
 #include <sys/time.h>
 #include <net/if.h>
@@ -177,10 +177,7 @@
        struct octpip_softc *sc;
        int status;
 
-       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
-       if (sc == NULL)
-               panic("can't allocate memory: %s", __func__);
-
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_port = aa->aa_port;
        sc->sc_regt = aa->aa_regt;
        sc->sc_tag_type = aa->aa_tag_type;
diff -r 9ba1e2e91a9f -r b80bed6d1b7d sys/arch/mips/cavium/dev/octeon_pko.c
--- a/sys/arch/mips/cavium/dev/octeon_pko.c     Mon Jan 04 17:06:20 2021 +0000
+++ b/sys/arch/mips/cavium/dev/octeon_pko.c     Mon Jan 04 17:22:59 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: octeon_pko.c,v 1.5 2020/06/23 05:15:33 simonb Exp $    */
+/*     $NetBSD: octeon_pko.c,v 1.6 2021/01/04 17:22:59 thorpej Exp $   */
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,11 +27,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: octeon_pko.c,v 1.5 2020/06/23 05:15:33 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_pko.c,v 1.6 2021/01/04 17:22:59 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <sys/kmem.h>
 #include <mips/locore.h>
 #include <mips/cavium/octeonvar.h>
 #include <mips/cavium/dev/octeon_faureg.h>
@@ -56,10 +56,7 @@
        struct octpko_softc *sc;
        int status;
 
-       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
-       if (sc == NULL)
-               panic("can't allocate memory: %s", __func__);
-
+       sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
        sc->sc_port = aa->aa_port;
        sc->sc_regt = aa->aa_regt;
        sc->sc_cmdptr = aa->aa_cmdptr;



Home | Main Index | Thread Index | Old Index