Subject: kern/37501: cosmetic error in acpi_tz probe messages
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <paul@whooppee.com>
List: netbsd-bugs
Date: 12/08/2007 14:55:00
	Note: There was a bad value `' for the field `Class'.
	It was set to the default value of `sw-bug'.

>Number:         37501
>Category:       kern
>Synopsis:       cosmetic error in acpi_tz probe messages
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 08 14:55:00 +0000 2007
>Originator:     Paul Goyette
>Release:        NetBSD 4.99.40
>Organization:
>Environment:
System: NetBSD quicky.whooppee.com 4.99.40 NetBSD 4.99.40 (QUICKY (ASUS M2N32 WS) 2007-12-07 14:29:41 UTC) #11: Fri Dec 7 06:38:42 PST 2007 paul@quicky.whooppee.com:/usr/obj/objdir/amd64/sys/arch/amd64/compile/QUICKY amd64
Architecture: x86_64
Machine: amd64
>Description:
Probe messages for acpi_tz are malformed as in the following:
...
MEM (PNP0C01) at acpi0 not configured
FAN (PNP0C0B) at acpi0 not configured
acpitz0 at acpi0 (THRM)acpitz0: unable to get polling interval; using
default of 30.0s
: active cooling level 0: 73.0C critical 75.0C passive 40.0C
pcppi0: attached to attimer0
pci0 at mainbus0 bus 0: configuration mode 1
...

Note that the "unable to get" message is printed in the middle of the "active
cooling" message.
>How-To-Repeat:
Boot a machine with an acpi_tz device
>Fix:
Two possible patches have been proposed (one by myself, one by Jared McNeil).

My proposal:

Index: acpi_tz.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_tz.c,v
retrieving revision 1.30
diff -u -p -r1.30 acpi_tz.c
--- acpi_tz.c	5 Dec 2007 07:06:51 -0000	1.30
+++ acpi_tz.c	7 Dec 2007 19:34:55 -0000
@@ -170,14 +170,14 @@ acpitz_attach(struct device *parent, str
 
 	rv = acpi_eval_integer(sc->sc_devnode->ad_handle, "_TZP", &v);
 	if (ACPI_FAILURE(rv)) {
-		aprint_verbose("%s: unable to get polling interval; using default of",
-		    sc->sc_dev.dv_xname);
+		aprint_verbose(": unable to get polling interval; using default of");
 		sc->sc_zone.tzp = ATZ_TZP_RATE;
 	} else {
 		sc->sc_zone.tzp = v;
-		aprint_verbose("%s: polling interval is", sc->sc_dev.dv_xname);
+		aprint_verbose("polling interval is");
 	}
-	aprint_verbose(" %d.%ds\n", sc->sc_zone.tzp / 10, sc->sc_zone.tzp % 10);
+	aprint_verbose(" %d.%ds\n%s: ", sc->sc_zone.tzp / 10,
+	    sc->sc_zone.tzp % 10, sc->sc_dev.dv_xname);
 
 	/* XXX a value of 0 means "polling is not necessary" */
 	if (sc->sc_zone.tzp == 0)


Jared's proposal:

Index: acpi_tz.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/acpi_tz.c,v
retrieving revision 1.30
diff -u -p -r1.30 acpi_tz.c
--- acpi_tz.c	5 Dec 2007 07:06:51 -0000	1.30
+++ acpi_tz.c	7 Dec 2007 19:53:34 -0000
@@ -169,15 +169,13 @@ acpitz_attach(struct device *parent, str
 	aprint_naive("\n");
 
 	rv = acpi_eval_integer(sc->sc_devnode->ad_handle, "_TZP", &v);
-	if (ACPI_FAILURE(rv)) {
-		aprint_verbose("%s: unable to get polling interval; using default of",
-		    sc->sc_dev.dv_xname);
+	if (ACPI_FAILURE(rv))
 		sc->sc_zone.tzp = ATZ_TZP_RATE;
-	} else {
+	else
 		sc->sc_zone.tzp = v;
-		aprint_verbose("%s: polling interval is", sc->sc_dev.dv_xname);
-	}
-	aprint_verbose(" %d.%ds\n", sc->sc_zone.tzp / 10, sc->sc_zone.tzp % 10);
+
+	aprint_debug(" sample rate %d.%ds\n",
+	    sc->sc_zone.tzp / 10, sc->sc_zone.tzp % 10);
 
 	/* XXX a value of 0 means "polling is not necessary" */
 	if (sc->sc_zone.tzp == 0)