Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Switch from printf to aprintf_error/normal



details:   https://anonhg.NetBSD.org/src/rev/cbf4a98b37f1
branches:  trunk
changeset: 1010626:cbf4a98b37f1
user:      sevan <sevan%NetBSD.org@localhost>
date:      Sat May 30 22:01:05 2020 +0000

description:
Switch from printf to aprintf_error/normal

diffstat:

 sys/dev/pci/if_rge.c |  60 +++++++++++++++++++++++++--------------------------
 1 files changed, 29 insertions(+), 31 deletions(-)

diffs (221 lines):

diff -r aec95588eb91 -r cbf4a98b37f1 sys/dev/pci/if_rge.c
--- a/sys/dev/pci/if_rge.c      Sat May 30 21:39:49 2020 +0000
+++ b/sys/dev/pci/if_rge.c      Sat May 30 22:01:05 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $        */
+/*     $NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $        */
 /*     $OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $  */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -217,7 +217,7 @@
                        if (pci_mapreg_map(pa, RGE_PCI_BAR0, PCI_MAPREG_TYPE_IO,
                            0, &sc->rge_btag, &sc->rge_bhandle, NULL,
                            &sc->rge_bsize)) {
-                               printf(": can't map mem or i/o space\n");
+                               aprint_error(": can't map mem or i/o space\n");
                                return;
                        }
                }
@@ -229,20 +229,20 @@
        if (pci_intr_map(pa, &ih) == 0)
                sc->rge_flags |= RGE_FLAG_MSI;
        else if (pci_intr_map(pa, &ih) != 0) {
-               printf(": couldn't map interrupt\n");
+               aprint_error(": couldn't map interrupt\n");
                return;
        }
        intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
        sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_NET, rge_intr,
            sc, sc->sc_dev.dv_xname);
        if (sc->sc_ih == NULL) {
-               printf(": couldn't establish interrupt");
+               aprint_error_dev(sc->sc_dev, ": couldn't establish interrupt");
                if (intrstr != NULL)
-                       printf(" at %s", intrstr);
-               printf("\n");
+                       aprint_error(" at %s\n", intrstr);
+               aprint_error("\n");
                return;
        }
-       printf(": %s", intrstr);
+       aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
 
        if (pci_dma64_available(pa))
                sc->sc_dmat = pa->pa_dmat64;
@@ -262,7 +262,7 @@
                sc->rge_type = MAC_CFG3;
                break;
        default:
-               printf(": unknown version 0x%08x\n", hwrev);
+               aprint_error(": unknown version 0x%08x\n", hwrev);
                return;
        }
 
@@ -285,7 +285,8 @@
        rge_hw_init(sc);
 
        rge_get_macaddr(sc, eaddr);
-       printf(", address %s\n", ether_sprintf(eaddr));
+       aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
+           ether_sprintf(eaddr));
 
        memcpy(sc->sc_enaddr, eaddr, ETHER_ADDR_LEN);
 
@@ -622,7 +623,7 @@
 {
        struct rge_softc *sc = ifp->if_softc;
 
-       printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname);
+       aprint_error_dev(sc->sc_dev, "watchdog timeout\n");
        if_statinc(ifp, if_oerrors);
 
        rge_init(ifp);
@@ -657,8 +658,8 @@
 
        /* Initialize RX descriptors list. */
        if (rge_rx_list_init(sc) == ENOBUFS) {
-               printf("%s: init failed: no memory for RX buffers\n",
-                   sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev,
+                   "init failed: no memory for RX buffers\n");
                rge_stop(ifp);
                return (ENOBUFS);
        }
@@ -903,7 +904,8 @@
                ifp->if_baudrate = IF_Mbps(10);
                break;
        default:
-               printf("%s: unsupported media type\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev,
+                   "unsupported media type\n");
                return (EINVAL);
        }
 
@@ -960,14 +962,14 @@
        error = bus_dmamap_create(sc->sc_dmat, RGE_TX_LIST_SZ, 1,
            RGE_TX_LIST_SZ, 0, BUS_DMA_NOWAIT, &sc->rge_ldata.rge_tx_list_map);
        if (error) {
-               printf("%s: can't create TX list map\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't create TX list map\n");
                return (error);
        }
        error = bus_dmamem_alloc(sc->sc_dmat, RGE_TX_LIST_SZ, RGE_ALIGN, 0,
            &sc->rge_ldata.rge_tx_listseg, 1, &sc->rge_ldata.rge_tx_listnseg,
            BUS_DMA_NOWAIT); /* XXX OpenBSD adds BUS_DMA_ZERO */
        if (error) {
-               printf("%s: can't alloc TX list\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't alloc TX list\n");
                return (error);
        }
 
@@ -977,7 +979,7 @@
            (void **) &sc->rge_ldata.rge_tx_list,
            BUS_DMA_NOWAIT); /* XXX OpenBSD adds BUS_DMA_COHERENT */
        if (error) {
-               printf("%s: can't map TX dma buffers\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't map TX dma buffers\n");
                bus_dmamem_free(sc->sc_dmat, &sc->rge_ldata.rge_tx_listseg,
                    sc->rge_ldata.rge_tx_listnseg);
                return (error);
@@ -985,7 +987,7 @@
        error = bus_dmamap_load(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
            sc->rge_ldata.rge_tx_list, RGE_TX_LIST_SZ, NULL, BUS_DMA_NOWAIT);
        if (error) {
-               printf("%s: can't load TX dma map\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't load TX dma map\n");
                bus_dmamap_destroy(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map);
                bus_dmamem_unmap(sc->sc_dmat,
                    sc->rge_ldata.rge_tx_list, RGE_TX_LIST_SZ);
@@ -1000,8 +1002,7 @@
                    RGE_TX_NSEGS, RGE_JUMBO_FRAMELEN, 0, 0,
                    &sc->rge_ldata.rge_txq[i].txq_dmamap);
                if (error) {
-                       printf("%s: can't create DMA map for TX\n",
-                           sc->sc_dev.dv_xname);
+                       aprint_error_dev(sc->sc_dev, "can't create DMA map for TX\n");
                        return (error);
                }
        }
@@ -1010,14 +1011,14 @@
        error = bus_dmamap_create(sc->sc_dmat, RGE_RX_LIST_SZ, 1,
            RGE_RX_LIST_SZ, 0, 0, &sc->rge_ldata.rge_rx_list_map);
        if (error) {
-               printf("%s: can't create RX list map\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't create RX list map\n");
                return (error);
        }
        error = bus_dmamem_alloc(sc->sc_dmat, RGE_RX_LIST_SZ, RGE_ALIGN, 0,
            &sc->rge_ldata.rge_rx_listseg, 1, &sc->rge_ldata.rge_rx_listnseg,
            BUS_DMA_NOWAIT);  /* XXX OpenBSD adds BUS_DMA_ZERO */
        if (error) {
-               printf("%s: can't alloc RX list\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't alloc RX list\n");
                return (error);
        }
 
@@ -1027,7 +1028,7 @@
            (void **) &sc->rge_ldata.rge_rx_list,
            BUS_DMA_NOWAIT);  /* XXX OpenBSD adds BUS_DMA_COHERENT */
        if (error) {
-               printf("%s: can't map RX dma buffers\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't map RX dma buffers\n");
                bus_dmamem_free(sc->sc_dmat, &sc->rge_ldata.rge_rx_listseg,
                    sc->rge_ldata.rge_rx_listnseg);
                return (error);
@@ -1035,7 +1036,7 @@
        error = bus_dmamap_load(sc->sc_dmat, sc->rge_ldata.rge_rx_list_map,
            sc->rge_ldata.rge_rx_list, RGE_RX_LIST_SZ, NULL, BUS_DMA_NOWAIT);
        if (error) {
-               printf("%s: can't load RX dma map\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "can't load RX dma map\n");
                bus_dmamap_destroy(sc->sc_dmat, sc->rge_ldata.rge_rx_list_map);
                bus_dmamem_unmap(sc->sc_dmat,
                    sc->rge_ldata.rge_rx_list, RGE_RX_LIST_SZ);
@@ -1050,8 +1051,7 @@
                    RGE_JUMBO_FRAMELEN, 0, 0,
                    &sc->rge_ldata.rge_rxq[i].rxq_dmamap);
                if (error) {
-                       printf("%s: can't create DMA map for RX\n",
-                           sc->sc_dev.dv_xname);
+                       aprint_error_dev(sc->sc_dev, "can't create DMA map for RX\n");
                        return (error);
                }
        }
@@ -1089,8 +1089,7 @@
        r = &sc->rge_ldata.rge_rx_list[idx];
 
        if (RGE_OWN(r)) {
-               printf("%s: tried to map busy RX descriptor\n",
-                   sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "tried to map busy RX descriptor\n");
                goto out;
        }
 
@@ -1385,7 +1384,7 @@
                        break;
        }
        if (i == RGE_TIMEOUT)
-               printf("%s: reset never completed!\n", sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "reset never completed!\n");
 }
 
 void
@@ -1782,8 +1781,7 @@
                        break;
        }
        if (i == 1000)
-               printf("%s: timeout waiting to patch phy mcu\n",
-                   sc->sc_dev.dv_xname);
+               aprint_error_dev(sc->sc_dev, "timeout waiting to patch phy mcu\n");
 }
 
 void



Home | Main Index | Thread Index | Old Index