Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1242811
| From | Yinghai Lu <yinghai@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v7 42/60] PCI: Move saved required resource list out of required+optional assigning |
| Date | 2015-10-09 00:10 +0200 |
| Message-ID | <qhrxT-83b-11@gated-at.bofh.it> (permalink) |
| References | <qhrex-7rq-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
We will need to share saved required list for alt_size support, so move
it out from required+optional assigning.
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
drivers/pci/setup-bus.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index 5143ea2..ede619c 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -456,6 +456,9 @@ static bool has_addon(struct list_head *head,
int add_count = 0;
struct pci_dev_resource *dev_res, *tmp_res;
+ if (!realloc_head)
+ return false;
+
/* check if we have add really */
list_for_each_entry(dev_res, head, list) {
tmp_res = res_to_dev_res(realloc_head, dev_res->res);
@@ -492,9 +495,9 @@ static void restore_resource(struct pci_dev_resource *save_res,
}
static bool __assign_resources_required_optional_sorted(struct list_head *head,
+ struct list_head *save_head,
struct list_head *realloc_head)
{
- LIST_HEAD(save_head);
LIST_HEAD(local_fail_head);
struct pci_dev_resource *save_res;
struct pci_dev_resource *dev_res, *tmp_res;
@@ -502,12 +505,6 @@ static bool __assign_resources_required_optional_sorted(struct list_head *head,
resource_size_t add_align, add_size;
struct resource *res;
- if (!has_addon(head, realloc_head))
- return false;
-
- if (!save_resources(head, &save_head))
- return false;
-
/* Update res in head list with add_size in realloc_head list */
list_for_each_entry(dev_res, head, list) {
res = dev_res->res;
@@ -548,7 +545,6 @@ static bool __assign_resources_required_optional_sorted(struct list_head *head,
/* Remove head list from realloc_head list */
list_for_each_entry(dev_res, head, list)
remove_from_list(realloc_head, dev_res->res);
- free_list(&save_head);
free_list(head);
return true;
@@ -562,7 +558,7 @@ static bool __assign_resources_required_optional_sorted(struct list_head *head,
if (res->parent && !pci_need_to_release(fail_type, res)) {
/* remove it from realloc_head list */
remove_from_list(realloc_head, res);
- remove_from_list(&save_head, res);
+ remove_from_list(save_head, res);
list_del(&dev_res->list);
kfree(dev_res);
}
@@ -581,11 +577,9 @@ static bool __assign_resources_required_optional_sorted(struct list_head *head,
}
}
/* Restore start/end/flags from saved list */
- list_for_each_entry(save_res, &save_head, list)
+ list_for_each_entry(save_res, save_head, list)
restore_resource(save_res, save_res->res);
- free_list(&save_head);
-
return false;
}
@@ -603,16 +597,24 @@ static void __assign_resources_sorted(struct list_head *head,
* then try to reassign add_size for some resources.
*/
+ LIST_HEAD(save_head);
+
/* Check required+optional add */
- if (realloc_head &&
- __assign_resources_required_optional_sorted(head, realloc_head))
+ if (has_addon(head, realloc_head) &&
+ save_resources(head, &save_head) &&
+ __assign_resources_required_optional_sorted(head, &save_head,
+ realloc_head)) {
+ free_list(&save_head);
return;
+ }
sort_resources(head);
/* Satisfy the must-have resource requests */
assign_requested_resources_sorted(head, fail_head);
+ free_list(&save_head);
+
/* Try to satisfy any additional optional resource
requests */
if (realloc_head)
--
1.8.4.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v7 00/60] PCI: Resource allocation cleanup for v4.4 Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:00 +0200
[PATCH v7 21/60] PCI: Get new realloc size for bridge for last try Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:00 +0200
[PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:00 +0200
Re: [PATCH v7 03/60] sparc/PCI: Unify pci_register_region() Khalid Aziz <khalid.aziz@oracle.com> - 2015-10-09 18:20 +0200
[PATCH v7 42/60] PCI: Move saved required resource list out of required+optional assigning Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:10 +0200
[PATCH v7 58/60] PCI: Introduce resource_disabled() Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:50 +0200
Re: [v7,58/60] PCI: Introduce resource_disabled() Michael Ellerman <mpe@ellerman.id.au> - 2015-10-13 11:50 +0200
[PATCH v7 50/60] PCI: Allow bridge optional only io port resource required size to be 0 Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:50 +0200
[PATCH v7 28/60] PCI: Don't add too much optional size for hotplug bridge MMIO Yinghai Lu <yinghai@kernel.org> - 2015-10-09 00:50 +0200
csiph-web