Module Name:    src
Committed By:   christos
Date:           Sun May 24 14:55:12 UTC 2015

Modified Files:
        src/sys/dev/pci: auich.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/dev/pci/auich.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.145 src/sys/dev/pci/auich.c:1.146
--- src/sys/dev/pci/auich.c:1.145	Mon Apr 13 12:33:25 2015
+++ src/sys/dev/pci/auich.c	Sun May 24 10:55:12 2015
@@ -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 @@ struct auich_softc {
 
 /* 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 @@ map_done:
 	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 @@ map_done:
 	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 @@ auich_read_codec(void *v, uint8_t reg, u
 		*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 @@ auich_read_codec(void *v, uint8_t reg, u
 					  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 @@ auich_write_codec(void *v, uint8_t reg, 
 	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 @@ auich_reset_codec(void *v)
 	}
 #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 @@ auich_halt_pipe(struct auich_softc *sc, 
 
 #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 @@ auich_halt_output(void *v)
 	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 @@ auich_halt_input(void *v)
 	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 @@ auich_intr(void *v)
 #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 @@ auich_intr(void *v)
 
 		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 @@ auich_intr(void *v)
 		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 @@ auich_intr(void *v)
 		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 @@ auich_intr(void *v)
 
 #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 @@ auich_intr_pipe(struct auich_softc *sc, 
 		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 @@ auich_trigger_output(void *v, void *star
 	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 @@ auich_trigger_input(void *v, void *start
 	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 @@ auich_calibrate(struct auich_softc *sc)
 	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_calibrate(struct auich_softc *sc)
 	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;
 	}
 

Reply via email to