patch-2.4.10 linux/drivers/acpi/resources/rsutils.c

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

diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/resources/rsutils.c linux/drivers/acpi/resources/rsutils.c
@@ -1,7 +1,7 @@
 /*******************************************************************************
  *
  * Module Name: rsutils - Utilities for the resource manager
- *              $Revision: 19 $
+ *              $Revision: 22 $
  *
  ******************************************************************************/
 
@@ -51,16 +51,19 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prt_method_data (
-	ACPI_HANDLE             handle,
-	ACPI_BUFFER             *ret_buffer)
+	acpi_handle             handle,
+	acpi_buffer             *ret_buffer)
 {
-	ACPI_OPERAND_OBJECT     *ret_obj;
-	ACPI_STATUS             status;
+	acpi_operand_object     *ret_obj;
+	acpi_status             status;
 	u32                     buffer_space_needed;
 
 
+	FUNCTION_TRACE ("Rs_get_prt_method_data");
+
+
 	/* already validated params, so we won't repeat here */
 
 	buffer_space_needed = ret_buffer->length;
@@ -70,13 +73,14 @@
 	 */
 	status = acpi_ns_evaluate_relative (handle, "_PRT", NULL, &ret_obj);
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 	if (!ret_obj) {
 		/* Return object is required */
 
-		return (AE_TYPE);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRT\n"));
+		return_ACPI_STATUS (AE_TYPE);
 	}
 
 
@@ -111,7 +115,7 @@
 cleanup:
 
 	acpi_ut_remove_reference (ret_obj);
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -133,16 +137,19 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_crs_method_data (
-	ACPI_HANDLE             handle,
-	ACPI_BUFFER             *ret_buffer)
+	acpi_handle             handle,
+	acpi_buffer             *ret_buffer)
 {
-	ACPI_OPERAND_OBJECT     *ret_obj;
-	ACPI_STATUS             status;
+	acpi_operand_object     *ret_obj;
+	acpi_status             status;
 	u32                     buffer_space_needed = ret_buffer->length;
 
 
+	FUNCTION_TRACE ("Rs_get_crs_method_data");
+
+
 	/* already validated params, so we won't repeat here */
 
 	/*
@@ -150,13 +157,14 @@
 	 */
 	status = acpi_ns_evaluate_relative (handle, "_CRS", NULL, &ret_obj);
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 	if (!ret_obj) {
 		/* Return object is required */
 
-		return (AE_TYPE);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _CRS\n"));
+		return_ACPI_STATUS (AE_TYPE);
 	}
 
 	/*
@@ -191,7 +199,7 @@
 cleanup:
 
 	acpi_ut_remove_reference (ret_obj);
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -213,16 +221,19 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_get_prs_method_data (
-	ACPI_HANDLE             handle,
-	ACPI_BUFFER             *ret_buffer)
+	acpi_handle             handle,
+	acpi_buffer             *ret_buffer)
 {
-	ACPI_OPERAND_OBJECT     *ret_obj;
-	ACPI_STATUS             status;
+	acpi_operand_object     *ret_obj;
+	acpi_status             status;
 	u32                     buffer_space_needed = ret_buffer->length;
 
 
+	FUNCTION_TRACE ("Rs_get_prs_method_data");
+
+
 	/* already validated params, so we won't repeat here */
 
 	/*
@@ -230,13 +241,14 @@
 	 */
 	status = acpi_ns_evaluate_relative (handle, "_PRS", NULL, &ret_obj);
 	if (ACPI_FAILURE (status)) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 	if (!ret_obj) {
 		/* Return object is required */
 
-		return (AE_TYPE);
+		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object was returned from _PRS\n"));
+		return_ACPI_STATUS (AE_TYPE);
 	}
 
 	/*
@@ -270,7 +282,7 @@
 cleanup:
 
 	acpi_ut_remove_reference (ret_obj);
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -292,18 +304,20 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_rs_set_srs_method_data (
-	ACPI_HANDLE             handle,
-	ACPI_BUFFER             *in_buffer)
+	acpi_handle             handle,
+	acpi_buffer             *in_buffer)
 {
-	ACPI_OPERAND_OBJECT     *params[2];
-	ACPI_OPERAND_OBJECT     param_obj;
-	ACPI_STATUS             status;
+	acpi_operand_object     *params[2];
+	acpi_status             status;
 	u8                      *byte_stream = NULL;
 	u32                     buffer_size_needed = 0;
 
 
+	FUNCTION_TRACE ("Rs_set_srs_method_data");
+
+
 	/* already validated params, so we won't repeat here */
 
 	/*
@@ -323,15 +337,15 @@
 	 * if not, exit with the error
 	 */
 	if (AE_BUFFER_OVERFLOW != status) {
-		return (status);
+		return_ACPI_STATUS (status);
 	}
 
 	/*
 	 * Allocate the buffer needed
 	 */
-	byte_stream = acpi_ut_callocate(buffer_size_needed);
+	byte_stream = ACPI_MEM_CALLOCATE (buffer_size_needed);
 	if (NULL == byte_stream) {
-		return (AE_NO_MEMORY);
+		return_ACPI_STATUS (AE_NO_MEMORY);
 	}
 
 	/*
@@ -346,32 +360,31 @@
 	/*
 	 * Init the param object
 	 */
-	acpi_ut_init_static_object (&param_obj);
-
-	/*
-	 * Method requires one parameter.  Set it up
-	 */
-	params [0] = &param_obj;
+	params[0] = acpi_ut_create_internal_object (ACPI_TYPE_BUFFER);
+	if (!params[0]) {
+		status = AE_NO_MEMORY;
+		goto cleanup;
+	}
 	params [1] = NULL;
 
 	/*
 	 *  Set up the parameter object
 	 */
-	param_obj.common.type   = ACPI_TYPE_BUFFER;
-	param_obj.buffer.length = buffer_size_needed;
-	param_obj.buffer.pointer = byte_stream;
+	params[0]->buffer.length  = buffer_size_needed;
+	params[0]->buffer.pointer = byte_stream;
 
 	/*
 	 * Execute the method, no return value
 	 */
 	status = acpi_ns_evaluate_relative (handle, "_SRS", params, NULL);
+	acpi_ut_remove_reference (params[0]);
 
 	/*
 	 * Clean up and return the status from Acpi_ns_evaluate_relative
 	 */
 cleanup:
 
-	acpi_ut_free (byte_stream);
-	return (status);
+	ACPI_MEM_FREE (byte_stream);
+	return_ACPI_STATUS (status);
 }
 

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