lib: acpi: fix for build error when acpi not enabled
fix for acpi.h header file generates invalid C-code when CONFIG_ACPI=n Signed-off-by: Najumon B.A <najumon.ba@intel.com>
This commit is contained in:
parent
793c507209
commit
2139479722
2 changed files with 5 additions and 9 deletions
|
@ -62,11 +62,8 @@ struct acpi_mcfg {
|
||||||
|
|
||||||
struct acpi_irq_resource {
|
struct acpi_irq_resource {
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
union {
|
|
||||||
uint16_t irq;
|
|
||||||
uint16_t irqs[CONFIG_ACPI_IRQ_VECTOR_MAX];
|
|
||||||
};
|
|
||||||
uint8_t irq_vector_max;
|
uint8_t irq_vector_max;
|
||||||
|
uint16_t *irqs;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_reg_base {
|
struct acpi_reg_base {
|
||||||
|
@ -79,8 +76,8 @@ struct acpi_reg_base {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct acpi_mmio_resource {
|
struct acpi_mmio_resource {
|
||||||
struct acpi_reg_base reg_base[CONFIG_ACPI_MMIO_ENTRIES_MAX];
|
|
||||||
uint8_t mmio_max;
|
uint8_t mmio_max;
|
||||||
|
struct acpi_reg_base *reg_base;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -457,11 +457,10 @@ int acpi_device_irq_get(struct acpi_dev *child_dev, struct acpi_irq_resource *ir
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res->Data.ExtendedIrq.InterruptCount > CONFIG_ACPI_IRQ_VECTOR_MAX) {
|
if (res->Data.ExtendedIrq.InterruptCount > irq_res->irq_vector_max) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(irq_res, 0, sizeof(struct acpi_irq_resource));
|
|
||||||
irq_res->irq_vector_max = res->Data.ExtendedIrq.InterruptCount;
|
irq_res->irq_vector_max = res->Data.ExtendedIrq.InterruptCount;
|
||||||
for (int i = 0; i < irq_res->irq_vector_max; i++) {
|
for (int i = 0; i < irq_res->irq_vector_max; i++) {
|
||||||
irq_res->irqs[i] = (uint16_t)res->Data.ExtendedIrq.Interrupts[i];
|
irq_res->irqs[i] = (uint16_t)res->Data.ExtendedIrq.Interrupts[i];
|
||||||
|
@ -470,7 +469,7 @@ int acpi_device_irq_get(struct acpi_dev *child_dev, struct acpi_irq_resource *ir
|
||||||
irq_res->flags = arch_acpi_encode_irq_flags(res->Data.ExtendedIrq.Polarity,
|
irq_res->flags = arch_acpi_encode_irq_flags(res->Data.ExtendedIrq.Polarity,
|
||||||
res->Data.ExtendedIrq.Triggering);
|
res->Data.ExtendedIrq.Triggering);
|
||||||
} else {
|
} else {
|
||||||
if (res->Data.Irq.InterruptCount > CONFIG_ACPI_IRQ_VECTOR_MAX) {
|
if (res->Data.Irq.InterruptCount > irq_res->irq_vector_max) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,7 +530,7 @@ int acpi_device_mmio_get(struct acpi_dev *child_dev, struct acpi_mmio_resource *
|
||||||
}
|
}
|
||||||
|
|
||||||
res = ACPI_NEXT_RESOURCE(res);
|
res = ACPI_NEXT_RESOURCE(res);
|
||||||
if (mmio_cnt >= CONFIG_ACPI_MMIO_ENTRIES_MAX &&
|
if (mmio_cnt >= mmio_res->mmio_max &&
|
||||||
res->Type != ACPI_RESOURCE_TYPE_END_TAG) {
|
res->Type != ACPI_RESOURCE_TYPE_END_TAG) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue