From brix@fangorn.brixandersen.dk  Fri Jul 21 12:25:09 2006
Return-Path: <brix@fangorn.brixandersen.dk>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 743B516A4DE
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 Jul 2006 12:25:09 +0000 (UTC)
	(envelope-from brix@fangorn.brixandersen.dk)
Received: from ns2.pil.dk (ns2.pil.dk [195.41.47.38])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EAF9143D58
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 Jul 2006 12:25:08 +0000 (GMT)
	(envelope-from brix@fangorn.brixandersen.dk)
Received: from fangorn.brixandersen.dk (fw2.pil.dk [83.90.227.58])
	by ns2.pil.dk (Postfix) with ESMTP id B6FD37BA0BB
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 Jul 2006 14:25:07 +0200 (CEST)
Received: from fangorn.brixandersen.dk (localhost [127.0.0.1])
	by fangorn.brixandersen.dk (Postfix) with ESMTP id 2B8312E037
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 21 Jul 2006 14:25:07 +0200 (CEST)
Received: (from brix@localhost)
	by fangorn.brixandersen.dk (8.13.6/8.13.6/Submit) id k6LCP6Jc000893;
	Fri, 21 Jul 2006 14:25:06 +0200 (CEST)
	(envelope-from brix)
Message-Id: <200607211225.k6LCP6Jc000893@fangorn.brixandersen.dk>
Date: Fri, 21 Jul 2006 14:25:06 +0200 (CEST)
From: Henrik Brix Andersen <henrik@brixandersen.dk>
Reply-To: Henrik Brix Andersen <henrik@brixandersen.dk>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Make acpi_ibm.c debug output optional 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         100671
>Category:       kern
>Synopsis:       Make acpi_ibm.c debug output optional
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    takawata
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 21 12:30:17 GMT 2006
>Closed-Date:    Mon Aug 14 18:40:18 GMT 2006
>Last-Modified:  Mon Aug 14 18:40:18 GMT 2006
>Originator:     Henrik Brix Andersen
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
pil.dk 
>Environment:
System: FreeBSD fangorn.brixandersen.dk 6.1-STABLE FreeBSD 6.1-STABLE #3: Fri Jul 21 11:57:45 CEST 2006 root@fangorn.brixandersen.dk:/usr/obj/usr/src/sys/GENERIC i386


	
>Description:
The sys/dev/acpi_support/acpi_ibm.c driver
currently (unconditionally) prints two lines to the system log
whenever a key (volume, brihtness, ...)  is pressed. This
clutters up the system log and the same information can
easily be obtained through the use of devd(8).

The below patch addresses this issue by introducing an
ACPI_IBM_DEBUG define similar to how it is handled in
acpi_panasonic.c. The patch also converts the driver from using
printf() to using device_printf().

	
>How-To-Repeat:
# kldload acpi_ibm # requires an IBM ThinkPad laptop

Watch dmesg as you press volume, Access IBM, brightness or other
Fn+Fx key combinations.
	
>Fix:

	
Proposed patch:

--- acpi_ibm.c.patch begins here ---
--- acpi_ibm.c.orig	Fri Jul 21 13:47:22 2006
+++ acpi_ibm.c	Fri Jul 21 14:03:12 2006
@@ -53,6 +53,9 @@ __FBSDID("$FreeBSD: src/sys/dev/acpi_sup
 #define _COMPONENT	ACPI_OEM
 ACPI_MODULE_NAME("IBM")
 
+/* Debug */
+#undef	ACPI_IBM_DEBUG
+
 /* Internal methods */
 #define ACPI_IBM_METHOD_EVENTS		1
 #define ACPI_IBM_METHOD_EVENTMASK	2
@@ -867,9 +870,11 @@ acpi_ibm_notify(ACPI_HANDLE h, UINT32 no
 
 	ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify);
 
-	printf("IBM:NOTIFY:%x\n", notify);
+#ifdef ACPI_IBM_DEBUG
+	device_printf(dev, "IBM:NOTIFY:%x\n", notify);
+#endif
 	if (notify != 0x80)
-		printf("Unknown notify\n");
+		device_printf(dev, "Unknown notify\n");
 
 	for (;;) {
 		acpi_GetInteger(acpi_get_handle(dev), IBM_NAME_EVENTS_GET, &event);
@@ -877,14 +882,15 @@ acpi_ibm_notify(ACPI_HANDLE h, UINT32 no
 		if (event == 0)
 			break;
 
-		printf("notify:%x\n", event);
-
+#ifdef ACPI_IBM_DEBUG
+		device_printf(dev, "notify:%x\n", event);
+#endif
 		type = (event >> 12) & 0xf;
 		arg = event & 0xfff;
 		switch (type) {
 		case 1:
 			if (!(sc->events_availmask & (1 << (arg - 1)))) {
-				printf("Unknown key %d\n", arg);
+				device_printf(dev, "Unknown key %d\n", arg);
 				break;
 			}
 
--- acpi_ibm.c.patch ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->acpi 
Responsible-Changed-By: erwin 
Responsible-Changed-When: Mon Jul 31 11:43:22 UTC 2006 
Responsible-Changed-Why:  
acpi@ might want to have a look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100671 
Responsible-Changed-From-To: acpi->freebsd-acpi 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Mon Aug 14 12:39:32 UTC 2006 
Responsible-Changed-Why:  
Correct owner. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100671 
Responsible-Changed-From-To: freebsd-acpi->takawata 
Responsible-Changed-By: takawata 
Responsible-Changed-When: Mon Aug 14 18:21:08 UTC 2006 
Responsible-Changed-Why:  
I'll handle this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100671 
State-Changed-From-To: open->closed 
State-Changed-By: takawata 
State-Changed-When: Mon Aug 14 18:39:11 UTC 2006 
State-Changed-Why:  
Good point. Committed thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=100671 
>Unformatted:
