Re: [PATCH] ACPICA: amlresrc.h: Neaten AML_<FOO> definitions and uses

From: Joe Perches
Date: Fri Jul 04 2014 - 06:31:29 EST


ping?

On Fri, 2014-05-09 at 16:25 -0700, Joe Perches wrote:
> Use a more normal style for these slightly odd #defines.
>
> Remove trailing semicolons from #defines
> Add semicolon to uses.
>
> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
>
> I think these are unnecessarily obfuscating and the #defines
> should be expanded in-place instead.
>
> drivers/acpi/acpica/amlresrc.h | 137 +++++++++++++++++++++++++----------------
> 1 file changed, 84 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
> index f3f8344..fb1a1b5 100644
> --- a/drivers/acpi/acpica/amlresrc.h
> +++ b/drivers/acpi/acpica/amlresrc.h
> @@ -133,38 +133,46 @@ struct asl_resource_node {
> /*
> * SMALL descriptors
> */
> -#define AML_RESOURCE_SMALL_HEADER_COMMON \
> - u8 descriptor_type;
> +#define AML_RESOURCE_SMALL_HEADER_COMMON \
> + u8 descriptor_type
>
> struct aml_resource_small_header {
> -AML_RESOURCE_SMALL_HEADER_COMMON};
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> +};
>
> struct aml_resource_irq {
> - AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u16 irq_mask;
> u8 flags;
> };
>
> struct aml_resource_irq_noflags {
> - AML_RESOURCE_SMALL_HEADER_COMMON u16 irq_mask;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u16 irq_mask;
> };
>
> struct aml_resource_dma {
> - AML_RESOURCE_SMALL_HEADER_COMMON u8 dma_channel_mask;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u8 dma_channel_mask;
> u8 flags;
> };
>
> struct aml_resource_start_dependent {
> - AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u8 flags;
> };
>
> struct aml_resource_start_dependent_noprio {
> -AML_RESOURCE_SMALL_HEADER_COMMON};
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> +};
>
> struct aml_resource_end_dependent {
> -AML_RESOURCE_SMALL_HEADER_COMMON};
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> +};
>
> struct aml_resource_io {
> - AML_RESOURCE_SMALL_HEADER_COMMON u8 flags;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u8 flags;
> u16 minimum;
> u16 maximum;
> u8 alignment;
> @@ -172,19 +180,23 @@ struct aml_resource_io {
> };
>
> struct aml_resource_fixed_io {
> - AML_RESOURCE_SMALL_HEADER_COMMON u16 address;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u16 address;
> u8 address_length;
> };
>
> struct aml_resource_vendor_small {
> -AML_RESOURCE_SMALL_HEADER_COMMON};
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> +};
>
> struct aml_resource_end_tag {
> - AML_RESOURCE_SMALL_HEADER_COMMON u8 checksum;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u8 checksum;
> };
>
> struct aml_resource_fixed_dma {
> - AML_RESOURCE_SMALL_HEADER_COMMON u16 request_lines;
> + AML_RESOURCE_SMALL_HEADER_COMMON;
> + u16 request_lines;
> u16 channels;
> u8 width;
> };
> @@ -192,12 +204,13 @@ struct aml_resource_fixed_dma {
> /*
> * LARGE descriptors
> */
> -#define AML_RESOURCE_LARGE_HEADER_COMMON \
> - u8 descriptor_type;\
> - u16 resource_length;
> +#define AML_RESOURCE_LARGE_HEADER_COMMON \
> + u8 descriptor_type; \
> + u16 resource_length
>
> struct aml_resource_large_header {
> -AML_RESOURCE_LARGE_HEADER_COMMON};
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> +};
>
> /* General Flags for address space resource descriptors */
>
> @@ -206,7 +219,8 @@ AML_RESOURCE_LARGE_HEADER_COMMON};
> #define ACPI_RESOURCE_FLAG_MAF 8
>
> struct aml_resource_memory24 {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 flags;
> u16 minimum;
> u16 maximum;
> u16 alignment;
> @@ -214,10 +228,12 @@ struct aml_resource_memory24 {
> };
>
> struct aml_resource_vendor_large {
> -AML_RESOURCE_LARGE_HEADER_COMMON};
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> +};
>
> struct aml_resource_memory32 {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 flags;
> u32 minimum;
> u32 maximum;
> u32 alignment;
> @@ -225,22 +241,26 @@ struct aml_resource_memory32 {
> };
>
> struct aml_resource_fixed_memory32 {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 flags;
> u32 address;
> u32 address_length;
> };
>
> -#define AML_RESOURCE_ADDRESS_COMMON \
> - u8 resource_type; \
> - u8 flags; \
> - u8 specific_flags;
> +#define AML_RESOURCE_ADDRESS_COMMON \
> + u8 resource_type; \
> + u8 flags; \
> + u8 specific_flags
>
> struct aml_resource_address {
> -AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_ADDRESS_COMMON};
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_ADDRESS_COMMON;
> +};
>
> struct aml_resource_extended_address64 {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_ADDRESS_COMMON u8 revision_ID;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_ADDRESS_COMMON;
> + u8 revision_ID;
> u8 reserved;
> u64 granularity;
> u64 minimum;
> @@ -253,8 +273,9 @@ struct aml_resource_extended_address64 {
> #define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
>
> struct aml_resource_address64 {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_ADDRESS_COMMON u64 granularity;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_ADDRESS_COMMON;
> + u64 granularity;
> u64 minimum;
> u64 maximum;
> u64 translation_offset;
> @@ -262,8 +283,9 @@ struct aml_resource_address64 {
> };
>
> struct aml_resource_address32 {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_ADDRESS_COMMON u32 granularity;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_ADDRESS_COMMON;
> + u32 granularity;
> u32 minimum;
> u32 maximum;
> u32 translation_offset;
> @@ -271,8 +293,9 @@ struct aml_resource_address32 {
> };
>
> struct aml_resource_address16 {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_ADDRESS_COMMON u16 granularity;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_ADDRESS_COMMON;
> + u16 granularity;
> u16 minimum;
> u16 maximum;
> u16 translation_offset;
> @@ -280,14 +303,16 @@ struct aml_resource_address16 {
> };
>
> struct aml_resource_extended_irq {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 flags;
> u8 interrupt_count;
> u32 interrupts[1];
> /* res_source_index, res_source optional fields follow */
> };
>
> struct aml_resource_generic_register {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 address_space_id;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 address_space_id;
> u8 bit_width;
> u8 bit_offset;
> u8 access_size; /* ACPI 3.0, was previously Reserved */
> @@ -297,7 +322,8 @@ struct aml_resource_generic_register {
> /* Common descriptor for gpio_int and gpio_io (ACPI 5.0) */
>
> struct aml_resource_gpio {
> - AML_RESOURCE_LARGE_HEADER_COMMON u8 revision_id;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + u8 revision_id;
> u8 connection_type;
> u16 flags;
> u16 int_flags;
> @@ -327,14 +353,14 @@ struct aml_resource_gpio {
>
> /* Common preamble for all serial descriptors (ACPI 5.0) */
>
> -#define AML_RESOURCE_SERIAL_COMMON \
> - u8 revision_id; \
> - u8 res_source_index; \
> - u8 type; \
> - u8 flags; \
> - u16 type_specific_flags; \
> - u8 type_revision_id; \
> - u16 type_data_length; \
> +#define AML_RESOURCE_SERIAL_COMMON \
> + u8 revision_id; \
> + u8 res_source_index; \
> + u8 type; \
> + u8 flags; \
> + u16 type_specific_flags; \
> + u8 type_revision_id; \
> + u16 type_data_length
>
> /* Values for the type field above */
>
> @@ -345,11 +371,14 @@ struct aml_resource_gpio {
> #define AML_RESOURCE_VENDOR_SERIALBUSTYPE 192 /* Vendor defined is 0xC0-0xFF (NOT SUPPORTED) */
>
> struct aml_resource_common_serialbus {
> -AML_RESOURCE_LARGE_HEADER_COMMON AML_RESOURCE_SERIAL_COMMON};
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_SERIAL_COMMON;
> +};
>
> struct aml_resource_i2c_serialbus {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_SERIAL_COMMON;
> + u32 connection_speed;
> u16 slave_address;
> /*
> * Optional fields follow immediately:
> @@ -363,8 +392,9 @@ struct aml_resource_i2c_serialbus {
> #define AML_RESOURCE_I2C_MIN_DATA_LEN 6
>
> struct aml_resource_spi_serialbus {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_SERIAL_COMMON u32 connection_speed;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_SERIAL_COMMON;
> + u32 connection_speed;
> u8 data_bit_length;
> u8 clock_phase;
> u8 clock_polarity;
> @@ -381,8 +411,9 @@ struct aml_resource_spi_serialbus {
> #define AML_RESOURCE_SPI_MIN_DATA_LEN 9
>
> struct aml_resource_uart_serialbus {
> - AML_RESOURCE_LARGE_HEADER_COMMON
> - AML_RESOURCE_SERIAL_COMMON u32 default_baud_rate;
> + AML_RESOURCE_LARGE_HEADER_COMMON;
> + AML_RESOURCE_SERIAL_COMMON;
> + u32 default_baud_rate;
> u16 rx_fifo_size;
> u16 tx_fifo_size;
> u8 parity;
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/