Skip to content

Commit

Permalink
ACPICA: Cleanup coding style to reduce differences between Linux and …
Browse files Browse the repository at this point in the history
…ACPICA.

This is a cosmetic patch only. Comparison of the resulting binary showed
only line number differences.

This patch does not affect the generation of the Linux binary.
This patch decreases 314 lines of 20121018 divergence.diff.

ACPICA core uses ()'s on return statements. This is a known and committed
differences from Linux standard coding style.

This patch cleans up the Linux side ACPICA code to use this codying style
in order to reduce the source code differences between Linux and ACPICA.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Lv Zheng authored and Rafael J. Wysocki committed Jan 10, 2013
1 parent 3e8214e commit 9c0d793
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 35 deletions.
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,15 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
acpi_ev_address_space_dispatch(obj_desc, NULL, ACPI_READ,
region_offset, 8, &value);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}

*buffer = (u8)value;
buffer++;
region_offset++;
}

return AE_OK;
return (AE_OK);
}

/*******************************************************************************
Expand Down
6 changes: 4 additions & 2 deletions drivers/acpi/acpica/hwgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ acpi_hw_enable_wakeup_gpe_block(struct acpi_gpe_xrupt_info *gpe_xrupt_info,

u32 acpi_hw_get_gpe_register_bit(struct acpi_gpe_event_info *gpe_event_info)
{
return (u32)1 << (gpe_event_info->gpe_number -
gpe_event_info->register_info->base_gpe_number);

return ((u32)1 <<
(gpe_event_info->gpe_number -
gpe_event_info->register_info->base_gpe_number));
}

/******************************************************************************
Expand Down
18 changes: 9 additions & 9 deletions drivers/acpi/acpica/hwvalid.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ acpi_hw_validate_io_request(acpi_io_address address, u32 bit_width)
if ((bit_width != 8) && (bit_width != 16) && (bit_width != 32)) {
ACPI_ERROR((AE_INFO,
"Bad BitWidth parameter: %8.8X", bit_width));
return AE_BAD_PARAMETER;
return (AE_BAD_PARAMETER);
}

port_info = acpi_protected_ports;
Expand Down Expand Up @@ -234,11 +234,11 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
status = acpi_hw_validate_io_request(address, width);
if (ACPI_SUCCESS(status)) {
status = acpi_os_read_port(address, value, width);
return status;
return (status);
}

if (status != AE_AML_ILLEGAL_ADDRESS) {
return status;
return (status);
}

/*
Expand All @@ -253,7 +253,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
if (acpi_hw_validate_io_request(address, 8) == AE_OK) {
status = acpi_os_read_port(address, &one_byte, 8);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}

*value |= (one_byte << i);
Expand All @@ -262,7 +262,7 @@ acpi_status acpi_hw_read_port(acpi_io_address address, u32 *value, u32 width)
address++;
}

return AE_OK;
return (AE_OK);
}

/******************************************************************************
Expand Down Expand Up @@ -297,11 +297,11 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
status = acpi_hw_validate_io_request(address, width);
if (ACPI_SUCCESS(status)) {
status = acpi_os_write_port(address, value, width);
return status;
return (status);
}

if (status != AE_AML_ILLEGAL_ADDRESS) {
return status;
return (status);
}

/*
Expand All @@ -317,12 +317,12 @@ acpi_status acpi_hw_write_port(acpi_io_address address, u32 value, u32 width)
status =
acpi_os_write_port(address, (value >> i) & 0xFF, 8);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}
}

address++;
}

return AE_OK;
return (AE_OK);
}
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/nspredef.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ acpi_ns_check_predefined_names(struct acpi_namespace_node *node,

pathname = acpi_ns_get_external_pathname(node);
if (!pathname) {
return AE_OK; /* Could not get pathname, ignore */
return (AE_OK); /* Could not get pathname, ignore */
}

/*
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/nswalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ struct acpi_namespace_node *acpi_ns_get_next_node(struct acpi_namespace_node

/* It's really the parent's _scope_ that we want */

return parent_node->child;
return (parent_node->child);
}

/* Otherwise just return the next peer */

return child_node->peer;
return (child_node->peer);
}

/*******************************************************************************
Expand Down
14 changes: 7 additions & 7 deletions drivers/acpi/acpica/nsxfname.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,22 +539,22 @@ acpi_status acpi_install_method(u8 *buffer)
/* Parameter validation */

if (!buffer) {
return AE_BAD_PARAMETER;
return (AE_BAD_PARAMETER);
}

/* Table must be a DSDT or SSDT */

if (!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_DSDT) &&
!ACPI_COMPARE_NAME(table->signature, ACPI_SIG_SSDT)) {
return AE_BAD_HEADER;
return (AE_BAD_HEADER);
}

/* First AML opcode in the table must be a control method */

parser_state.aml = buffer + sizeof(struct acpi_table_header);
opcode = acpi_ps_peek_opcode(&parser_state);
if (opcode != AML_METHOD_OP) {
return AE_BAD_PARAMETER;
return (AE_BAD_PARAMETER);
}

/* Extract method information from the raw AML */
Expand All @@ -572,13 +572,13 @@ acpi_status acpi_install_method(u8 *buffer)
*/
aml_buffer = ACPI_ALLOCATE(aml_length);
if (!aml_buffer) {
return AE_NO_MEMORY;
return (AE_NO_MEMORY);
}

method_obj = acpi_ut_create_internal_object(ACPI_TYPE_METHOD);
if (!method_obj) {
ACPI_FREE(aml_buffer);
return AE_NO_MEMORY;
return (AE_NO_MEMORY);
}

/* Lock namespace for acpi_ns_lookup, we may be creating a new node */
Expand Down Expand Up @@ -644,12 +644,12 @@ acpi_status acpi_install_method(u8 *buffer)
/* Remove local reference to the method object */

acpi_ut_remove_reference(method_obj);
return status;
return (status);

error_exit:

ACPI_FREE(aml_buffer);
ACPI_FREE(method_obj);
return status;
return (status);
}
ACPI_EXPORT_SYMBOL(acpi_install_method)
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/rscalc.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static u8 acpi_rs_count_set_bits(u16 bit_field)
bit_field &= (u16) (bit_field - 1);
}

return bits_set;
return (bits_set);
}

/*******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/rsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ u16 acpi_rs_encode_bitmask(u8 * list, u8 count)
mask |= (0x1 << list[i]);
}

return mask;
return (mask);
}

/*******************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/tbutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ acpi_status acpi_tb_initialize_facs(void)
ACPI_CAST_INDIRECT_PTR(struct
acpi_table_header,
&acpi_gbl_FACS));
return status;
return (status);
}
#endif /* !ACPI_REDUCED_HARDWARE */

Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/utcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,

status = acpi_os_create_mutex(&dest_desc->mutex.os_mutex);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}
break;

Expand All @@ -795,7 +795,7 @@ acpi_ut_copy_simple_object(union acpi_operand_object *source_desc,
&dest_desc->event.
os_semaphore);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}
break;

Expand Down
14 changes: 7 additions & 7 deletions drivers/acpi/acpica/utlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ acpi_status acpi_ut_create_rw_lock(struct acpi_rw_lock *lock)
lock->num_readers = 0;
status = acpi_os_create_mutex(&lock->reader_mutex);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}

status = acpi_os_create_mutex(&lock->writer_mutex);
return status;
return (status);
}

void acpi_ut_delete_rw_lock(struct acpi_rw_lock *lock)
Expand Down Expand Up @@ -108,7 +108,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock)

status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}

/* Acquire the write lock only for the first reader */
Expand All @@ -121,7 +121,7 @@ acpi_status acpi_ut_acquire_read_lock(struct acpi_rw_lock *lock)
}

acpi_os_release_mutex(lock->reader_mutex);
return status;
return (status);
}

acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
Expand All @@ -130,7 +130,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)

status = acpi_os_acquire_mutex(lock->reader_mutex, ACPI_WAIT_FOREVER);
if (ACPI_FAILURE(status)) {
return status;
return (status);
}

/* Release the write lock only for the very last reader */
Expand All @@ -141,7 +141,7 @@ acpi_status acpi_ut_release_read_lock(struct acpi_rw_lock *lock)
}

acpi_os_release_mutex(lock->reader_mutex);
return status;
return (status);
}

/*******************************************************************************
Expand All @@ -165,7 +165,7 @@ acpi_status acpi_ut_acquire_write_lock(struct acpi_rw_lock *lock)
acpi_status status;

status = acpi_os_acquire_mutex(lock->writer_mutex, ACPI_WAIT_FOREVER);
return status;
return (status);
}

void acpi_ut_release_write_lock(struct acpi_rw_lock *lock)
Expand Down

0 comments on commit 9c0d793

Please sign in to comment.