kern/100671: Make acpi_ibm.c debug output optional

Henrik Brix Andersen henrik at brixandersen.dk
Fri Jul 21 12:30:22 UTC 2006


>Number:         100671
>Category:       kern
>Synopsis:       Make acpi_ibm.c debug output optional
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 21 12:30:17 GMT 2006
>Closed-Date:
>Last-Modified:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list