Subject: aprint conversions in sys/dev/mca
To: None <tech-kern@netbsd.org>
From: Chris Fuhrman <cfuhrman@pobox.com>
List: tech-kern
Date: 03/25/2007 11:49:03
Howdy,

I'm including a patch that converts a number of printf()s in sys/dev/mca
to aprint_*().  Until I get the hang of this, I've only done three files
for the time being.

Most of the error strings were no-brainers.  For other aprintf_*
statements, I've made "best guesses" based on context.

Comments welcome! :)

-- 
Chris Fuhrman
cfuhrman@pobox.com

Index: sys/dev/mca/aha_mca.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mca/aha_mca.c,v
retrieving revision 1.16
diff -u -r1.16 aha_mca.c
--- sys/dev/mca/aha_mca.c	16 Nov 2006 01:33:05 -0000	1.16
+++ sys/dev/mca/aha_mca.c	25 Mar 2007 15:32:21 -0000
@@ -143,7 +143,7 @@
 	apd.sc_drq = ma->ma_pos[5] & 0xf;
 	apd.sc_scsi_dev = (ma->ma_pos[4] & 0xe0) >> 5;

-	printf(" slot %d irq %d drq %d: Adaptec AHA-1640 SCSI Adapter\n",
+	aprint_normal(" slot %d irq %d drq %d: Adaptec AHA-1640 SCSI Adapter\n",
 		ma->ma_slot + 1,
 		apd.sc_irq, apd.sc_drq);

@@ -151,7 +151,7 @@
 		 ((ma->ma_pos[3] & 0x40) >> 4);

 	if (bus_space_map(iot, iobase, AHA_ISA_IOSIZE, 0, &ioh)) {
-		printf("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
+		aprint_error("%s: can't map i/o space\n", sc->sc_dev.dv_xname);
 		return;
 	}

@@ -166,7 +166,7 @@

 	sc->sc_ih = mca_intr_establish(mc, apd.sc_irq, IPL_BIO, aha_intr, sc);
 	if (sc->sc_ih == NULL) {
-		printf("%s: couldn't establish interrupt\n",
+		aprint_error("%s: couldn't establish interrupt\n",
 		    sc->sc_dev.dv_xname);
 		return;
 	}
Index: sys/dev/mca/com_mca.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mca/com_mca.c,v
retrieving revision 1.17
diff -u -r1.17 com_mca.c
--- sys/dev/mca/com_mca.c	16 Nov 2006 01:33:05 -0000	1.17
+++ sys/dev/mca/com_mca.c	25 Mar 2007 15:32:21 -0000
@@ -172,24 +172,24 @@
 		return;

 	if (bus_space_map(ma->ma_iot, iobase, COM_NPORTS, 0, &ioh)) {
-		printf(": can't map i/o space\n");
+		aprint_error(": can't map i/o space\n");
 		return;
 	}

 	COM_INIT_REGS(sc->sc_regs, ma->ma_iot, ioh, iobase);
 	sc->sc_frequency = COM_FREQ;

-	printf(" slot %d i/o %#x-%#x irq %d", ma->ma_slot + 1,
+	aprint_normal(" slot %d i/o %#x-%#x irq %d", ma->ma_slot + 1,
 		iobase, iobase + COM_NPORTS - 1, irq);

 	com_attach_subr(sc);

-	printf("%s: %s\n", sc->sc_dev.dv_xname, cpp->cp_name);
+	aprint_normal("%s: %s\n", sc->sc_dev.dv_xname, cpp->cp_name);

 	isc->sc_ih = mca_intr_establish(ma->ma_mc, irq, IPL_SERIAL,
 			comintr, sc);
 	if (isc->sc_ih == NULL) {
-                printf("%s: couldn't establish interrupt handler\n",
+                aprint_normal("%s: couldn't establish interrupt handler\n",
                     sc->sc_dev.dv_xname);
                 return;
         }
@@ -309,7 +309,7 @@
 	 */

 	if (pos2 & 0x10) {
-		printf(": not set to SERIAL mode, ignored\n");
+		aprint_verbose(": not set to SERIAL mode, ignored\n");
 		return (1);
 	}

Index: sys/dev/mca/ed_mca.c
===================================================================
RCS file: /cvsroot/src/sys/dev/mca/ed_mca.c,v
retrieving revision 1.35
diff -u -r1.35 ed_mca.c
--- sys/dev/mca/ed_mca.c	4 Mar 2007 06:02:14 -0000	1.35
+++ sys/dev/mca/ed_mca.c	25 Mar 2007 15:32:22 -0000
@@ -157,18 +157,18 @@
 	simple_lock_init(&ed->sc_q_lock);

 	if (ed_get_params(ed, &drv_flags)) {
-		printf(": IDENTIFY failed, no disk found\n");
+		aprint_error(": IDENTIFY failed, no disk found\n");
 		return;
 	}

 	format_bytes(pbuf, sizeof(pbuf),
 		(u_int64_t) ed->sc_capacity * DEV_BSIZE);
-	printf(": %s, %u cyl, %u head, %u sec, 512 bytes/sect x %u sectors\n",
+	aprint_verbose(": %s, %u cyl, %u head, %u sec, 512 bytes/sect x %u sectors\n",
 		pbuf,
 		ed->cyl, ed->heads, ed->sectors,
 		ed->sc_capacity);

-	printf("%s: %u spares/cyl, %s, %s, %s, %s, %s\n",
+	aprint_verbose("%s: %u spares/cyl, %s, %s, %s, %s, %s\n",
 		ed->sc_dev.dv_xname, ed->spares,
 		(drv_flags & (1 << 0)) ? "NoRetries" : "Retries",
 		(drv_flags & (1 << 1)) ? "Removable" : "Fixed",
@@ -468,7 +468,7 @@
 			edmcastrategy, lp, ed->sc_dk.dk_cpulabel);
 	}
 	if (errstring) {
-		printf("%s: %s\n", ed->sc_dev.dv_xname, errstring);
+		aprint_error("%s: %s\n", ed->sc_dev.dv_xname, errstring);
 		return;
 	}
 }