[ACPI] Avoid unnecessary casts.

This commit is contained in:
Thomas Faber 2020-04-05 23:01:41 +02:00
parent 9bcd835074
commit 28be285da5
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -1440,7 +1440,7 @@ Bus_PDO_QueryResourceRequirements(
{ {
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
{ {
ACPI_RESOURCE_EXTENDED_IRQ *irq_data = (ACPI_RESOURCE_EXTENDED_IRQ*) &resource->Data; ACPI_RESOURCE_EXTENDED_IRQ *irq_data = &resource->Data.ExtendedIrq;
if (irq_data->ProducerConsumer == ACPI_PRODUCER) if (irq_data->ProducerConsumer == ACPI_PRODUCER)
break; break;
for (i = 0; i < irq_data->InterruptCount; i++) for (i = 0; i < irq_data->InterruptCount; i++)
@ -1458,7 +1458,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_IRQ: case ACPI_RESOURCE_TYPE_IRQ:
{ {
ACPI_RESOURCE_IRQ *irq_data = (ACPI_RESOURCE_IRQ*) &resource->Data; ACPI_RESOURCE_IRQ *irq_data = &resource->Data.Irq;
for (i = 0; i < irq_data->InterruptCount; i++) for (i = 0; i < irq_data->InterruptCount; i++)
{ {
RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE; RequirementDescriptor->Option = (i == 0) ? IO_RESOURCE_PREFERRED : IO_RESOURCE_ALTERNATIVE;
@ -1474,7 +1474,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_DMA: case ACPI_RESOURCE_TYPE_DMA:
{ {
ACPI_RESOURCE_DMA *dma_data = (ACPI_RESOURCE_DMA*) &resource->Data; ACPI_RESOURCE_DMA *dma_data = &resource->Data.Dma;
for (i = 0; i < dma_data->ChannelCount; i++) for (i = 0; i < dma_data->ChannelCount; i++)
{ {
RequirementDescriptor->Type = CmResourceTypeDma; RequirementDescriptor->Type = CmResourceTypeDma;
@ -1504,7 +1504,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_IO: case ACPI_RESOURCE_TYPE_IO:
{ {
ACPI_RESOURCE_IO *io_data = (ACPI_RESOURCE_IO*) &resource->Data; ACPI_RESOURCE_IO *io_data = &resource->Data.Io;
RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO; RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
if (io_data->IoDecode == ACPI_DECODE_16) if (io_data->IoDecode == ACPI_DECODE_16)
RequirementDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE; RequirementDescriptor->Flags |= CM_RESOURCE_PORT_16_BIT_DECODE;
@ -1523,7 +1523,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_FIXED_IO: case ACPI_RESOURCE_TYPE_FIXED_IO:
{ {
ACPI_RESOURCE_FIXED_IO *io_data = (ACPI_RESOURCE_FIXED_IO*) &resource->Data; ACPI_RESOURCE_FIXED_IO *io_data = &resource->Data.FixedIo;
RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO; RequirementDescriptor->Flags = CM_RESOURCE_PORT_IO;
RequirementDescriptor->u.Port.Length = io_data->AddressLength; RequirementDescriptor->u.Port.Length = io_data->AddressLength;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
@ -1538,7 +1538,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_ADDRESS16: case ACPI_RESOURCE_TYPE_ADDRESS16:
{ {
ACPI_RESOURCE_ADDRESS16 *addr16_data = (ACPI_RESOURCE_ADDRESS16*) &resource->Data; ACPI_RESOURCE_ADDRESS16 *addr16_data = &resource->Data.Address16;
if (addr16_data->ProducerConsumer == ACPI_PRODUCER) if (addr16_data->ProducerConsumer == ACPI_PRODUCER)
break; break;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
@ -1586,7 +1586,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_ADDRESS32: case ACPI_RESOURCE_TYPE_ADDRESS32:
{ {
ACPI_RESOURCE_ADDRESS32 *addr32_data = (ACPI_RESOURCE_ADDRESS32*) &resource->Data; ACPI_RESOURCE_ADDRESS32 *addr32_data = &resource->Data.Address32;
if (addr32_data->ProducerConsumer == ACPI_PRODUCER) if (addr32_data->ProducerConsumer == ACPI_PRODUCER)
break; break;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
@ -1634,7 +1634,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_ADDRESS64: case ACPI_RESOURCE_TYPE_ADDRESS64:
{ {
ACPI_RESOURCE_ADDRESS64 *addr64_data = (ACPI_RESOURCE_ADDRESS64*) &resource->Data; ACPI_RESOURCE_ADDRESS64 *addr64_data = &resource->Data.Address64;
if (addr64_data->ProducerConsumer == ACPI_PRODUCER) if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
break; break;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
@ -1683,7 +1683,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64: case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
{ {
ACPI_RESOURCE_EXTENDED_ADDRESS64 *addr64_data = (ACPI_RESOURCE_EXTENDED_ADDRESS64*) &resource->Data; ACPI_RESOURCE_EXTENDED_ADDRESS64 *addr64_data = &resource->Data.ExtAddress64;
if (addr64_data->ProducerConsumer == ACPI_PRODUCER) if (addr64_data->ProducerConsumer == ACPI_PRODUCER)
break; break;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
@ -1732,7 +1732,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_MEMORY24: case ACPI_RESOURCE_TYPE_MEMORY24:
{ {
ACPI_RESOURCE_MEMORY24 *mem24_data = (ACPI_RESOURCE_MEMORY24*) &resource->Data; ACPI_RESOURCE_MEMORY24 *mem24_data = &resource->Data.Memory24;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
RequirementDescriptor->Type = CmResourceTypeMemory; RequirementDescriptor->Type = CmResourceTypeMemory;
RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive; RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
@ -1750,7 +1750,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_MEMORY32: case ACPI_RESOURCE_TYPE_MEMORY32:
{ {
ACPI_RESOURCE_MEMORY32 *mem32_data = (ACPI_RESOURCE_MEMORY32*) &resource->Data; ACPI_RESOURCE_MEMORY32 *mem32_data = &resource->Data.Memory32;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
RequirementDescriptor->Type = CmResourceTypeMemory; RequirementDescriptor->Type = CmResourceTypeMemory;
RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive; RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
@ -1768,7 +1768,7 @@ Bus_PDO_QueryResourceRequirements(
} }
case ACPI_RESOURCE_TYPE_FIXED_MEMORY32: case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
{ {
ACPI_RESOURCE_FIXED_MEMORY32 *fixedmem32_data = (ACPI_RESOURCE_FIXED_MEMORY32*) &resource->Data; ACPI_RESOURCE_FIXED_MEMORY32 *fixedmem32_data = &resource->Data.FixedMemory32;
RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED; RequirementDescriptor->Option = CurrentRes ? 0 : IO_RESOURCE_PREFERRED;
RequirementDescriptor->Type = CmResourceTypeMemory; RequirementDescriptor->Type = CmResourceTypeMemory;
RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive; RequirementDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;