From owner-acpi-jp@jp.freebsd.org  Mon Jun  5 23:27:29 2000
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id XAA13672;
	Mon, 5 Jun 2000 23:27:29 +0900 (JST)
	(envelope-from owner-acpi-jp@jp.FreeBSD.org)
Received: from tasogare.imasy.or.jp (daemon@tasogare.imasy.or.jp [202.227.24.5])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id XAA13663
	for <acpi-jp@jp.freebsd.org>; Mon, 5 Jun 2000 23:27:27 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
Received: from localhost (isdn28.imasy.or.jp [202.227.24.220])
	by tasogare.imasy.or.jp (8.10.1+3.3W/3.7W-tasogare/smtpfeed 1.04) with ESMTP id e55ERNP81343
	for <acpi-jp@jp.freebsd.org>; Mon, 5 Jun 2000 23:27:23 +0900 (JST)
	(envelope-from iwasaki@jp.FreeBSD.org)
To: acpi-jp@jp.freebsd.org
X-Mailer: Mew version 1.94.1 on Emacs 19.34 / Mule 2.3 (SUETSUMUHANA)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20000605232722H.iwasaki@jp.FreeBSD.org>
Date: Mon, 05 Jun 2000 23:27:22 +0900
From: Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
X-Dispatcher: imput version 20000228(IM140)
Lines: 521
Reply-To: acpi-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: acpi-jp 377
Subject: [acpi-jp 377] style fix: aml_obj.[ch]
Errors-To: owner-acpi-jp@jp.freebsd.org
Sender: owner-acpi-jp@jp.freebsd.org
X-Originator: iwasaki@jp.freebsd.org

Index: aml_obj.c
===================================================================
RCS file: /home/cvs/ACPI/sys/i386/acpi/aml/aml_obj.c,v
retrieving revision 1.10
diff -u -r1.10 aml_obj.c
--- aml_obj.c	2000/06/03 14:32:57	1.10
+++ aml_obj.c	2000/06/04 10:55:42
@@ -27,7 +27,6 @@
  */
 
 #include <sys/param.h>
-#include <sys/types.h>
 
 #include <i386/acpi/aml/aml_amlmem.h>
 #include <i386/acpi/aml/aml_env.h>
@@ -37,46 +36,49 @@
 #include <i386/acpi/aml/aml_store.h>
 
 #ifndef _KERNEL
+#include <sys/stat.h>
+#include <sys/mman.h>
+
 #include <assert.h>
 #include <err.h>
 #include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#else
+#else /* _KERNEL */
 #include <sys/bus.h>
 #include <sys/systm.h>
-#endif
+#endif /* !_KERNEL */
 
-union aml_object * acpi_copy_object(struct aml_environ *env,union aml_object *orig)
+union aml_object *
+acpi_copy_object(struct aml_environ *env, union aml_object *orig)
 {
-	union aml_object *ret;
-	int i;
-	if(orig==NULL)
-		return NULL;
+	int	i;
+	union	aml_object *ret;
+
+	if (orig == NULL)
+		return (NULL);
 	switch (orig->type) {
 	case aml_t_regfield:
 		ret = acpi_alloc_object(aml_t_buffer, 0);
 		ret->buffer.size = (orig->regfield.bitlen / 8) +
-				   ((orig->regfield.bitlen % 8) ? 1 : 0);
+		    ((orig->regfield.bitlen % 8) ? 1 : 0);
 		ret->buffer.data = memman_alloc_flexsize(aml_memman, ret->buffer.size);
 		acpi_store_to_object(env, orig, ret);
 		break;
 
 	default:
-		ret = acpi_alloc_object(0,orig);
+		ret = acpi_alloc_object(0, orig);
 		break;
 	}
 
-	if(1 || orig!=&env->wobj) { /* XXX */
+	if (1 || orig != &env->wobj) {	/* XXX */
 		if (orig->type == aml_t_buffer) {
 			ret->buffer.data = memman_alloc_flexsize(aml_memman,
 			    orig->buffer.size);
 			bcopy(orig->buffer.data, ret->buffer.data, orig->buffer.size);
 		} else if (orig->type == aml_t_package) {
-			ret->package.objects = memman_alloc_flexsize(aml_memman,	
+			ret->package.objects = memman_alloc_flexsize(aml_memman,
 			    ret->package.elements * sizeof(union aml_object *));
 			for (i = 0; i < ret->package.elements; i++) {
 				ret->package.objects[i] = acpi_copy_object(env, orig->package.objects[i]);
@@ -84,25 +86,26 @@
 		} else if (orig->type == aml_t_string && orig->str.needfree != 0) {
 			ret->str.string = memman_alloc_flexsize(aml_memman,
 			    strlen(orig->str.string) + 1);
-			strcpy(orig->str.string, ret->str.string);	
+			strcpy(orig->str.string, ret->str.string);
 		}
-	}else{
-		printf ("%s:%d \n", __FILE__, __LINE__);
+	} else {
+		printf("%s:%d\n", __FILE__, __LINE__);
 		env->wobj.type = aml_t_null;
 	}
 	return ret;
 }
 
-
 /*
- * This function have two function:copy or allocate.if orig!=NULL, orig is
- * duplicated.
+ * This function have two function: copy or allocate.  if orig != NULL,
+ *  orig is duplicated.
  */
+
 union aml_object *
-acpi_alloc_object(enum aml_objtype type, union aml_object * orig)
+acpi_alloc_object(enum aml_objtype type, union aml_object *orig)
 {
-	unsigned int	memid;
-	union aml_object *ret;
+	unsigned	int memid;
+	union	aml_object *ret;
+
 	if (orig != NULL) {
 		type = orig->type;
 	}
@@ -155,17 +158,18 @@
 	}
 	ret = memman_alloc(aml_memman, memid);
 	ret->type = type;
-	
+
 	if (orig != NULL) {
 		bcopy(orig, ret, memman_memid2size(aml_memman, memid));
 	}
-	return ret;
+	return (ret);
 }
 
 void
-acpi_free_objectcontent(union aml_object * obj)
+acpi_free_objectcontent(union aml_object *obj)
 {
-	int             i;
+	int	i;
+
 	if (obj->type == aml_t_buffer && obj->buffer.data != NULL) {
 		memman_free_flexsize(aml_memman, obj->buffer.data);
 		obj->buffer.data = NULL;
@@ -181,14 +185,16 @@
 			acpi_free_object(&obj->package.objects[i]);
 		}
 		memman_free_flexsize(aml_memman, obj->package.objects);
-		obj->package.objects=NULL;
+		obj->package.objects = NULL;
 	}
-	return;
 }
+
 void
-acpi_free_object(union aml_object ** obj)
+acpi_free_object(union aml_object **obj)
 {
-	union aml_object *body = *obj;
+	union	aml_object *body;
+
+	body = *obj;
 	if (body == NULL) {
 		return;
 	}
@@ -198,12 +204,13 @@
 }
 
 void
-acpi_realloc_object(union aml_object * obj, int size)
+acpi_realloc_object(union aml_object *obj, int size)
 {
-	enum aml_objtype type = obj->type;
-	union aml_object tmp;
 	int	i;
+	enum	aml_objtype type;
+	union	aml_object tmp;
 
+	type = obj->type;
 	switch (type) {
 	case aml_t_buffer:
 		if (obj->buffer.size > size) {
@@ -216,7 +223,6 @@
 		acpi_free_objectcontent(obj);
 		*obj = tmp;
 		break;
-
 	case aml_t_string:
 		if (strlen(obj->str.string) > size) {
 			return;
@@ -230,7 +236,7 @@
 		if (obj->package.elements > size) {
 			return;
 		}
-		tmp.package.objects = memman_alloc_flexsize(aml_memman,	
+		tmp.package.objects = memman_alloc_flexsize(aml_memman,
 		    size * sizeof(union aml_object *));
 		bzero(tmp.package.objects, size * sizeof(union aml_object *));
 		for (i = 0; i < obj->package.elements; i++) {
@@ -243,4 +249,3 @@
 		break;
 	}
 }
-
Index: aml_obj.h
===================================================================
RCS file: /home/cvs/ACPI/sys/i386/acpi/aml/aml_obj.h,v
retrieving revision 1.10
diff -u -r1.10 aml_obj.h
--- aml_obj.h	2000/06/02 07:15:10	1.10
+++ aml_obj.h	2000/06/04 11:04:48
@@ -25,9 +25,10 @@
  *
  *	$Id: aml_obj.h,v 1.10 2000/06/02 07:15:10 yokoyama Exp $
  */
-#ifndef _OBJ_H_
-#define _OBJ_H_
 
+#ifndef _AML_OBJ_H_
+#define _AML_OBJ_H_
+
 #include <sys/queue.h>
 
 struct aml_environ;
@@ -52,157 +53,172 @@
 	aml_t_bufferfield,
 	aml_t_ddbhandle,
 	aml_t_debug
+};
+
+struct	aml_namestr {
+	enum	aml_objtype type;	/* =aml_t_namestr */
+	u_int8_t	*dp;
+};
+
+struct	aml_opregion {
+	enum	aml_objtype type;
+	int	space;
+	int	offset;
+	int	length;
+};
+
+struct	aml_num {
+	enum	aml_objtype type;	/* =aml_t_num */
+	int	number;
+};
+
+struct	aml_package {
+	enum	aml_objtype type;
+	int	elements;
+	union	aml_object **objects;
 };
-struct aml_namestr {
-	enum aml_objtype type;	/* =aml_t_namestr */
-	u_int8_t       *dp;
-};
-struct aml_opregion {
-	enum aml_objtype type;
-	int             space;
-	int             offset;
-	int             length;
-};
-struct aml_num {
-	enum aml_objtype type;	/* =aml_t_num */
-	int             number;
-};
-struct aml_package {
-	enum aml_objtype type;
-	int             elements;
-	union aml_object **objects;
-};
-struct aml_string {
-	enum aml_objtype type;	/* =aml_t_string */
-	int             needfree;
-	u_int8_t       *string;
-};
-
-struct aml_buffer {
-	enum aml_objtype type;	/* =aml_t_buffer */
-	int             size;
-	u_int8_t       *data;	/* This should be freed when this object is
-				 * freed */
+
+struct	aml_string {
+	enum	aml_objtype type;	/* =aml_t_string */
+	int	needfree;
+	u_int8_t	*string;
+};
+
+struct	aml_buffer {
+	enum	aml_objtype type;	/* =aml_t_buffer */
+	int	size;
+	u_int8_t	*data;		/* This should be free when 
+					 * this object is free.
+					 */
 };
-enum fieldtype {
+
+enum	fieldtype {
 	f_t_field,
 	f_t_index,
 	f_t_bank
+};
+
+struct	nfieldd {
+	enum	fieldtype ftype;	/* f_t_field */
+	u_int8_t	*regname;	/* Namestring */
+};
+
+struct	ifieldd {
+	enum	fieldtype ftype;	/* f_t_index */
+	u_int8_t	*indexname;
+	u_int8_t	*dataname;
+};
+
+struct	bfieldd {
+	enum	fieldtype ftype;	/* f_t_bank */
+	u_int8_t	*regname;
+	u_int8_t	*bankname;
+	u_int32_t	bankvalue;
 };
-struct nfieldd {
-	enum fieldtype  ftype;	/* f_t_field */
-	u_int8_t       *regname;/* Namestring */
-};
-struct ifieldd {
-	enum fieldtype  ftype;	/* f_t_index */
-	u_int8_t       *indexname;
-	u_int8_t       *dataname;
-};
-struct bfieldd {
-	enum fieldtype  ftype;	/* f_t_bank */
-	u_int8_t       *regname;
-	u_int8_t       *bankname;
-	u_int32_t       bankvalue;
-};
-
-struct aml_field {
-	enum aml_objtype type;
-	u_int32_t       flags;
-	int             bitoffset;	/* Not Byte offset but bitoffset */
-	int             bitlen;
+
+struct	aml_field {
+	enum	aml_objtype type;
+	u_int32_t	flags;
+	int	bitoffset;		/* Not Byte offset but bitoffset */
+	int	bitlen;
 	union {
-		enum fieldtype             ftype;
-		struct nfieldd  fld;
-		struct ifieldd  ifld;
-		struct bfieldd  bfld;
-	}               f;
-};
-struct aml_bufferfield {
-	enum aml_objtype type;	/* aml_t_bufferfield */
-	int             bitoffset;
-	int             bitlen;
-	u_int8_t       *origin;	/* This should not be free when this object
-				 * is freed (Within Buffer object) */
-};
-struct aml_method {
-	enum aml_objtype type;
-	int             argnum;	/* Not argnum but argnum|frag */
-	u_int8_t       *from;
-	u_int8_t       *to;
+		enum	fieldtype ftype;
+		struct	nfieldd fld;
+		struct	ifieldd ifld;
+		struct	bfieldd bfld;
+	}     f;
+};
+
+struct	aml_bufferfield {
+	enum	aml_objtype type;	/* aml_t_bufferfield */
+	int	bitoffset;
+	int	bitlen;
+	u_int8_t	*origin;	/* This should not be free
+					 * when this object is free
+					 * (Within Buffer object)
+					 */
+};
+
+struct	aml_method {
+	enum	aml_objtype type;
+	int	argnum;		/* Not argnum but argnum|frag */
+	u_int8_t	*from;
+	u_int8_t	*to;
 };
+
 struct aml_powerres {
-	enum aml_objtype type;
-	int             level;
-	int             order;
+	enum	aml_objtype type;
+	int	level;
+	int	order;
 };
-struct aml_processor {
-	enum aml_objtype type;
-	int             id;
-	int             addr;
-	int             len;
+
+struct	aml_processor {
+	enum	aml_objtype type;
+	int	id;
+	int	addr;
+	int	len;
 };
 
-struct aml_mutex_queue {
-        STAILQ_ENTRY(aml_mutex_queue) entry;
+struct	aml_mutex_queue {
+	STAILQ_ENTRY(aml_mutex_queue) entry;
 };
 
-struct aml_mutex {
-	enum aml_objtype type;
-	int             level;
-	volatile void	*cookie;	/* In kernel, struct proc? */  
-	STAILQ_HEAD(, aml_mutex_queue)	queue;
+struct	aml_mutex {
+	enum	aml_objtype type;
+	int	level;
+	volatile	void *cookie;	/* In kernel, struct proc? */
+	STAILQ_HEAD(, aml_mutex_queue) queue;
 };
 
-struct aml_objref {
-	enum aml_objtype type;
-	struct aml_name *nameref;
-	union aml_object *ref;
-	int             offset;	/* of aml_buffer.data or aml_package.objects. */
+struct	aml_objref {
+	enum	aml_objtype type;
+	struct	aml_name *nameref;
+	union	aml_object *ref;
+	int	offset;		/* of aml_buffer.data or aml_package.objects. */
 	/* if negative value, not ready to dereference for element access. */
 	unsigned	deref;	/* indicates whether dereffenced or not */
 	unsigned	alias;	/* true if this is an alias object reference */
 };
 
-struct aml_regfield {
-	enum aml_objtype type;
-	int		space;
+struct	aml_regfield {
+	enum	aml_objtype type;
+	int	space;
 	u_int32_t	flags;
-	int		offset;
-	int		bitoffset;
-	int		bitlen;
-};
-
-struct aml_event {
-	enum aml_objtype type;	/* aml_t_event */
-	int inuse;
-};
-
-union aml_object {
-	enum aml_objtype type;
-	struct aml_num  num;
-	struct aml_processor proc;
-	struct aml_powerres pres;
-	struct aml_opregion opregion;
-	struct aml_method meth;
-	struct aml_field field;
-	struct aml_mutex mutex;
-	struct aml_namestr nstr;
-	struct aml_buffer buffer;
-	struct aml_bufferfield bfld;
-	struct aml_package package;
-	struct aml_string str;
-	struct aml_objref objref;
-	struct aml_event event;
-	struct aml_regfield regfield;
-};
-
-union aml_object * acpi_copy_object(struct aml_environ *,union aml_object *);
-union aml_object * acpi_alloc_object(enum aml_objtype, union aml_object *);
-void acpi_free_objectcontent(union aml_object *);
-void
-acpi_free_object(union aml_object **);
-void acpi_realloc_object(union aml_object *, int);
-void acpi_register_temporary_object(struct aml_environ *,union aml_object *);
-
-#endif
+	int	offset;
+	int	bitoffset;
+	int	bitlen;
+};
+
+struct	aml_event {
+	enum	aml_objtype type;	/* aml_t_event */
+	int	inuse;
+};
+
+union	aml_object {
+	enum	aml_objtype type;
+	struct	aml_num num;
+	struct	aml_processor proc;
+	struct	aml_powerres pres;
+	struct	aml_opregion opregion;
+	struct	aml_method meth;
+	struct	aml_field field;
+	struct	aml_mutex mutex;
+	struct	aml_namestr nstr;
+	struct	aml_buffer buffer;
+	struct	aml_bufferfield bfld;
+	struct	aml_package package;
+	struct	aml_string str;
+	struct	aml_objref objref;
+	struct	aml_event event;
+	struct	aml_regfield regfield;
+};
+
+union aml_object	*acpi_copy_object(struct aml_environ *,
+					  union aml_object *);
+union aml_object	*acpi_alloc_object(enum aml_objtype,
+					   union aml_object *);
+void			 acpi_free_objectcontent(union aml_object *);
+void			 acpi_free_object(union aml_object **);
+void			 acpi_realloc_object(union aml_object *, int);
 
+#endif /* !_AML_OBJ_H_ */
