summaryrefslogtreecommitdiff
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/utils.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c195
1 files changed, 101 insertions, 94 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 1ce2047c3804..6458c47f7ac2 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -30,15 +30,12 @@
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
-
#define _COMPONENT ACPI_BUS_COMPONENT
-ACPI_MODULE_NAME ("acpi_utils")
-
+ACPI_MODULE_NAME("acpi_utils")
/* --------------------------------------------------------------------------
Object Evaluation Helpers
-------------------------------------------------------------------------- */
-
#ifdef ACPI_DEBUG_OUTPUT
#define acpi_util_eval_error(h,p,s) {\
char prefix[80] = {'\0'};\
@@ -49,26 +46,24 @@ ACPI_MODULE_NAME ("acpi_utils")
#else
#define acpi_util_eval_error(h,p,s)
#endif
-
-
acpi_status
-acpi_extract_package (
- union acpi_object *package,
- struct acpi_buffer *format,
- struct acpi_buffer *buffer)
+acpi_extract_package(union acpi_object *package,
+ struct acpi_buffer *format, struct acpi_buffer *buffer)
{
- u32 size_required = 0;
- u32 tail_offset = 0;
- char *format_string = NULL;
- u32 format_count = 0;
- u32 i = 0;
- u8 *head = NULL;
- u8 *tail = NULL;
+ u32 size_required = 0;
+ u32 tail_offset = 0;
+ char *format_string = NULL;
+ u32 format_count = 0;
+ u32 i = 0;
+ u8 *head = NULL;
+ u8 *tail = NULL;
ACPI_FUNCTION_TRACE("acpi_extract_package");
- if (!package || (package->type != ACPI_TYPE_PACKAGE) || (package->package.count < 1)) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid 'package' argument\n"));
+ if (!package || (package->type != ACPI_TYPE_PACKAGE)
+ || (package->package.count < 1)) {
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+ "Invalid 'package' argument\n"));
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -82,18 +77,20 @@ acpi_extract_package (
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
- format_count = (format->length/sizeof(char)) - 1;
+ format_count = (format->length / sizeof(char)) - 1;
if (format_count > package->package.count) {
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Format specifies more objects [%d] than exist in package [%d].", format_count, package->package.count));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+ "Format specifies more objects [%d] than exist in package [%d].",
+ format_count, package->package.count));
return_ACPI_STATUS(AE_BAD_DATA);
}
- format_string = (char*)format->pointer;
+ format_string = (char *)format->pointer;
/*
* Calculate size_required.
*/
- for (i=0; i<format_count; i++) {
+ for (i = 0; i < format_count; i++) {
union acpi_object *element = &(package->package.elements[i]);
@@ -110,11 +107,15 @@ acpi_extract_package (
tail_offset += sizeof(acpi_integer);
break;
case 'S':
- size_required += sizeof(char*) + sizeof(acpi_integer) + sizeof(char);
- tail_offset += sizeof(char*);
+ size_required +=
+ sizeof(char *) + sizeof(acpi_integer) +
+ sizeof(char);
+ tail_offset += sizeof(char *);
break;
default:
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d]: got number, expecing [%c].\n", i, format_string[i]));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+ "Invalid package element [%d]: got number, expecing [%c].\n",
+ i, format_string[i]));
return_ACPI_STATUS(AE_BAD_DATA);
break;
}
@@ -124,15 +125,22 @@ acpi_extract_package (
case ACPI_TYPE_BUFFER:
switch (format_string[i]) {
case 'S':
- size_required += sizeof(char*) + (element->string.length * sizeof(char)) + sizeof(char);
- tail_offset += sizeof(char*);
+ size_required +=
+ sizeof(char *) +
+ (element->string.length * sizeof(char)) +
+ sizeof(char);
+ tail_offset += sizeof(char *);
break;
case 'B':
- size_required += sizeof(u8*) + (element->buffer.length * sizeof(u8));
- tail_offset += sizeof(u8*);
+ size_required +=
+ sizeof(u8 *) +
+ (element->buffer.length * sizeof(u8));
+ tail_offset += sizeof(u8 *);
break;
default:
- ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid package element [%d] got string/buffer, expecing [%c].\n", i, format_string[i]));
+ ACPI_DEBUG_PRINT((ACPI_DB_WARN,
+ "Invalid package element [%d] got string/buffer, expecing [%c].\n",
+ i, format_string[i]));
return_ACPI_STATUS(AE_BAD_DATA);
break;
}
@@ -140,7 +148,9 @@ acpi_extract_package (
case ACPI_TYPE_PACKAGE:
default:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found unsupported element at index=%d\n", i));
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+ "Found unsupported element at index=%d\n",
+ i));
/* TBD: handle nested packages... */
return_ACPI_STATUS(AE_SUPPORT);
break;
@@ -153,8 +163,7 @@ acpi_extract_package (
if (buffer->length < size_required) {
buffer->length = size_required;
return_ACPI_STATUS(AE_BUFFER_OVERFLOW);
- }
- else if (buffer->length != size_required || !buffer->pointer) {
+ } else if (buffer->length != size_required || !buffer->pointer) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}
@@ -164,7 +173,7 @@ acpi_extract_package (
/*
* Extract package data.
*/
- for (i=0; i<format_count; i++) {
+ for (i = 0; i < format_count; i++) {
u8 **pointer = NULL;
union acpi_object *element = &(package->package.elements[i]);
@@ -178,14 +187,16 @@ acpi_extract_package (
case ACPI_TYPE_INTEGER:
switch (format_string[i]) {
case 'N':
- *((acpi_integer*)head) = element->integer.value;
+ *((acpi_integer *) head) =
+ element->integer.value;
head += sizeof(acpi_integer);
break;
case 'S':
- pointer = (u8**)head;
+ pointer = (u8 **) head;
*pointer = tail;
- *((acpi_integer*)tail) = element->integer.value;
- head += sizeof(acpi_integer*);
+ *((acpi_integer *) tail) =
+ element->integer.value;
+ head += sizeof(acpi_integer *);
tail += sizeof(acpi_integer);
/* NULL terminate string */
*tail = (char)0;
@@ -201,20 +212,22 @@ acpi_extract_package (
case ACPI_TYPE_BUFFER:
switch (format_string[i]) {
case 'S':
- pointer = (u8**)head;
+ pointer = (u8 **) head;
*pointer = tail;
- memcpy(tail, element->string.pointer, element->string.length);
- head += sizeof(char*);
+ memcpy(tail, element->string.pointer,
+ element->string.length);
+ head += sizeof(char *);
tail += element->string.length * sizeof(char);
/* NULL terminate string */
*tail = (char)0;
tail += sizeof(char);
break;
case 'B':
- pointer = (u8**)head;
+ pointer = (u8 **) head;
*pointer = tail;
- memcpy(tail, element->buffer.pointer, element->buffer.length);
- head += sizeof(u8*);
+ memcpy(tail, element->buffer.pointer,
+ element->buffer.length);
+ head += sizeof(u8 *);
tail += element->buffer.length * sizeof(u8);
break;
default:
@@ -233,19 +246,17 @@ acpi_extract_package (
return_ACPI_STATUS(AE_OK);
}
-EXPORT_SYMBOL(acpi_extract_package);
+EXPORT_SYMBOL(acpi_extract_package);
acpi_status
-acpi_evaluate_integer (
- acpi_handle handle,
- acpi_string pathname,
- struct acpi_object_list *arguments,
- unsigned long *data)
+acpi_evaluate_integer(acpi_handle handle,
+ acpi_string pathname,
+ struct acpi_object_list *arguments, unsigned long *data)
{
- acpi_status status = AE_OK;
- union acpi_object *element;
- struct acpi_buffer buffer = {0,NULL};
+ acpi_status status = AE_OK;
+ union acpi_object *element;
+ struct acpi_buffer buffer = { 0, NULL };
ACPI_FUNCTION_TRACE("acpi_evaluate_integer");
@@ -253,7 +264,7 @@ acpi_evaluate_integer (
return_ACPI_STATUS(AE_BAD_PARAMETER);
element = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
- if(!element)
+ if (!element)
return_ACPI_STATUS(AE_NO_MEMORY);
memset(element, 0, sizeof(union acpi_object));
@@ -277,20 +288,18 @@ acpi_evaluate_integer (
return_ACPI_STATUS(AE_OK);
}
-EXPORT_SYMBOL(acpi_evaluate_integer);
+EXPORT_SYMBOL(acpi_evaluate_integer);
#if 0
acpi_status
-acpi_evaluate_string (
- acpi_handle handle,
- acpi_string pathname,
- acpi_object_list *arguments,
- acpi_string *data)
+acpi_evaluate_string(acpi_handle handle,
+ acpi_string pathname,
+ acpi_object_list * arguments, acpi_string * data)
{
- acpi_status status = AE_OK;
- acpi_object *element = NULL;
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+ acpi_status status = AE_OK;
+ acpi_object *element = NULL;
+ acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
ACPI_FUNCTION_TRACE("acpi_evaluate_string");
@@ -305,9 +314,9 @@ acpi_evaluate_string (
element = (acpi_object *) buffer.pointer;
- if ((element->type != ACPI_TYPE_STRING)
- || (element->type != ACPI_TYPE_BUFFER)
- || !element->string.length) {
+ if ((element->type != ACPI_TYPE_STRING)
+ || (element->type != ACPI_TYPE_BUFFER)
+ || !element->string.length) {
acpi_util_eval_error(handle, pathname, AE_BAD_DATA);
return_ACPI_STATUS(AE_BAD_DATA);
}
@@ -329,19 +338,17 @@ acpi_evaluate_string (
}
#endif
-
acpi_status
-acpi_evaluate_reference (
- acpi_handle handle,
- acpi_string pathname,
- struct acpi_object_list *arguments,
- struct acpi_handle_list *list)
+acpi_evaluate_reference(acpi_handle handle,
+ acpi_string pathname,
+ struct acpi_object_list *arguments,
+ struct acpi_handle_list *list)
{
- acpi_status status = AE_OK;
- union acpi_object *package = NULL;
- union acpi_object *element = NULL;
- struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- u32 i = 0;
+ acpi_status status = AE_OK;
+ union acpi_object *package = NULL;
+ union acpi_object *element = NULL;
+ struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+ u32 i = 0;
ACPI_FUNCTION_TRACE("acpi_evaluate_reference");
@@ -355,28 +362,28 @@ acpi_evaluate_reference (
if (ACPI_FAILURE(status))
goto end;
- package = (union acpi_object *) buffer.pointer;
+ package = (union acpi_object *)buffer.pointer;
if ((buffer.length == 0) || !package) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "No return object (len %X ptr %p)\n",
- (unsigned)buffer.length, package));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "No return object (len %X ptr %p)\n",
+ (unsigned)buffer.length, package));
status = AE_BAD_DATA;
acpi_util_eval_error(handle, pathname, status);
goto end;
}
if (package->type != ACPI_TYPE_PACKAGE) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Expecting a [Package], found type %X\n",
- package->type));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Expecting a [Package], found type %X\n",
+ package->type));
status = AE_BAD_DATA;
acpi_util_eval_error(handle, pathname, status);
goto end;
}
if (!package->package.count) {
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "[Package] has zero elements (%p)\n",
- package));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "[Package] has zero elements (%p)\n",
+ package));
status = AE_BAD_DATA;
acpi_util_eval_error(handle, pathname, status);
goto end;
@@ -395,9 +402,9 @@ acpi_evaluate_reference (
if (element->type != ACPI_TYPE_ANY) {
status = AE_BAD_DATA;
- ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
- "Expecting a [Reference] package element, found type %X\n",
- element->type));
+ ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+ "Expecting a [Reference] package element, found type %X\n",
+ element->type));
acpi_util_eval_error(handle, pathname, status);
break;
}
@@ -406,10 +413,10 @@ acpi_evaluate_reference (
list->handles[i] = element->reference.handle;
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found reference [%p]\n",
- list->handles[i]));
+ list->handles[i]));
}
-end:
+ end:
if (ACPI_FAILURE(status)) {
list->count = 0;
//kfree(list->handles);
@@ -419,5 +426,5 @@ end:
return_ACPI_STATUS(status);
}
-EXPORT_SYMBOL(acpi_evaluate_reference);
+EXPORT_SYMBOL(acpi_evaluate_reference);