mirror of https://gitee.com/openkylin/linux.git
ACPI: OSL: Rework acpi_check_resource_conflict()
Rearrange the code in acpi_check_resource_conflict() so as to drop redundant checks and uneeded local variables from there and modify the messages printed by that function to be more concise and hopefully easier to understand. While at it, replace direct printk() usage with pr_*(). Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
f86b15a1e6
commit
505ca2f777
|
@ -1458,38 +1458,28 @@ __setup("acpi_enforce_resources=", acpi_enforce_resources_setup);
|
||||||
int acpi_check_resource_conflict(const struct resource *res)
|
int acpi_check_resource_conflict(const struct resource *res)
|
||||||
{
|
{
|
||||||
acpi_adr_space_type space_id;
|
acpi_adr_space_type space_id;
|
||||||
acpi_size length;
|
|
||||||
u8 warn = 0;
|
|
||||||
int clash = 0;
|
|
||||||
|
|
||||||
if (acpi_enforce_resources == ENFORCE_RESOURCES_NO)
|
if (acpi_enforce_resources == ENFORCE_RESOURCES_NO)
|
||||||
return 0;
|
return 0;
|
||||||
if (!(res->flags & IORESOURCE_IO) && !(res->flags & IORESOURCE_MEM))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (res->flags & IORESOURCE_IO)
|
if (res->flags & IORESOURCE_IO)
|
||||||
space_id = ACPI_ADR_SPACE_SYSTEM_IO;
|
space_id = ACPI_ADR_SPACE_SYSTEM_IO;
|
||||||
else
|
else if (res->flags & IORESOURCE_MEM)
|
||||||
space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
|
space_id = ACPI_ADR_SPACE_SYSTEM_MEMORY;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
|
||||||
length = resource_size(res);
|
if (!acpi_check_address_range(space_id, res->start, resource_size(res), 1))
|
||||||
if (acpi_enforce_resources != ENFORCE_RESOURCES_NO)
|
return 0;
|
||||||
warn = 1;
|
|
||||||
clash = acpi_check_address_range(space_id, res->start, length, warn);
|
pr_info("Resource conflict; ACPI support missing from driver?\n");
|
||||||
|
|
||||||
|
if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT)
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
|
if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX)
|
||||||
|
pr_notice("Resource conflict: System may be unstable or behave erratically\n");
|
||||||
|
|
||||||
if (clash) {
|
|
||||||
if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) {
|
|
||||||
if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX)
|
|
||||||
printk(KERN_NOTICE "ACPI: This conflict may"
|
|
||||||
" cause random problems and system"
|
|
||||||
" instability\n");
|
|
||||||
printk(KERN_INFO "ACPI: If an ACPI driver is available"
|
|
||||||
" for this device, you should use it instead of"
|
|
||||||
" the native driver\n");
|
|
||||||
}
|
|
||||||
if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT)
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(acpi_check_resource_conflict);
|
EXPORT_SYMBOL(acpi_check_resource_conflict);
|
||||||
|
|
Loading…
Reference in New Issue