patch-2.4.6 linux/drivers/acpi/resources/rscreate.c

Next file: linux/drivers/acpi/resources/rsdump.c
Previous file: linux/drivers/acpi/resources/rscalc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.5/linux/drivers/acpi/resources/rscreate.c linux/drivers/acpi/resources/rscreate.c
@@ -1,9 +1,7 @@
 /*******************************************************************************
  *
- * Module Name: rscreate - Acpi_rs_create_resource_list
- *                         Acpi_rs_create_pci_routing_table
- *                         Acpi_rs_create_byte_stream
- *              $Revision: 25 $
+ * Module Name: rscreate - Create resource lists/tables
+ *              $Revision: 33 $
  *
  ******************************************************************************/
 
@@ -31,7 +29,7 @@
 #include "amlcode.h"
 #include "acnamesp.h"
 
-#define _COMPONENT          RESOURCE_MANAGER
+#define _COMPONENT          ACPI_RESOURCES
 	 MODULE_NAME         ("rscreate")
 
 
@@ -39,8 +37,7 @@
  *
  * FUNCTION:    Acpi_rs_create_resource_list
  *
- * PARAMETERS:
- *              Byte_stream_buffer      - Pointer to the resource byte stream
+ * PARAMETERS:  Byte_stream_buffer      - Pointer to the resource byte stream
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Pointer to the size of Output_buffer
  *
@@ -63,9 +60,9 @@
 {
 
 	ACPI_STATUS             status;
-	u8                      *byte_stream_start = NULL;
+	u8                      *byte_stream_start;
 	u32                     list_size_needed = 0;
-	u32                     byte_stream_buffer_length = 0;
+	u32                     byte_stream_buffer_length;
 
 
 	/*
@@ -79,8 +76,7 @@
 	 * Pass the Byte_stream_buffer into a module that can calculate
 	 * the buffer size needed for the linked list
 	 */
-	status = acpi_rs_calculate_list_length (byte_stream_start,
-			 byte_stream_buffer_length,
+	status = acpi_rs_calculate_list_length (byte_stream_start, byte_stream_buffer_length,
 			 &list_size_needed);
 
 	/*
@@ -101,8 +97,7 @@
 		 */
 		MEMSET (output_buffer, 0x00, *output_buffer_length);
 
-		status = acpi_rs_byte_stream_to_list (byte_stream_start,
-				 byte_stream_buffer_length,
+		status = acpi_rs_byte_stream_to_list (byte_stream_start, byte_stream_buffer_length,
 				 &output_buffer);
 
 		/*
@@ -121,7 +116,6 @@
 
 	*output_buffer_length = list_size_needed;
 	return (AE_OK);
-
 }
 
 
@@ -129,9 +123,8 @@
  *
  * FUNCTION:    Acpi_rs_create_pci_routing_table
  *
- * PARAMETERS:
- *              Package_object          - Pointer to an ACPI_OPERAND_OBJECT
- *                                          package
+ * PARAMETERS:  Package_object          - Pointer to an ACPI_OPERAND_OBJECT
+ *                                        package
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
@@ -167,8 +160,12 @@
 	 * Params already validated, so we don't re-validate here
 	 */
 
-	status = acpi_rs_calculate_pci_routing_table_length(package_object,
-			  &buffer_size_needed);
+	status = acpi_rs_calculate_pci_routing_table_length (package_object,
+			 &buffer_size_needed);
+
+	if (!ACPI_SUCCESS(status)) {
+		return (status);
+	}
 
 	/*
 	 * If the data will fit into the available buffer
@@ -240,8 +237,7 @@
 			sub_object_list++;
 
 			if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
-				user_prt->pin =
-						(u32) (*sub_object_list)->integer.value;
+				user_prt->pin = (u32) (*sub_object_list)->integer.value;
 			}
 
 			else {
@@ -253,10 +249,10 @@
 			 */
 			sub_object_list++;
 
-			switch ((*sub_object_list)->common.type)
-			{
+			switch ((*sub_object_list)->common.type) {
 			case INTERNAL_TYPE_REFERENCE:
-				if ((*sub_object_list)->reference.op_code != AML_NAMEPATH_OP) {
+
+				if ((*sub_object_list)->reference.opcode != AML_INT_NAMEPATH_OP) {
 					return (AE_BAD_DATA);
 				}
 
@@ -298,6 +294,7 @@
 
 
 			default:
+
 			   return (AE_BAD_DATA);
 			   break;
 			}
@@ -312,8 +309,7 @@
 			sub_object_list++;
 
 			if (ACPI_TYPE_INTEGER == (*sub_object_list)->common.type) {
-				user_prt->source_index =
-						(u32) (*sub_object_list)->integer.value;
+				user_prt->source_index = (u32) (*sub_object_list)->integer.value;
 			}
 
 			else {
@@ -338,7 +334,6 @@
 	 * Report the amount of buffer used
 	 */
 	*output_buffer_length = buffer_size_needed;
-
 	return (AE_OK);
 }
 
@@ -347,8 +342,7 @@
  *
  * FUNCTION:    Acpi_rs_create_byte_stream
  *
- * PARAMETERS:
- *              Linked_list_buffer      - Pointer to the resource linked list
+ * PARAMETERS:  Linked_list_buffer      - Pointer to the resource linked list
  *              Output_buffer           - Pointer to the user's buffer
  *              Output_buffer_length    - Size of Output_buffer
  *
@@ -365,7 +359,7 @@
 
 ACPI_STATUS
 acpi_rs_create_byte_stream (
-	RESOURCE                *linked_list_buffer,
+	ACPI_RESOURCE           *linked_list_buffer,
 	u8                      *output_buffer,
 	u32                     *output_buffer_length)
 {
@@ -400,8 +394,7 @@
 		 */
 		MEMSET (output_buffer, 0x00, *output_buffer_length);
 
-		status = acpi_rs_list_to_byte_stream (linked_list_buffer,
-				 byte_stream_size_needed,
+		status = acpi_rs_list_to_byte_stream (linked_list_buffer, byte_stream_size_needed,
 				 &output_buffer);
 
 		/*
@@ -412,6 +405,7 @@
 		}
 
 	}
+
 	else {
 		*output_buffer_length = byte_stream_size_needed;
 		return (AE_BUFFER_OVERFLOW);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)