Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci use aprint consistently; note that we use aprint...



details:   https://anonhg.NetBSD.org/src/rev/29f8fcd044ee
branches:  trunk
changeset: 338430:29f8fcd044ee
user:      christos <christos%NetBSD.org@localhost>
date:      Sun May 24 14:55:12 2015 +0000

description:
use aprint consistently; note that we use aprint_normal_dev in debugging
statements instead of aprint_debug_dev because those are controlled by
the driver debugging, not the centralized one.

diffstat:

 sys/dev/pci/auich.c |  81 ++++++++++++++++++++++++++++------------------------
 1 files changed, 44 insertions(+), 37 deletions(-)

diffs (260 lines):

diff -r af203a6d2cca -r 29f8fcd044ee sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Sun May 24 09:33:20 2015 +0000
+++ b/sys/dev/pci/auich.c       Sun May 24 14:55:12 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auich.c,v 1.145 2015/04/13 16:33:25 riastradh Exp $    */
+/*     $NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $     */
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.145 2015/04/13 16:33:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.146 2015/05/24 14:55:12 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -237,7 +237,7 @@
 
 /* Debug */
 #ifdef AUICH_DEBUG
-#define        DPRINTF(l,x)    do { if (auich_debug & (l)) printf x; } while(0)
+#define        DPRINTF(l,x)    do { if (auich_debug & (l)) aprint_normal_dev x; } while(0)
 int auich_debug = 0xfffe;
 #define        ICH_DEBUG_CODECIO       0x0001
 #define        ICH_DEBUG_DMA           0x0002
@@ -584,8 +584,8 @@
        sc->pcmo.qptr = sc->pcmi.qptr = sc->mici.qptr = 0;
        auich_alloc_cdata(sc);
 
-       DPRINTF(ICH_DEBUG_DMA, ("auich_attach: lists %p %p %p\n",
-           sc->pcmo.dmalist, sc->pcmi.dmalist, sc->mici.dmalist));
+       DPRINTF(ICH_DEBUG_DMA, (sc->sc_dev, "%s: lists %p %p %p\n",
+           __func__, sc->pcmo.dmalist, sc->pcmi.dmalist, sc->mici.dmalist));
 
        /* Modem codecs are always the secondary codec on ICH */
        sc->sc_codecnum = sc->sc_codectype == AC97_CODEC_TYPE_MODEM ? 1 : 0;
@@ -683,8 +683,7 @@
        return;
 
  sysctl_err:
-       printf("%s: failed to add sysctl nodes. (%d)\n",
-              device_xname(self), err);
+       aprint_error_dev(self, "failed to add sysctl nodes. (%d)\n", err);
        return;                 /* failure of sysctl is not fatal. */
 }
 
@@ -793,7 +792,7 @@
                *val = bus_space_read_2(sc->iot, sc->mix_ioh,
                    reg + (sc->sc_codecnum * ICH_CODEC_OFFSET));
                DPRINTF(ICH_DEBUG_CODECIO,
-                   ("auich_read_codec(%x, %x)\n", reg, *val));
+                   (sc->sc_dev, "%s(%x, %x)\n", __func__, reg, *val));
                status = bus_space_read_4(sc->iot, sc->aud_ioh,
                    ICH_GSTS + sc->sc_modem_offset);
                if (status & ICH_RCS) {
@@ -802,7 +801,7 @@
                                          status & ~(ICH_SRI|ICH_PRI|ICH_GSCI));
                        *val = 0xffff;
                        DPRINTF(ICH_DEBUG_CODECIO,
-                           ("%s: read_codec error\n", device_xname(sc->sc_dev)));
+                           (sc->sc_dev, "%s: read_codec error\n", __func__));
                        if (reg == AC97_REG_GPIO_STATUS)
                                auich_clear_cas(sc);
                        return -1;
@@ -824,8 +823,9 @@
        struct auich_softc *sc;
        int i;
 
-       DPRINTF(ICH_DEBUG_CODECIO, ("auich_write_codec(%x, %x)\n", reg, val));
        sc = v;
+       DPRINTF(ICH_DEBUG_CODECIO, (sc->sc_dev, "%s(%x, %x)\n",
+           __func__, reg, val));
        /* wait for an access semaphore */
        for (i = ICH_SEMATIMO / ICH_CODECIO_INTERVAL; i-- &&
            bus_space_read_1(sc->iot, sc->aud_ioh,
@@ -886,11 +886,9 @@
        }
 #ifdef AUICH_DEBUG
        if (status & ICH_SCR)
-               printf("%s: The 2nd codec is ready.\n",
-                      device_xname(sc->sc_dev));
+               aprint_normal_dev(sc->sc_dev, "The 2nd codec is ready.\n");
        if (status & ICH_S2CR)
-               printf("%s: The 3rd codec is ready.\n",
-                      device_xname(sc->sc_dev));
+               aprint_normal_dev(sc->sc_dev, "The 3rd codec is ready.\n");
 #endif
        return 0;
 }
@@ -1069,7 +1067,8 @@
 
 #if AUICH_DEBUG
        if (i > 0)
-               printf("auich_halt_pipe: halt took %d cycles\n", i);
+               aprint_normal_dev(sc->sc_dev, "%s: halt took %d cycles\n",
+                   __func__, i);
 #endif
 }
 
@@ -1079,7 +1078,7 @@
        struct auich_softc *sc;
 
        sc = v;
-       DPRINTF(ICH_DEBUG_DMA, ("%s: halt_output\n", device_xname(sc->sc_dev)));
+       DPRINTF(ICH_DEBUG_DMA, (sc->sc_dev, "%s\n", __func__));
 
        auich_halt_pipe(sc, ICH_PCMO);
        sc->pcmo.intr = NULL;
@@ -1093,7 +1092,7 @@
        struct auich_softc *sc;
 
        sc = v;
-       DPRINTF(ICH_DEBUG_DMA, ("%s: halt_input\n", device_xname(sc->sc_dev)));
+       DPRINTF(ICH_DEBUG_DMA, (sc->sc_dev, "%s\n", __func__));
 
        auich_halt_pipe(sc, ICH_PCMI);
        sc->pcmi.intr = NULL;
@@ -1248,13 +1247,15 @@
 #ifdef DIAGNOSTIC
        csts = pci_conf_read(sc->sc_pc, sc->sc_pt, PCI_COMMAND_STATUS_REG);
        if (csts & PCI_STATUS_MASTER_ABORT) {
-               printf("auich_intr: PCI master abort\n");
+               aprint_error_dev(sc->sc_dev, "%s: PCI master abort\n",
+                   __func__);
        }
 #endif
 
        gsts = bus_space_read_4(sc->iot, sc->aud_ioh,
            ICH_GSTS + sc->sc_modem_offset);
-       DPRINTF(ICH_DEBUG_INTR, ("auich_intr: gsts=0x%x\n", gsts));
+       DPRINTF(ICH_DEBUG_INTR, (sc->sc_dev, "%s: gsts=0x%x\n",
+           __func__, gsts));
 
        if ((sc->sc_codectype == AC97_CODEC_TYPE_AUDIO && gsts & ICH_POINT) ||
            (sc->sc_codectype == AC97_CODEC_TYPE_MODEM && gsts & ICH_MOINT)) {
@@ -1262,11 +1263,12 @@
 
                sts = bus_space_read_2(sc->iot, sc->aud_ioh,
                    ICH_PCMO + sc->sc_sts_reg);
-               DPRINTF(ICH_DEBUG_INTR,
-                   ("auich_intr: osts=0x%x\n", sts));
+               DPRINTF(ICH_DEBUG_INTR, 
+                   (sc->sc_dev, "%s: osts=0x%x\n", __func__, sts));
 
                if (sts & ICH_FIFOE)
-                       printf("%s: fifo underrun\n", device_xname(sc->sc_dev));
+                       aprint_error_dev(sc->sc_dev, "%s: fifo underrun\n",
+                           __func__);
 
                if (sts & ICH_BCIS)
                        auich_intr_pipe(sc, ICH_PCMO, &sc->pcmo);
@@ -1290,10 +1292,11 @@
                sts = bus_space_read_2(sc->iot, sc->aud_ioh,
                    ICH_PCMI + sc->sc_sts_reg);
                DPRINTF(ICH_DEBUG_INTR,
-                   ("auich_intr: ists=0x%x\n", sts));
+                   (sc->sc_dev, "%s: ists=0x%x\n", __func__, sts));
 
                if (sts & ICH_FIFOE)
-                       printf("%s: fifo overrun\n", device_xname(sc->sc_dev));
+                       aprint_error_dev(sc->sc_dev, "%s: fifo overrun\n",
+                           __func__);
 
                if (sts & ICH_BCIS)
                        auich_intr_pipe(sc, ICH_PCMI, &sc->pcmi);
@@ -1316,10 +1319,11 @@
                sts = bus_space_read_2(sc->iot, sc->aud_ioh,
                    ICH_MICI + sc->sc_sts_reg);
                DPRINTF(ICH_DEBUG_INTR,
-                   ("auich_intr: ists=0x%x\n", sts));
+                   (sc->sc_dev, "%s: ists=0x%x\n", __func__, sts));
 
                if (sts & ICH_FIFOE)
-                       printf("%s: fifo overrun\n", device_xname(sc->sc_dev));
+                       aprint_error_dev(sc->sc_dev, "%s: fifo overrun\n",
+                           __func__);
 
                if (sts & ICH_BCIS)
                        auich_intr_pipe(sc, ICH_MICI, &sc->mici);
@@ -1334,7 +1338,7 @@
 
 #ifdef AUICH_MODEM_DEBUG
        if (sc->sc_codectype == AC97_CODEC_TYPE_MODEM && gsts & ICH_GSCI) {
-               printf("%s: gsts=0x%x\n", device_xname(sc->sc_dev), gsts);
+               aprint_normal_dev(sc->sc_dev, "gsts=0x%x\n", gsts);
                /* int ack */
                bus_space_write_4(sc->iot, sc->aud_ioh,
                    ICH_GSTS + sc->sc_modem_offset, ICH_GSCI);
@@ -1388,7 +1392,7 @@
                q->len = (blksize >> sc->sc_sample_shift) | ICH_DMAF_IOC;
 
                DPRINTF(ICH_DEBUG_INTR,
-                   ("auich_intr: %p, %p = %x @ 0x%x\n",
+                   (sc->sc_dev, "%s: %p, %p = %x @ 0x%x\n", __func__,
                    &ring->dmalist[qptr], q, q->len, q->base));
 
                ring->p += blksize;
@@ -1413,15 +1417,16 @@
        struct auich_dma *p;
        size_t size;
 
+       sc = v;
        DPRINTF(ICH_DEBUG_DMA,
-           ("auich_trigger_output(%p, %p, %d, %p, %p, %p)\n",
+           (sc->sc_dev, "%s(%p, %p, %d, %p, %p, %p)\n", __func__,
            start, end, blksize, intr, arg, param));
-       sc = v;
 
        for (p = sc->sc_dmas; p && KERNADDR(p) != start; p = p->next)
                continue;
        if (!p) {
-               printf("auich_trigger_output: bad addr %p\n", start);
+               aprint_error_dev(sc->sc_dev, "%s: bad addr %p\n", __func__,
+                   start);
                return EINVAL;
        }
 
@@ -1449,15 +1454,16 @@
        struct auich_dma *p;
        size_t size;
 
+       sc = v;
        DPRINTF(ICH_DEBUG_DMA,
-           ("auich_trigger_input(%p, %p, %d, %p, %p, %p)\n",
+           (sc->sc_dev, "%s(%p, %p, %d, %p, %p, %p)\n", __func__,
            start, end, blksize, intr, arg, param));
-       sc = v;
 
        for (p = sc->sc_dmas; p && KERNADDR(p) != start; p = p->next)
                continue;
        if (!p) {
-               printf("auich_trigger_input: bad addr %p\n", start);
+               aprint_error_dev(sc->sc_dev, "%s: bad addr %p\n", __func__,
+                   start);
                return EINVAL;
        }
 
@@ -1642,7 +1648,8 @@
        for (p = sc->sc_dmas; p && KERNADDR(p) != temp_buffer; p = p->next)
                continue;
        if (p == NULL) {
-               printf("auich_calibrate: bad address %p\n", temp_buffer);
+               aprint_error_dev(sc->sc_dev, "%s: bad address %p\n",
+                   __func__, temp_buffer);
                return;
        }
        sc->pcmi.dmalist[0].base = DMAADDR(p);
@@ -1697,8 +1704,8 @@
        auich_freem(sc, temp_buffer, bytes);
 
        if (nciv == ociv) {
-               printf("%s: ac97 link rate calibration timed out after %"
-                      PRIu64 " us\n", device_xname(sc->sc_dev), wait_us);
+               aprint_error_dev(sc->sc_dev, "ac97 link rate calibration "
+                   "timed out after %" PRIu64 " us\n", wait_us);
                return;
        }
 



Home | Main Index | Thread Index | Old Index