diff --git a/drivers/acpi/executer/exmisc.c b/drivers/acpi/executer/exmisc.c
index 237ef28..a3f4d72 100644
--- a/drivers/acpi/executer/exmisc.c
+++ b/drivers/acpi/executer/exmisc.c
@@ -42,15 +42,12 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
-
 #include <acpi/acpi.h>
 #include <acpi/acinterp.h>
 #include <acpi/amlcode.h>
 
-
 #define _COMPONENT          ACPI_EXECUTER
-	 ACPI_MODULE_NAME    ("exmisc")
-
+ACPI_MODULE_NAME("exmisc")
 
 /*******************************************************************************
  *
@@ -66,27 +63,23 @@
  *              Common code for the ref_of_op and the cond_ref_of_op.
  *
  ******************************************************************************/
-
 acpi_status
-acpi_ex_get_object_reference (
-	union acpi_operand_object       *obj_desc,
-	union acpi_operand_object       **return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_get_object_reference(union acpi_operand_object *obj_desc,
+			     union acpi_operand_object **return_desc,
+			     struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *reference_obj;
-	union acpi_operand_object       *referenced_obj;
+	union acpi_operand_object *reference_obj;
+	union acpi_operand_object *referenced_obj;
 
-
-	ACPI_FUNCTION_TRACE_PTR ("ex_get_object_reference", obj_desc);
-
+	ACPI_FUNCTION_TRACE_PTR("ex_get_object_reference", obj_desc);
 
 	*return_desc = NULL;
 
-	switch (ACPI_GET_DESCRIPTOR_TYPE (obj_desc)) {
+	switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
 	case ACPI_DESC_TYPE_OPERAND:
 
-		if (ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
-			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_LOCAL_REFERENCE) {
+			return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 		}
 
 		/*
@@ -104,13 +97,11 @@
 
 		default:
 
-			ACPI_REPORT_ERROR (("Unknown Reference opcode in get_reference %X\n",
-				obj_desc->reference.opcode));
-			return_ACPI_STATUS (AE_AML_INTERNAL);
+			ACPI_REPORT_ERROR(("Unknown Reference opcode in get_reference %X\n", obj_desc->reference.opcode));
+			return_ACPI_STATUS(AE_AML_INTERNAL);
 		}
 		break;
 
-
 	case ACPI_DESC_TYPE_NAMED:
 
 		/*
@@ -119,34 +110,32 @@
 		referenced_obj = obj_desc;
 		break;
 
-
 	default:
 
-		ACPI_REPORT_ERROR (("Invalid descriptor type in get_reference: %X\n",
-				ACPI_GET_DESCRIPTOR_TYPE (obj_desc)));
-		return_ACPI_STATUS (AE_TYPE);
+		ACPI_REPORT_ERROR(("Invalid descriptor type in get_reference: %X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_desc)));
+		return_ACPI_STATUS(AE_TYPE);
 	}
 
-
 	/* Create a new reference object */
 
-	reference_obj = acpi_ut_create_internal_object (ACPI_TYPE_LOCAL_REFERENCE);
+	reference_obj =
+	    acpi_ut_create_internal_object(ACPI_TYPE_LOCAL_REFERENCE);
 	if (!reference_obj) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	reference_obj->reference.opcode = AML_REF_OF_OP;
 	reference_obj->reference.object = referenced_obj;
 	*return_desc = reference_obj;
 
-	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
-		"Object %p Type [%s], returning Reference %p\n",
-		obj_desc, acpi_ut_get_object_type_name (obj_desc), *return_desc));
+	ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
+			  "Object %p Type [%s], returning Reference %p\n",
+			  obj_desc, acpi_ut_get_object_type_name(obj_desc),
+			  *return_desc));
 
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_concat_template
@@ -163,63 +152,58 @@
  ******************************************************************************/
 
 acpi_status
-acpi_ex_concat_template (
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	union acpi_operand_object       **actual_return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_concat_template(union acpi_operand_object *operand0,
+			union acpi_operand_object *operand1,
+			union acpi_operand_object **actual_return_desc,
+			struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *return_desc;
-	u8                              *new_buf;
-	u8                              *end_tag1;
-	u8                              *end_tag2;
-	acpi_size                       length1;
-	acpi_size                       length2;
+	union acpi_operand_object *return_desc;
+	u8 *new_buf;
+	u8 *end_tag1;
+	u8 *end_tag2;
+	acpi_size length1;
+	acpi_size length2;
 
-
-	ACPI_FUNCTION_TRACE ("ex_concat_template");
-
+	ACPI_FUNCTION_TRACE("ex_concat_template");
 
 	/* Find the end_tags in each resource template */
 
-	end_tag1 = acpi_ut_get_resource_end_tag (operand0);
-	end_tag2 = acpi_ut_get_resource_end_tag (operand1);
+	end_tag1 = acpi_ut_get_resource_end_tag(operand0);
+	end_tag2 = acpi_ut_get_resource_end_tag(operand1);
 	if (!end_tag1 || !end_tag2) {
-		return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+		return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
 	}
 
 	/* Compute the length of each part */
 
-	length1 = ACPI_PTR_DIFF (end_tag1, operand0->buffer.pointer);
-	length2 = ACPI_PTR_DIFF (end_tag2, operand1->buffer.pointer) +
-			  2; /* Size of END_TAG */
+	length1 = ACPI_PTR_DIFF(end_tag1, operand0->buffer.pointer);
+	length2 = ACPI_PTR_DIFF(end_tag2, operand1->buffer.pointer) + 2;	/* Size of END_TAG */
 
 	/* Create a new buffer object for the result */
 
-	return_desc = acpi_ut_create_buffer_object (length1 + length2);
+	return_desc = acpi_ut_create_buffer_object(length1 + length2);
 	if (!return_desc) {
-		return_ACPI_STATUS (AE_NO_MEMORY);
+		return_ACPI_STATUS(AE_NO_MEMORY);
 	}
 
 	/* Copy the templates to the new descriptor */
 
 	new_buf = return_desc->buffer.pointer;
-	ACPI_MEMCPY (new_buf, operand0->buffer.pointer, length1);
-	ACPI_MEMCPY (new_buf + length1, operand1->buffer.pointer, length2);
+	ACPI_MEMCPY(new_buf, operand0->buffer.pointer, length1);
+	ACPI_MEMCPY(new_buf + length1, operand1->buffer.pointer, length2);
 
 	/* Compute the new checksum */
 
 	new_buf[return_desc->buffer.length - 1] =
-			acpi_ut_generate_checksum (return_desc->buffer.pointer,
-					   (return_desc->buffer.length - 1));
+	    acpi_ut_generate_checksum(return_desc->buffer.pointer,
+				      (return_desc->buffer.length - 1));
 
 	/* Return the completed template descriptor */
 
 	*actual_return_desc = return_desc;
-	return_ACPI_STATUS (AE_OK);
+	return_ACPI_STATUS(AE_OK);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_concatenate
@@ -236,21 +220,18 @@
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_concatenate (
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	union acpi_operand_object       **actual_return_desc,
-	struct acpi_walk_state          *walk_state)
+acpi_ex_do_concatenate(union acpi_operand_object *operand0,
+		       union acpi_operand_object *operand1,
+		       union acpi_operand_object **actual_return_desc,
+		       struct acpi_walk_state *walk_state)
 {
-	union acpi_operand_object       *local_operand1 = operand1;
-	union acpi_operand_object       *return_desc;
-	char                            *new_buf;
-	acpi_status                     status;
-	acpi_size                       new_length;
+	union acpi_operand_object *local_operand1 = operand1;
+	union acpi_operand_object *return_desc;
+	char *new_buf;
+	acpi_status status;
+	acpi_size new_length;
 
-
-	ACPI_FUNCTION_TRACE ("ex_do_concatenate");
-
+	ACPI_FUNCTION_TRACE("ex_do_concatenate");
 
 	/*
 	 * Convert the second operand if necessary.  The first operand
@@ -259,27 +240,28 @@
 	 * guaranteed to be either Integer/String/Buffer by the operand
 	 * resolution mechanism.
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
-		status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+		status =
+		    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
 		break;
 
 	case ACPI_TYPE_STRING:
-		status = acpi_ex_convert_to_string (operand1, &local_operand1,
-				 ACPI_IMPLICIT_CONVERT_HEX);
+		status = acpi_ex_convert_to_string(operand1, &local_operand1,
+						   ACPI_IMPLICIT_CONVERT_HEX);
 		break;
 
 	case ACPI_TYPE_BUFFER:
-		status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+		status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
 		break;
 
 	default:
-		ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
-				ACPI_GET_OBJECT_TYPE (operand0)));
+		ACPI_REPORT_ERROR(("Concat - invalid obj type: %X\n",
+				   ACPI_GET_OBJECT_TYPE(operand0)));
 		status = AE_AML_INTERNAL;
 	}
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
@@ -296,32 +278,33 @@
 	 * 2) Two Strings concatenated to produce a new String
 	 * 3) Two Buffers concatenated to produce a new Buffer
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
 
 		/* Result of two Integers is a Buffer */
 		/* Need enough buffer space for two integers */
 
-		return_desc = acpi_ut_create_buffer_object ((acpi_size)
-				   ACPI_MUL_2 (acpi_gbl_integer_byte_width));
+		return_desc = acpi_ut_create_buffer_object((acpi_size)
+							   ACPI_MUL_2
+							   (acpi_gbl_integer_byte_width));
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		new_buf = (char *) return_desc->buffer.pointer;
+		new_buf = (char *)return_desc->buffer.pointer;
 
 		/* Copy the first integer, LSB first */
 
-		ACPI_MEMCPY (new_buf,
-				  &operand0->integer.value,
-				  acpi_gbl_integer_byte_width);
+		ACPI_MEMCPY(new_buf,
+			    &operand0->integer.value,
+			    acpi_gbl_integer_byte_width);
 
 		/* Copy the second integer (LSB first) after the first */
 
-		ACPI_MEMCPY (new_buf + acpi_gbl_integer_byte_width,
-				  &local_operand1->integer.value,
-				  acpi_gbl_integer_byte_width);
+		ACPI_MEMCPY(new_buf + acpi_gbl_integer_byte_width,
+			    &local_operand1->integer.value,
+			    acpi_gbl_integer_byte_width);
 		break;
 
 	case ACPI_TYPE_STRING:
@@ -329,13 +312,13 @@
 		/* Result of two Strings is a String */
 
 		new_length = (acpi_size) operand0->string.length +
-				 (acpi_size) local_operand1->string.length;
+		    (acpi_size) local_operand1->string.length;
 		if (new_length > ACPI_MAX_STRING_CONVERSION) {
 			status = AE_AML_STRING_LIMIT;
 			goto cleanup;
 		}
 
-		return_desc = acpi_ut_create_string_object (new_length);
+		return_desc = acpi_ut_create_string_object(new_length);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
@@ -345,56 +328,56 @@
 
 		/* Concatenate the strings */
 
-		ACPI_STRCPY (new_buf,
-				  operand0->string.pointer);
-		ACPI_STRCPY (new_buf + operand0->string.length,
-				  local_operand1->string.pointer);
+		ACPI_STRCPY(new_buf, operand0->string.pointer);
+		ACPI_STRCPY(new_buf + operand0->string.length,
+			    local_operand1->string.pointer);
 		break;
 
 	case ACPI_TYPE_BUFFER:
 
 		/* Result of two Buffers is a Buffer */
 
-		return_desc = acpi_ut_create_buffer_object (
-				   (acpi_size) operand0->buffer.length +
-				   (acpi_size) local_operand1->buffer.length);
+		return_desc = acpi_ut_create_buffer_object((acpi_size)
+							   operand0->buffer.
+							   length +
+							   (acpi_size)
+							   local_operand1->
+							   buffer.length);
 		if (!return_desc) {
 			status = AE_NO_MEMORY;
 			goto cleanup;
 		}
 
-		new_buf = (char *) return_desc->buffer.pointer;
+		new_buf = (char *)return_desc->buffer.pointer;
 
 		/* Concatenate the buffers */
 
-		ACPI_MEMCPY (new_buf,
-				  operand0->buffer.pointer,
-				  operand0->buffer.length);
-		ACPI_MEMCPY (new_buf + operand0->buffer.length,
-				  local_operand1->buffer.pointer,
-				  local_operand1->buffer.length);
+		ACPI_MEMCPY(new_buf,
+			    operand0->buffer.pointer, operand0->buffer.length);
+		ACPI_MEMCPY(new_buf + operand0->buffer.length,
+			    local_operand1->buffer.pointer,
+			    local_operand1->buffer.length);
 		break;
 
 	default:
 
 		/* Invalid object type, should not happen here */
 
-		ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
-				ACPI_GET_OBJECT_TYPE (operand0)));
-		status =AE_AML_INTERNAL;
+		ACPI_REPORT_ERROR(("Concatenate - Invalid object type: %X\n",
+				   ACPI_GET_OBJECT_TYPE(operand0)));
+		status = AE_AML_INTERNAL;
 		goto cleanup;
 	}
 
 	*actual_return_desc = return_desc;
 
-cleanup:
+      cleanup:
 	if (local_operand1 != operand1) {
-		acpi_ut_remove_reference (local_operand1);
+		acpi_ut_remove_reference(local_operand1);
 	}
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_math_op
@@ -412,62 +395,49 @@
  ******************************************************************************/
 
 acpi_integer
-acpi_ex_do_math_op (
-	u16                             opcode,
-	acpi_integer                    integer0,
-	acpi_integer                    integer1)
+acpi_ex_do_math_op(u16 opcode, acpi_integer integer0, acpi_integer integer1)
 {
 
-	ACPI_FUNCTION_ENTRY ();
-
+	ACPI_FUNCTION_ENTRY();
 
 	switch (opcode) {
-	case AML_ADD_OP:                /* Add (Integer0, Integer1, Result) */
+	case AML_ADD_OP:	/* Add (Integer0, Integer1, Result) */
 
 		return (integer0 + integer1);
 
-
-	case AML_BIT_AND_OP:            /* And (Integer0, Integer1, Result) */
+	case AML_BIT_AND_OP:	/* And (Integer0, Integer1, Result) */
 
 		return (integer0 & integer1);
 
-
-	case AML_BIT_NAND_OP:           /* NAnd (Integer0, Integer1, Result) */
+	case AML_BIT_NAND_OP:	/* NAnd (Integer0, Integer1, Result) */
 
 		return (~(integer0 & integer1));
 
-
-	case AML_BIT_OR_OP:             /* Or (Integer0, Integer1, Result) */
+	case AML_BIT_OR_OP:	/* Or (Integer0, Integer1, Result) */
 
 		return (integer0 | integer1);
 
-
-	case AML_BIT_NOR_OP:            /* NOr (Integer0, Integer1, Result) */
+	case AML_BIT_NOR_OP:	/* NOr (Integer0, Integer1, Result) */
 
 		return (~(integer0 | integer1));
 
-
-	case AML_BIT_XOR_OP:            /* XOr (Integer0, Integer1, Result) */
+	case AML_BIT_XOR_OP:	/* XOr (Integer0, Integer1, Result) */
 
 		return (integer0 ^ integer1);
 
-
-	case AML_MULTIPLY_OP:           /* Multiply (Integer0, Integer1, Result) */
+	case AML_MULTIPLY_OP:	/* Multiply (Integer0, Integer1, Result) */
 
 		return (integer0 * integer1);
 
-
-	case AML_SHIFT_LEFT_OP:         /* shift_left (Operand, shift_count, Result)*/
+	case AML_SHIFT_LEFT_OP:	/* shift_left (Operand, shift_count, Result) */
 
 		return (integer0 << integer1);
 
-
-	case AML_SHIFT_RIGHT_OP:        /* shift_right (Operand, shift_count, Result) */
+	case AML_SHIFT_RIGHT_OP:	/* shift_right (Operand, shift_count, Result) */
 
 		return (integer0 >> integer1);
 
-
-	case AML_SUBTRACT_OP:           /* Subtract (Integer0, Integer1, Result) */
+	case AML_SUBTRACT_OP:	/* Subtract (Integer0, Integer1, Result) */
 
 		return (integer0 - integer1);
 
@@ -477,7 +447,6 @@
 	}
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_numeric_op
@@ -499,28 +468,24 @@
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_numeric_op (
-	u16                             opcode,
-	acpi_integer                    integer0,
-	acpi_integer                    integer1,
-	u8                              *logical_result)
+acpi_ex_do_logical_numeric_op(u16 opcode,
+			      acpi_integer integer0,
+			      acpi_integer integer1, u8 * logical_result)
 {
-	acpi_status                     status = AE_OK;
-	u8                              local_result = FALSE;
+	acpi_status status = AE_OK;
+	u8 local_result = FALSE;
 
-
-	ACPI_FUNCTION_TRACE ("ex_do_logical_numeric_op");
-
+	ACPI_FUNCTION_TRACE("ex_do_logical_numeric_op");
 
 	switch (opcode) {
-	case AML_LAND_OP:               /* LAnd (Integer0, Integer1) */
+	case AML_LAND_OP:	/* LAnd (Integer0, Integer1) */
 
 		if (integer0 && integer1) {
 			local_result = TRUE;
 		}
 		break;
 
-	case AML_LOR_OP:                /* LOr (Integer0, Integer1) */
+	case AML_LOR_OP:	/* LOr (Integer0, Integer1) */
 
 		if (integer0 || integer1) {
 			local_result = TRUE;
@@ -535,10 +500,9 @@
 	/* Return the logical result and status */
 
 	*logical_result = local_result;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
 
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_ex_do_logical_op
@@ -566,24 +530,20 @@
  ******************************************************************************/
 
 acpi_status
-acpi_ex_do_logical_op (
-	u16                             opcode,
-	union acpi_operand_object       *operand0,
-	union acpi_operand_object       *operand1,
-	u8                              *logical_result)
+acpi_ex_do_logical_op(u16 opcode,
+		      union acpi_operand_object *operand0,
+		      union acpi_operand_object *operand1, u8 * logical_result)
 {
-	union acpi_operand_object       *local_operand1 = operand1;
-	acpi_integer                    integer0;
-	acpi_integer                    integer1;
-	u32                             length0;
-	u32                             length1;
-	acpi_status                     status = AE_OK;
-	u8                              local_result = FALSE;
-	int                             compare;
+	union acpi_operand_object *local_operand1 = operand1;
+	acpi_integer integer0;
+	acpi_integer integer1;
+	u32 length0;
+	u32 length1;
+	acpi_status status = AE_OK;
+	u8 local_result = FALSE;
+	int compare;
 
-
-	ACPI_FUNCTION_TRACE ("ex_do_logical_op");
-
+	ACPI_FUNCTION_TRACE("ex_do_logical_op");
 
 	/*
 	 * Convert the second operand if necessary.  The first operand
@@ -592,18 +552,19 @@
 	 * guaranteed to be either Integer/String/Buffer by the operand
 	 * resolution mechanism.
 	 */
-	switch (ACPI_GET_OBJECT_TYPE (operand0)) {
+	switch (ACPI_GET_OBJECT_TYPE(operand0)) {
 	case ACPI_TYPE_INTEGER:
-		status = acpi_ex_convert_to_integer (operand1, &local_operand1, 16);
+		status =
+		    acpi_ex_convert_to_integer(operand1, &local_operand1, 16);
 		break;
 
 	case ACPI_TYPE_STRING:
-		status = acpi_ex_convert_to_string (operand1, &local_operand1,
-				 ACPI_IMPLICIT_CONVERT_HEX);
+		status = acpi_ex_convert_to_string(operand1, &local_operand1,
+						   ACPI_IMPLICIT_CONVERT_HEX);
 		break;
 
 	case ACPI_TYPE_BUFFER:
-		status = acpi_ex_convert_to_buffer (operand1, &local_operand1);
+		status = acpi_ex_convert_to_buffer(operand1, &local_operand1);
 		break;
 
 	default:
@@ -611,14 +572,14 @@
 		break;
 	}
 
-	if (ACPI_FAILURE (status)) {
+	if (ACPI_FAILURE(status)) {
 		goto cleanup;
 	}
 
 	/*
 	 * Two cases: 1) Both Integers, 2) Both Strings or Buffers
 	 */
-	if (ACPI_GET_OBJECT_TYPE (operand0) == ACPI_TYPE_INTEGER) {
+	if (ACPI_GET_OBJECT_TYPE(operand0) == ACPI_TYPE_INTEGER) {
 		/*
 		 * 1) Both operands are of type integer
 		 *    Note: local_operand1 may have changed above
@@ -627,21 +588,21 @@
 		integer1 = local_operand1->integer.value;
 
 		switch (opcode) {
-		case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
 
 			if (integer0 == integer1) {
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+		case AML_LGREATER_OP:	/* LGreater (Operand0, Operand1) */
 
 			if (integer0 > integer1) {
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+		case AML_LLESS_OP:	/* LLess (Operand0, Operand1) */
 
 			if (integer0 < integer1) {
 				local_result = TRUE;
@@ -652,8 +613,7 @@
 			status = AE_AML_INTERNAL;
 			break;
 		}
-	}
-	else {
+	} else {
 		/*
 		 * 2) Both operands are Strings or both are Buffers
 		 *    Note: Code below takes advantage of common Buffer/String
@@ -665,31 +625,31 @@
 
 		/* Lexicographic compare: compare the data bytes */
 
-		compare = ACPI_MEMCMP ((const char * ) operand0->buffer.pointer,
-				 (const char * ) local_operand1->buffer.pointer,
-				 (length0 > length1) ? length1 : length0);
+		compare = ACPI_MEMCMP((const char *)operand0->buffer.pointer,
+				      (const char *)local_operand1->buffer.
+				      pointer,
+				      (length0 > length1) ? length1 : length0);
 
 		switch (opcode) {
-		case AML_LEQUAL_OP:             /* LEqual (Operand0, Operand1) */
+		case AML_LEQUAL_OP:	/* LEqual (Operand0, Operand1) */
 
 			/* Length and all bytes must be equal */
 
-			if ((length0 == length1) &&
-				(compare == 0)) {
+			if ((length0 == length1) && (compare == 0)) {
 				/* Length and all bytes match ==> TRUE */
 
 				local_result = TRUE;
 			}
 			break;
 
-		case AML_LGREATER_OP:           /* LGreater (Operand0, Operand1) */
+		case AML_LGREATER_OP:	/* LGreater (Operand0, Operand1) */
 
 			if (compare > 0) {
 				local_result = TRUE;
-				goto cleanup;   /* TRUE */
+				goto cleanup;	/* TRUE */
 			}
 			if (compare < 0) {
-				goto cleanup;   /* FALSE */
+				goto cleanup;	/* FALSE */
 			}
 
 			/* Bytes match (to shortest length), compare lengths */
@@ -699,14 +659,14 @@
 			}
 			break;
 
-		case AML_LLESS_OP:              /* LLess (Operand0, Operand1) */
+		case AML_LLESS_OP:	/* LLess (Operand0, Operand1) */
 
 			if (compare > 0) {
-				goto cleanup;   /* FALSE */
+				goto cleanup;	/* FALSE */
 			}
 			if (compare < 0) {
 				local_result = TRUE;
-				goto cleanup;   /* TRUE */
+				goto cleanup;	/* TRUE */
 			}
 
 			/* Bytes match (to shortest length), compare lengths */
@@ -722,18 +682,16 @@
 		}
 	}
 
-cleanup:
+      cleanup:
 
 	/* New object was created if implicit conversion performed - delete */
 
 	if (local_operand1 != operand1) {
-		acpi_ut_remove_reference (local_operand1);
+		acpi_ut_remove_reference(local_operand1);
 	}
 
 	/* Return the logical result and status */
 
 	*logical_result = local_result;
-	return_ACPI_STATUS (status);
+	return_ACPI_STATUS(status);
 }
-
-
