+ if (walk_state->num_operands == 0) {
+ ACPI_ERROR((AE_INFO,
+ "Missing operand/stack empty! State=%p #Ops=%X",
+ walk_state, walk_state->num_operands));
+ *object = NULL;
+ return (AE_AML_NO_OPERAND);
+ }
+
+ /* Pop the stack */
+
+ walk_state->num_operands--;
+
+ /* Check for a valid operand */
+
+ if (!walk_state->operands[walk_state->num_operands]) {
+ ACPI_ERROR((AE_INFO,
+ "Null operand! State=%p #Ops=%X",
+ walk_state, walk_state->num_operands));
+ *object = NULL;
+ return (AE_AML_NO_OPERAND);
+ }
+
+ /* Get operand and set stack entry to null */
+
+ *object = walk_state->operands[walk_state->num_operands];
+ walk_state->operands[walk_state->num_operands] = NULL;
+
+ ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
+ *object, acpi_ut_get_object_type_name(*object),
+ walk_state, walk_state->num_operands));
+
+ return (AE_OK);
+}
+
+/*******************************************************************************
+ *
+ * FUNCTION: acpi_ds_obj_stack_get_value
+ *
+ * PARAMETERS: Index - Stack index whose value is desired. Based
+ * on the top of the stack (index=0 == top)
+ * walk_state - Current Walk state
+ *
+ * RETURN: Pointer to the requested operand
+ *
+ * DESCRIPTION: Retrieve an object from this walk's operand stack. Index must
+ * be within the range of the current stack pointer.
+ *
+ ******************************************************************************/
+
+void *acpi_ds_obj_stack_get_value(u32 index, struct acpi_walk_state *walk_state)
+{
+
+ ACPI_FUNCTION_TRACE_PTR("ds_obj_stack_get_value", walk_state);
+
+ /* Can't do it if the stack is empty */
+
+ if (walk_state->num_operands == 0) {
+ return_PTR(NULL);
+ }
+
+ /* or if the index is past the top of the stack */
+
+ if (index > (walk_state->num_operands - (u32) 1)) {
+ return_PTR(NULL);
+ }
+
+ return_PTR(walk_state->
+ operands[(acpi_native_uint) (walk_state->num_operands - 1) -
+ index]);
+}
+#endif