Skip to content

Commit

Permalink
ACPICA: Remove ACPI_GET_OBJECT_TYPE macro
Browse files Browse the repository at this point in the history
Remove all instances of this obsolete macro, since it is now a
simple reference to ->common.type. There were about 150 invocations
of the macro across 41 files. ACPICA BZ 755.

http://www.acpica.org/bugzilla/show_bug.cgi?id=755

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lin Ming <ming.m.lin@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Bob Moore authored and Len Brown committed Mar 26, 2009
1 parent 32c9ef9 commit 3371c19
Show file tree
Hide file tree
Showing 38 changed files with 158 additions and 194 deletions.
4 changes: 0 additions & 4 deletions drivers/acpi/acpica/acmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,6 @@
#define ACPI_GET_DESCRIPTOR_TYPE(d) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type)
#define ACPI_SET_DESCRIPTOR_TYPE(d, t) (((union acpi_descriptor *)(void *)(d))->common.descriptor_type = t)

/* Macro to test the object type */

#define ACPI_GET_OBJECT_TYPE(d) (((union acpi_operand_object *)(void *)(d))->common.type)

/*
* Macros for the master AML opcode table
*/
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dsmthdat.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,6 @@ acpi_ds_method_data_get_type(u16 opcode,

/* Get the object type */

return_VALUE(ACPI_GET_OBJECT_TYPE(object));
return_VALUE(object->type);
}
#endif
6 changes: 3 additions & 3 deletions drivers/acpi/acpica/dsobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ acpi_ds_create_node(struct acpi_walk_state *walk_state,

/* Re-type the object according to its argument */

node->type = ACPI_GET_OBJECT_TYPE(obj_desc);
node->type = obj_desc->common.type;

/* Attach obj to node */

Expand Down Expand Up @@ -619,7 +619,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,

/* Perform per-object initialization */

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER:

/*
Expand Down Expand Up @@ -803,7 +803,7 @@ acpi_ds_init_object_from_op(struct acpi_walk_state *walk_state,
default:

ACPI_ERROR((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE(obj_desc)));
obj_desc->common.type));

status = AE_AML_OPERAND_TYPE;
break;
Expand Down
8 changes: 3 additions & 5 deletions drivers/acpi/acpica/dsopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode,

/* Host object must be a Buffer */

if (ACPI_GET_OBJECT_TYPE(buffer_desc) != ACPI_TYPE_BUFFER) {
if (buffer_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO,
"Target of Create Field is not a Buffer object - %s",
acpi_ut_get_object_type_name(buffer_desc)));
Expand Down Expand Up @@ -1365,10 +1365,8 @@ acpi_ds_exec_end_control_op(struct acpi_walk_state * walk_state,
if ((ACPI_GET_DESCRIPTOR_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_DESC_TYPE_OPERAND)
&&
(ACPI_GET_OBJECT_TYPE
(walk_state->results->results.obj_desc[0]) ==
ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])->
common.type == ACPI_TYPE_LOCAL_REFERENCE)
&& ((walk_state->results->results.obj_desc[0])->
reference.class != ACPI_REFCLASS_INDEX)) {
status =
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state)
goto push_result;
}

type = ACPI_GET_OBJECT_TYPE(*operand);
type = (*operand)->common.type;

status = acpi_ex_resolve_to_value(operand, walk_state);
if (ACPI_FAILURE(status)) {
Expand Down
5 changes: 2 additions & 3 deletions drivers/acpi/acpica/dswexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,10 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state,
goto cleanup;
}

if (ACPI_GET_OBJECT_TYPE(local_obj_desc) != ACPI_TYPE_INTEGER) {
if (local_obj_desc->common.type != ACPI_TYPE_INTEGER) {
ACPI_ERROR((AE_INFO,
"Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
obj_desc, walk_state,
ACPI_GET_OBJECT_TYPE(obj_desc)));
obj_desc, walk_state, obj_desc->common.type));

status = AE_AML_OPERAND_TYPE;
goto cleanup;
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/acpica/evgpeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
*/
obj_desc = pkg_desc->package.elements[0];

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {

/* Use FADT-defined GPE device (from definition of _PRW) */

Expand All @@ -417,14 +417,14 @@ acpi_ev_match_prw_and_gpe(acpi_handle obj_handle,
/* Integer is the GPE number in the FADT described GPE blocks */

gpe_number = (u32) obj_desc->integer.value;
} else if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_PACKAGE) {
} else if (obj_desc->common.type == ACPI_TYPE_PACKAGE) {

/* Package contains a GPE reference and GPE number within a GPE block */

if ((obj_desc->package.count < 2) ||
(ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[0]) !=
((obj_desc->package.elements[0])->common.type !=
ACPI_TYPE_LOCAL_REFERENCE)
|| (ACPI_GET_OBJECT_TYPE(obj_desc->package.elements[1]) !=
|| ((obj_desc->package.elements[1])->common.type !=
ACPI_TYPE_INTEGER)) {
goto cleanup;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ acpi_ev_install_handler(acpi_handle obj_handle,

/* Devices are handled different than regions */

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_DEVICE) {
if (obj_desc->common.type == ACPI_TYPE_DEVICE) {

/* Check if this Device already has a handler for this address space */

Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,

/* Source Object can be either an op_region or a Buffer/Field */

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_REGION:

ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
Expand Down Expand Up @@ -501,7 +501,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
*/
if ((!ddb_handle) ||
(ACPI_GET_DESCRIPTOR_TYPE(ddb_handle) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE(ddb_handle) != ACPI_TYPE_LOCAL_REFERENCE)) {
(ddb_handle->common.type != ACPI_TYPE_LOCAL_REFERENCE)) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}

Expand Down
11 changes: 5 additions & 6 deletions drivers/acpi/acpica/exconvrt.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,

ACPI_FUNCTION_TRACE_PTR(ex_convert_to_integer, obj_desc);

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:

/* No conversion necessary */
Expand Down Expand Up @@ -116,7 +116,7 @@ acpi_ex_convert_to_integer(union acpi_operand_object *obj_desc,

/* String conversion is different than Buffer conversion */

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_STRING:

/*
Expand Down Expand Up @@ -206,7 +206,7 @@ acpi_ex_convert_to_buffer(union acpi_operand_object *obj_desc,

ACPI_FUNCTION_TRACE_PTR(ex_convert_to_buffer, obj_desc);

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER:

/* No conversion necessary */
Expand Down Expand Up @@ -409,7 +409,7 @@ acpi_ex_convert_to_string(union acpi_operand_object * obj_desc,

ACPI_FUNCTION_TRACE_PTR(ex_convert_to_string, obj_desc);

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_STRING:

/* No conversion necessary */
Expand Down Expand Up @@ -605,8 +605,7 @@ acpi_ex_convert_to_target_type(acpi_object_type destination_type,
default:
/* No conversion allowed for these types */

if (destination_type !=
ACPI_GET_OBJECT_TYPE(source_desc)) {
if (destination_type != source_desc->common.type) {
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"Explicit operator, will store (%s) over existing type (%s)\n",
acpi_ut_get_object_type_name
Expand Down
19 changes: 8 additions & 11 deletions drivers/acpi/acpica/exdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

/* Decode object type */

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_LOCAL_REFERENCE:

acpi_os_printf("Reference: [%s] ",
Expand Down Expand Up @@ -531,7 +531,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

acpi_os_printf("%X", obj_desc->reference.value);

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {

/* Value is an Integer */

Expand All @@ -548,7 +548,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

acpi_os_printf("%X", obj_desc->reference.value);

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
if (obj_desc->common.type == ACPI_TYPE_INTEGER) {

/* Value is an Integer */

Expand Down Expand Up @@ -686,9 +686,8 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)

if (!obj_desc->buffer_field.buffer_obj) {
ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL*\n"));
} else
if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj)
!= ACPI_TYPE_BUFFER) {
} else if ((obj_desc->buffer_field.buffer_obj)->common.type !=
ACPI_TYPE_BUFFER) {
acpi_os_printf("*not a Buffer*\n");
} else {
acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj,
Expand Down Expand Up @@ -737,8 +736,7 @@ void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth)
default:
/* Unknown Type */

acpi_os_printf("Unknown Type %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc));
acpi_os_printf("Unknown Type %X\n", obj_desc->common.type);
break;
}

Expand Down Expand Up @@ -939,7 +937,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,

/* Packages may only contain a few object types */

switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_INTEGER:

acpi_os_printf("[Integer] = %8.8X%8.8X\n",
Expand Down Expand Up @@ -990,8 +988,7 @@ acpi_ex_dump_package_obj(union acpi_operand_object *obj_desc,

default:

acpi_os_printf("[Unknown Type] %X\n",
ACPI_GET_OBJECT_TYPE(obj_desc));
acpi_os_printf("[Unknown Type] %X\n", obj_desc->common.type);
break;
}
}
Expand Down
29 changes: 13 additions & 16 deletions drivers/acpi/acpica/exfield.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(AE_BAD_PARAMETER);
}

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
/*
* If the buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results.
Expand All @@ -95,9 +95,8 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,
return_ACPI_STATUS(status);
}
}
} else
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
&& (obj_desc->field.region_obj->region.space_id ==
} else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus read. We must create a buffer to hold the data
Expand Down Expand Up @@ -163,7 +162,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state,

ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n",
obj_desc, ACPI_GET_OBJECT_TYPE(obj_desc), buffer,
obj_desc, obj_desc->common.type, buffer,
(u32) length));
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n",
Expand Down Expand Up @@ -222,7 +221,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
return_ACPI_STATUS(AE_AML_NO_OPERAND);
}

if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_BUFFER_FIELD) {
if (obj_desc->common.type == ACPI_TYPE_BUFFER_FIELD) {
/*
* If the buffer_field arguments have not been previously evaluated,
* evaluate them now and save the results.
Expand All @@ -233,17 +232,16 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
return_ACPI_STATUS(status);
}
}
} else
if ((ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_LOCAL_REGION_FIELD)
&& (obj_desc->field.region_obj->region.space_id ==
} else if ((obj_desc->common.type == ACPI_TYPE_LOCAL_REGION_FIELD) &&
(obj_desc->field.region_obj->region.space_id ==
ACPI_ADR_SPACE_SMBUS)) {
/*
* This is an SMBus write. We will bypass the entire field mechanism
* and handoff the buffer directly to the handler.
*
* Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE).
*/
if (ACPI_GET_OBJECT_TYPE(source_desc) != ACPI_TYPE_BUFFER) {
if (source_desc->common.type != ACPI_TYPE_BUFFER) {
ACPI_ERROR((AE_INFO,
"SMBus write requires Buffer, found type %s",
acpi_ut_get_object_type_name(source_desc)));
Expand Down Expand Up @@ -291,7 +289,7 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,

/* Get a pointer to the data to be written */

switch (ACPI_GET_OBJECT_TYPE(source_desc)) {
switch (source_desc->common.type) {
case ACPI_TYPE_INTEGER:
buffer = &source_desc->integer.value;
length = sizeof(source_desc->integer.value);
Expand All @@ -314,15 +312,14 @@ acpi_ex_write_data_to_field(union acpi_operand_object *source_desc,
ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
source_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE
(source_desc)),
ACPI_GET_OBJECT_TYPE(source_desc), buffer, length));
acpi_ut_get_type_name(source_desc->common.type),
source_desc->common.type, buffer, length));

ACPI_DEBUG_PRINT((ACPI_DB_BFIELD,
"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
obj_desc,
acpi_ut_get_type_name(ACPI_GET_OBJECT_TYPE(obj_desc)),
ACPI_GET_OBJECT_TYPE(obj_desc),
acpi_ut_get_type_name(obj_desc->common.type),
obj_desc->common.type,
obj_desc->common_field.bit_length,
obj_desc->common_field.start_field_bit_offset,
obj_desc->common_field.base_byte_offset));
Expand Down
8 changes: 4 additions & 4 deletions drivers/acpi/acpica/exfldio.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc,

/* We must have a valid region */

if (ACPI_GET_OBJECT_TYPE(rgn_desc) != ACPI_TYPE_REGION) {
if (rgn_desc->common.type != ACPI_TYPE_REGION) {
ACPI_ERROR((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE(rgn_desc),
rgn_desc->common.type,
acpi_ut_get_object_type_name(rgn_desc)));

return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
Expand Down Expand Up @@ -390,7 +390,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
* index_field - Write to an Index Register, then read/write from/to a
* Data Register
*/
switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
switch (obj_desc->common.type) {
case ACPI_TYPE_BUFFER_FIELD:
/*
* If the buffer_field arguments have not been previously evaluated,
Expand Down Expand Up @@ -527,7 +527,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
default:

ACPI_ERROR((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE(obj_desc)));
obj_desc->common.type));
status = AE_AML_INTERNAL;
break;
}
Expand Down
Loading

0 comments on commit 3371c19

Please sign in to comment.