提交 da13b336 编写于 作者: A Andy Shevchenko 提交者: Rafael J. Wysocki

ACPI: LPSS: Replace loop with first entry retrieval

After the commit 6505e452371d ("ACPI: LPSS: Use the helper
acpi_dev_get_memory_resources()") the list is empty or
contains only resource of IORESOURCE_MEM type. Hence, no
need to check for the type, and since we break after the
first found, no need to iterate over full list. That said,
replace loop with first entry retrieval.
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 6e5cbe7c
...@@ -656,16 +656,14 @@ static int acpi_lpss_create_device(struct acpi_device *adev, ...@@ -656,16 +656,14 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
if (ret < 0) if (ret < 0)
goto err_out; goto err_out;
list_for_each_entry(rentry, &resource_list, node) rentry = list_first_entry_or_null(&resource_list, struct resource_entry, node);
if (resource_type(rentry->res) == IORESOURCE_MEM) { if (rentry) {
if (dev_desc->prv_size_override) if (dev_desc->prv_size_override)
pdata->mmio_size = dev_desc->prv_size_override; pdata->mmio_size = dev_desc->prv_size_override;
else else
pdata->mmio_size = resource_size(rentry->res); pdata->mmio_size = resource_size(rentry->res);
pdata->mmio_base = ioremap(rentry->res->start, pdata->mmio_base = ioremap(rentry->res->start, pdata->mmio_size);
pdata->mmio_size); }
break;
}
acpi_dev_free_resource_list(&resource_list); acpi_dev_free_resource_list(&resource_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册