From dan@obluda.cz  Sun Sep 12 17:37:34 2004
Return-Path: <dan@obluda.cz>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E2F0D16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:37:33 +0000 (GMT)
Received: from kulesh.obluda.cz (kulesh.obluda.cz [193.179.22.243])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 685F643D2D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 17:37:32 +0000 (GMT)
	(envelope-from dan@obluda.cz)
Received: from kulesh.obluda.cz (localhost.eunet.cz [127.0.0.1])
	by kulesh.obluda.cz (8.13.1/8.13.1) with ESMTP id i8CHb5f7010926
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 12 Sep 2004 19:37:11 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Received: (from root@localhost)
	by kulesh.obluda.cz (8.13.1/8.13.1/Submit) id i8CHb5hR010925
	for FreeBSD-gnats-submit@freebsd.org; Sun, 12 Sep 2004 19:37:05 +0200 (CEST)
	(envelope-from dan@obluda.cz)
Message-Id: <200409121737.i8CHb5hR010925@kulesh.obluda.cz>
Date: Sun, 12 Sep 2004 19:37:05 +0200 (CEST)
From: Dan Lukes <dan@obluda.cz>
Reply-To: Dan Lukes <dan@obluda.cz>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] cleanup of the usr.sbin/acpi code

>Number:         71672
>Category:       bin
>Synopsis:       [PATCH] cleanup of the usr.sbin/acpi code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    philip
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 12 17:40:28 GMT 2004
>Closed-Date:    Sat Nov 13 01:37:16 GMT 2004
>Last-Modified:  Sat Nov 13 01:37:16 GMT 2004
>Originator:     Dan Lukes
>Release:        FreeBSD 5.3-BETA3 i386
>Organization:
Obludarium
>Environment:
System: FreeBSD 5.3-BETA3 #8: Sun Sep 5 07:06:40 CEST 2004 i386
usr.sbin/acpi/acpidb/acpidb.c,v 1.1 2003/08/07 16:51:50 njl

>Description:
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/acpi/acpidb/acpidb.c:162: warning: unsigned int format, different type arg (arg 2)
usr.sbin/acpi/acpidb/acpidb.c:163: warning: unsigned int format, different type arg (arg 2)
usr.sbin/acpi/acpidb/acpidb.c:242: warning: unsigned int format, different type arg (arg 4)
usr.sbin/acpi/acpidb/acpidb.c:286: warning: unsigned int format, different type arg (arg 5)
usr.sbin/acpi/acpidb/acpidb.c:300: warning: unsigned int format, different type arg (arg 5)
usr.sbin/acpi/acpidb/acpidb.c:350: warning: unused variable `amlptr'
usr.sbin/acpi/acpidb/acpidb.c:354: warning: unused variable `tableptr'

>How-To-Repeat:
	N/A
>Fix:
*** usr.sbin/acpi/acpidb/acpidb.c.ORIG	Thu Aug  7 18:51:50 2003
--- usr.sbin/acpi/acpidb/acpidb.c	Sun Sep 12 18:43:38 2004
***************
*** 159,166 ****
  	if (msg != NULL) {
  		printf("%s", msg);
  	}
! 	printf("(default: 0x%x ", val);
! 	printf(" / %u) >>", val);
  	fflush(stdout);
  
  	bzero(buf, sizeof buf);
--- 159,166 ----
  	if (msg != NULL) {
  		printf("%s", msg);
  	}
! 	printf("(default: 0x%lx ", (unsigned long)val);
! 	printf(" / %lu) >>", (unsigned long)val);
  	fflush(stdout);
  
  	bzero(buf, sizeof buf);
***************
*** 238,245 ****
  	}
  	while (!TAILQ_EMPTY(&RegionContentList)) {
  		rc = TAILQ_FIRST(&RegionContentList);
! 		fprintf(fp, "%d	0x%x	0x%x\n",
! 		    rc->regtype, rc->addr, rc->value);
  		TAILQ_REMOVE(&RegionContentList, rc, links);
  		free(rc);
  	}
--- 238,245 ----
  	}
  	while (!TAILQ_EMPTY(&RegionContentList)) {
  		rc = TAILQ_FIRST(&RegionContentList);
! 		fprintf(fp, "%d	0x%lx	0x%x\n",
! 		    rc->regtype, (unsigned long)rc->addr, rc->value);
  		TAILQ_REMOVE(&RegionContentList, rc, links);
  		free(rc);
  	}
***************
*** 282,289 ****
  		}
  		*Value = value;
  		if (Prompt) {
! 			sprintf(msg, "[read (%s, %2d, 0x%x)]",
! 				space_names[SpaceID], BitWidth, Address);
  			*Value = aml_simulate_prompt(msg, value);
  			if (*Value != value) {
  				return(aml_vm_space_handler(SpaceID,
--- 282,289 ----
  		}
  		*Value = value;
  		if (Prompt) {
! 			sprintf(msg, "[read (%s, %2d, 0x%lx)]",
! 				space_names[SpaceID], BitWidth, (unsigned long)Address);
  			*Value = aml_simulate_prompt(msg, value);
  			if (*Value != value) {
  				return(aml_vm_space_handler(SpaceID,
***************
*** 296,303 ****
  	case ACPI_WRITE:
  		value = *Value;
  		if (Prompt) {
! 			sprintf(msg, "[write(%s, %2d, 0x%x)]",
! 				space_names[SpaceID], BitWidth, Address);
  			value = aml_simulate_prompt(msg, *Value);
  		}
  		*Value = value;
--- 296,303 ----
  	case ACPI_WRITE:
  		value = *Value;
  		if (Prompt) {
! 			sprintf(msg, "[write(%s, %2d, 0x%lx)]",
! 				space_names[SpaceID], BitWidth, (unsigned long)Address);
  			value = aml_simulate_prompt(msg, *Value);
  		}
  		*Value = value;
***************
*** 347,357 ****
  load_dsdt(const char *dsdtfile)
  {
  	char			filetmp[PATH_MAX];
! 	u_int8_t		*code, *amlptr;
  	struct stat		 sb;
  	int			 fd, fd2;
  	int			 error;
- 	ACPI_TABLE_HEADER	*tableptr;
  
  	fd = open(dsdtfile, O_RDONLY, 0);
  	if (fd == -1) {
--- 347,356 ----
  load_dsdt(const char *dsdtfile)
  {
  	char			filetmp[PATH_MAX];
! 	u_int8_t		*code;
  	struct stat		 sb;
  	int			 fd, fd2;
  	int			 error;
  
  	fd = open(dsdtfile, O_RDONLY, 0);
  	if (fd == -1) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: philip 
State-Changed-When: Sat Nov 13 01:35:37 GMT 2004 
State-Changed-Why:  
I just committed a more complete cleanup, inspired by this 
patch.  Thanks! 


Responsible-Changed-From-To: freebsd-bugs->philip 
Responsible-Changed-By: philip 
Responsible-Changed-When: Sat Nov 13 01:35:37 GMT 2004 
Responsible-Changed-Why:  
I just committed a more complete cleanup, inspired by this 
patch.  Thanks! 

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