Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi One malloc(9) type is enough for ACPI; use M_ACPI.



details:   https://anonhg.NetBSD.org/src/rev/071917fd3a54
branches:  trunk
changeset: 754202:071917fd3a54
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Fri Apr 23 15:52:26 2010 +0000

description:
One malloc(9) type is enough for ACPI; use M_ACPI.

diffstat:

 sys/dev/acpi/acpi_pci_link.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (90 lines):

diff -r 535543d84e61 -r 071917fd3a54 sys/dev/acpi/acpi_pci_link.c
--- a/sys/dev/acpi/acpi_pci_link.c      Fri Apr 23 15:46:59 2010 +0000
+++ b/sys/dev/acpi/acpi_pci_link.c      Fri Apr 23 15:52:26 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_pci_link.c,v 1.17 2010/04/14 19:27:28 jruoho Exp $        */
+/*     $NetBSD: acpi_pci_link.c,v 1.18 2010/04/23 15:52:26 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2002 Mitsuru IWASAKI <iwasaki%jp.freebsd.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.17 2010/04/14 19:27:28 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_link.c,v 1.18 2010/04/23 15:52:26 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -46,6 +46,7 @@
 #define _COMPONENT          ACPI_BUS_COMPONENT
 ACPI_MODULE_NAME            ("acpi_pci_link")
 
+MALLOC_DECLARE(M_ACPI);
 
 #define NUM_ISA_INTERRUPTS     16
 #define NUM_ACPI_INTERRUPTS    256
@@ -132,8 +133,6 @@
        int     link_index;
 };
 
-MALLOC_DEFINE(M_PCI_LINK, "pci_link", "ACPI PCI Link structures");
-
 static int pci_link_interrupt_weights[NUM_ACPI_INTERRUPTS];
 static int pci_link_bios_isa_irqs;
 
@@ -343,7 +342,7 @@
                 */
                link->l_isa_irq = TRUE;
                link->l_irqs = malloc(sizeof(int) * link->l_num_irqs,
-                   M_PCI_LINK, M_WAITOK | M_ZERO);
+                   M_ACPI, M_WAITOK | M_ZERO);
                for (i = 0; i < link->l_num_irqs; i++) {
                        if (is_ext_irq) {
                                link->l_irqs[i] = ext_irqs[i];
@@ -463,7 +462,7 @@
                return (0);
        }
        sc->pl_links = malloc(sizeof(struct link) * sc->pl_num_links,
-           M_PCI_LINK, M_WAITOK | M_ZERO);
+           M_ACPI, M_WAITOK | M_ZERO);
 
        /* Initialize the child links. */
        for (i = 0; i < sc->pl_num_links; i++) {
@@ -554,11 +553,11 @@
        ACPI_SERIAL_END(pci_link);
        for (i = 0; i < sc->pl_num_links; i++) {
                if (sc->pl_links[i].l_irqs != NULL)
-                       free(sc->pl_links[i].l_irqs, M_PCI_LINK);
+                       free(sc->pl_links[i].l_irqs, M_ACPI);
                if (sc->pl_links[i].l_devices != NULL)
-                       free(sc->pl_links[i].l_devices, M_PCI_LINK);
+                       free(sc->pl_links[i].l_devices, M_ACPI);
        }
-       free(sc->pl_links, M_PCI_LINK);
+       free(sc->pl_links, M_ACPI);
        return (ENXIO);
 }
 
@@ -599,7 +598,7 @@
 
                link->l_devices = realloc(link->l_devices,
                    sizeof(pcitag_t) * (link->l_dev_count + 1),
-                   M_PCI_LINK, M_WAITOK);
+                   M_ACPI, M_WAITOK);
                link->l_devices[link->l_dev_count] = tag;
                ++link->l_dev_count;
        }
@@ -1144,10 +1143,10 @@
 
        TAILQ_FOREACH(sc, &acpi_pci_linkdevs, pl_list) {
                if (sc->pl_handle == handle)
-                       return sc;  
+                       return sc;
        }
 
-       sc = malloc(sizeof (*sc), M_PCI_LINK, M_NOWAIT|M_ZERO);
+       sc = malloc(sizeof (*sc), M_ACPI, M_NOWAIT | M_ZERO);
        if (sc == NULL)
                return NULL;
 



Home | Main Index | Thread Index | Old Index